日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國(guó)內(nèi)最全I(xiàn)T社區(qū)平臺(tái) 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁 > 互聯(lián)網(wǎng) > libnet 函數(shù)列表

libnet 函數(shù)列表

來源:程序員人生   發(fā)布時(shí)間:2015-08-24 08:46:01 閱讀次數(shù):2876次

libnet提供的接口函數(shù)按其作用可分為4類:
* 內(nèi)存管理(分配和釋放)函數(shù)
* 地址解析函數(shù)
* 數(shù)據(jù)包構(gòu)造函數(shù)
* 數(shù)據(jù)包發(fā)送函數(shù)

以下分別列出這些接口函數(shù)及其功能(其參數(shù)含義簡(jiǎn)單易懂,不再解釋)


內(nèi)存管理函數(shù)

單數(shù)據(jù)包內(nèi)存初始化
int libnet_init_packet(u_short packet_size, u_char **buf);

單數(shù)據(jù)包內(nèi)存釋放
void libnet_destroy_packet(u_char **buf);

多數(shù)據(jù)包內(nèi)存初始化
int libnet_init_packet_arena(struct libnet_arena **arena,u_short packet_num, u_short packet_size);

訪問多數(shù)據(jù)包內(nèi)存中的下1個(gè)數(shù)據(jù)包
u_char *libnet_next_packet_from_arena(struct libnet_arena **arena,u_short packet_size);

多數(shù)據(jù)包內(nèi)存釋放
void libnet_destroy_packet_arena(struct libnet_arena **arena);


地址解析函數(shù)

解析主機(jī)名
u_char *libnet_host_lookup(u_long ip, u_short use_name);

解析主機(jī)名(可重入函數(shù))
void libnet_host_lookup_r(u_long ip, u_short use_name, u_char *buf);

域名解析
u_long libnet_name_resolve(u_char *ip, u_short use_name);

獲得接口裝備IP地址
u_long libnet_get_ipaddr(struct libnet_link_int *l,const u_char *device, const u_char *ebuf);

獲得接口裝備硬件地址
struct ether_addr *libnet_get_hwaddr(struct libnet_link_int *l,const u_char *device,const u_char *ebuf);


數(shù)據(jù)包構(gòu)造函數(shù)

ARP協(xié)議數(shù)據(jù)包
int libnet_build_arp(u_short hrdw, u_short prot, u_short h_len,u_short p_len, u_short op, u_char *s_ha,
u_char *s_pa, u_char *t_ha, u_char *t_pa,const u_char *payload, int payload_len,u_char *packet_buf);

DNS協(xié)議數(shù)據(jù)包
int libnet_build_dns(u_short id, u_short flags, u_short num_q,u_short num_answ_rr, u_short num_auth_rr,
u_short num_add_rr, const u_char * payload,int payload_len, u_char *packet_buf);

以太網(wǎng)協(xié)議數(shù)據(jù)包
int libnet_build_ethernet(u_char *daddr, u_char *saddr, u_short id,const u_char *payload, int payload_len,
u_char *packet_buf);

ICMP協(xié)議數(shù)據(jù)包(ICMP_ECHO / ICMP_ECHOREPLY)
int libnet_build_icmp_echo(u_char type, u_char code, u_short id,
u_short seq, const u_char *payload,int payload_len, u_char *packet_buf);

ICMP協(xié)議數(shù)據(jù)包(ICMP_MASKREQ / ICMP_MASKREPLY)
int libnet_build_icmp_mask(u_char type, u_char code, u_short id,
u_short seq, u_long mask,const u_char *payload, int payload_len,
u_char *packet_buf);

ICMP協(xié)議數(shù)據(jù)包(ICMP_UNREACH)
int libnet_build_icmp_unreach(u_char type, u_char code,
u_short orig_len, u_char orig_tos,u_short orig_id, u_short orig_frag,
u_char orig_ttl, u_char orig_prot,u_long orig_saddr, u_long orig_daddr,
const u_char *payload, int payload_len,u_char *packet_buf);

ICMP協(xié)議數(shù)據(jù)包(ICMP_TIMEXCEED)
int libnet_build_icmp_timeexceed(u_char type, u_char code,
u_short orig_len, u_char orig_tos,u_short orig_id, u_short orig_frag,
u_char orig_ttl, u_char orig_prot,u_long orig_saddr, u_long orig_daddr,
const u_char *payload, int payload_len,u_char *packet_buf);

ICMP協(xié)議數(shù)據(jù)包(ICMP_REDIRECT)
int libnet_build_icmp_redirect(u_char type, u_char code, u_long gateway,
u_short orig_len, u_char orig_tos,u_short orig_id, u_short orig_frag,
u_char orig_ttl, u_char orig_prot,u_long orig_saddr, u_long orig_daddr,
const u_char *payload, int payload_len,u_char *packet_buf);

ICMP協(xié)議數(shù)據(jù)包(ICMP_TSTAMP / ICMP_TSTAMPREPLY)
int libnet_build_icmp_timestamp(u_char type, u_char code, u_short id,
u_short seq, n_time otime, n_time rtime,n_time ttime, const u_char *payload,
int payload_len, u_char *packet_buf);

IGMP協(xié)議數(shù)據(jù)包
int libnet_build_igmp(u_char type, u_char code, u_long ip,
const u_char *payload, int payload_len,u_char *packet_buf);

IP協(xié)議數(shù)據(jù)包
int libnet_build_ip(u_short len, u_char tos, u_short ip_id, u_short frag,u_char ttl, u_char protocol, u_long saddr, u_long daddr, const u_char *payload, int payload_len,u_char *packet_buf);

OSPF路由協(xié)議數(shù)據(jù)包
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路由協(xié)議數(shù)據(jù)包(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路由協(xié)議數(shù)據(jù)包(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路由協(xié)議數(shù)據(jù)包(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路由協(xié)議數(shù)據(jù)包(Link State Update (LSU))
int libnet_build_ospf_lsu(u_int num, const char *payload,int payload_s, u_char *buf);

OSPF路由協(xié)議數(shù)據(jù)包(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路由協(xié)議數(shù)據(jù)包(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路由協(xié)議數(shù)據(jù)包(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路由協(xié)議數(shù)據(jù)包(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路由協(xié)議數(shù)據(jù)包(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路由協(xié)議數(shù)據(jù)包
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協(xié)議數(shù)據(jù)包
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協(xié)議數(shù)據(jù)包
int libnet_build_udp(u_short sport, u_short dport, const u_char *payload,int payload_len, u_char *packet_buf);

IP協(xié)議數(shù)據(jù)包選項(xiàng)
int libnet_insert_ipo(struct ipoption *opt, u_char opt_len,u_char *packet_buf);

TCP協(xié)議數(shù)據(jù)包選項(xiàng)
int libnet_insert_tcpo(struct tcpoption *opt, u_char opt_len,u_char *packet_buf);


數(shù)據(jù)包發(fā)送函數(shù)

打開raw socket
int libnet_open_raw_sock(int protocol);

關(guān)閉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);

關(guān)閉鏈路層接口裝備
int libnet_close_link_interface(struct libnet_link_int *l);

發(fā)送IP數(shù)據(jù)包
int libnet_write_ip(int socket, u_char *packet, int packet_size);

發(fā)送鏈路層數(shù)據(jù)包
int libnet_write_link_layer(struct libnet_link_int *l,const u_char *device, u_char *packet,int packet_size);

檢驗(yàn)和計(jì)算
int libnet_do_checksum(u_char *packet, int protocol, int packet_size);


相干的支持函數(shù)

隨機(jī)數(shù)種子生成器
int libnet_seed_prand();

獲得隨機(jī)數(shù)
u_long libnet_get_prand(int modulus);

16進(jìn)制數(shù)據(jù)輸出
void libnet_hex_dump(u_char * buf, int len, int swap, FILE *stream);

端口列表鏈初始化
int libnet_plist_chain_new(struct libnet_plist_chain **plist,char *token_list);


獲得端口列表鏈的下1項(xiàng)(端口范圍)
int libnet_plist_chain_next_pair(struct libnet_plist_chain *plist,u_short *bport, u_short *eport);

端口列表鏈輸出顯示
int libnet_plist_chain_dump(struct libnet_plist_chain *plist);

獲得端口列表鏈
u_char *libnet_plist_chain_dump_string(struct libnet_plist_chain *plist);

端口列表鏈內(nèi)存釋放

void libnet_plist_chain_free(struct libnet_plist_chain *plist);


轉(zhuǎn)自:底層網(wǎng)絡(luò)開發(fā)庫之libnet 

生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對(duì)您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 亚洲欧美高清 | 国产又黄又爽又刺激的视频 | 成人av在线网站 | 精品久久中文字幕97 | 国产一区二区美女 | www.黄色在线观看 | 天天综合网91 | 欧美三级一区 | 日韩精品久久久久久久电影99爱 | 亚洲 欧洲 日韩 | 欧美午夜精品一区二区三区 | 欧美视频一 | 日韩h视频 | 天天干网站 | 激情中文字幕 | 亚洲国产精品女人久久久 | 麻豆视频网| 亚洲午夜免费视频 | 国产精品午夜电影 | 午夜国产一区 | 亚洲成人18 | 天天艹视频 | 三区在线 | 国产激情精品一区二区三区 | 国产精品一区二区三区在线 | 日本黄站 | 国产成人在线电影 | 久久国语 | 欧美一区二区不卡视频 | 日韩欧美电影在线观看 | 欧美福利网站 | 羞羞视频在线观看 | 亚洲一区二区三区免费 | 麻豆视频免费看 | 欧美成人精品一区二区三区在线看 | 欧美激情不卡 | 国产精品嫩草在线 | 精品久久免费 | 色片网址| 欧美日韩一区在线观看 | 97视频在线观看免费 |