设为首页 加入收藏

TOP

libnet 函数列表(二)
2015-07-16 12:57:23 来源: 作者: 【 】 浏览:21
Tags:libnet 数列
;


OSPF路由协议数据包:
int libnet_build_ospf(u_short len, u_char type, u_long router_id,u_long area_id, u_short auth_type,
const char *payload, int payload_s, u_char *buf);


OSPF路由协议数据包(Hello):
int libnet_build_ospf_hello(u_long netmask, u_short interval,
u_char options, u_char priority,u_int dead_interval, u_long des_router,
u_long backup, u_long neighbor,const char *payload, int payload_s,u_char *buf);


OSPF路由协议数据包(DataBase Description (DBD)):
int libnet_build_ospf_dbd(u_short len, u_char options, u_char type,
u_int sequence_num, const char *payload,int payload_s, u_char *buf);


OSPF路由协议数据包(Link State Request (LSR)):
int libnet_build_ospf_lsr(u_int type, u_int ls_id, u_long adv_router,
const char *payload, int payload_s,u_char *buf);


OSPF路由协议数据包(Link State Update (LSU)):
int libnet_build_ospf_lsu(u_int num, const char *payload,int payload_s, u_char *buf);


OSPF路由协议数据包(Link State Acknowledgement (LSA)):
int libnet_build_ospf_lsa(u_short age, u_char options, u_char type,u_int ls_id, u_long adv_router, u_int sequence_num, u_short len,const char *payload, int payload_s,u_char *buf);


OSPF路由协议数据包(OSPF Link Sate NetworkLink State Router):
int libnet_build_ospf_lsa_net(u_long netmask, u_int router_id,
const char *payload, int payload_s,u_char *buf);


OSPF路由协议数据包(Link State Router):
int libnet_build_ospf_lsa_rtr(u_short flags, u_short num, u_int id,
u_int data, u_char type, u_char tos,u_short metric, const char *payload,int payload_s, u_char *buf);


OSPF路由协议数据包(Link State Summary):
int libnet_build_ospf_lsa_sum(u_long netmask, u_int metric, u_int tos,
const char *payload, int payload_s,u_char *buf);


OSPF路由协议数据包(Link State AS External):
int libnet_build_ospf_lsa_as(u_long netmask, u_int metric,
u_long fwd_addr, u_int tag,const char *payload, int payload_s,u_char *buf);


RIP路由协议数据包:
int libnet_build_rip(u_char cmd, u_char ver, u_short domain,
u_short addr_fam, u_short route_tag, u_long ip,u_long mask, u_long next_hop, u_long metric,
const u_char *payload, int payload_len,u_char *packet_buf);


TCP协议数据包:
int libnet_build_tcp(u_short th_sport, u_short th_dport, u_long th_seq,
u_long th_ack, u_char th_flags, u_short th_win,u_short th_urg, const u_char *payload,int payload_len, u_char *packet_buf);


UDP协议数据包:
int libnet_build_udp(u_short sport, u_short dport, const u_char *payload,int payload_len, u_char *packet_buf);


IP协议数据包选项:
int libnet_insert_ipo(struct ipoption *opt, u_char opt_len,u_char *packet_buf);


TCP协议数据包选项:
int libnet_insert_tcpo(struct tcpoption *opt, u_char opt_len,u_char *packet_buf);



★ 数据包发送函数


打开raw socket:
int libnet_open_raw_sock(int protocol);


关闭raw socket:
int libnet_close_raw_sock(int socket);


选择接口设备:
int libnet_select_device(struct sockaddr_in *sin,
u_char **device, u_char *ebuf);


打开链路层接口设备:
struct libnet_link_int *libnet_open_link_interface(char *device,char *ebuf);


关闭链路层接口设备:
int libnet_close_link_interface(struct libnet_link_int *l);


发送IP数据包:
int libnet_write_ip(int socket, u_char *packet, int packet_size);


发送链路层数据包:
int libnet_write_link_layer(struct libnet_link_int *l,const u_char *device, u_char *packet,int packet_size);


检验和计算:
int libnet_do_checksum(u_char *packet, int protocol, int packet_size);



★ 相关的支持函数


随机数种子生成器:
int libnet_seed_prand();


获取随机数:
u_long libnet_get_prand(int modulus);


16进制数据输出:
void libnet_hex_dump(u_char * buf, int len, int swap, FILE *stream);


端口列表链初始化:
int libne

首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Linux 网络编程—— libnet 使用.. 下一篇深入理解二进制补码

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: