📄 libnet-functions.h.3
字号:
.br.ti -1c.RI "int \fBlibnet_write_link\fP (libnet_t *l, u_int8_t *packet, u_int32_t size)".br.ti -1c.RI "int \fBlibnet_open_raw4\fP (libnet_t *l)".br.ti -1c.RI "int \fBlibnet_close_raw4\fP (libnet_t *l)".br.ti -1c.RI "int \fBlibnet_open_raw6\fP (libnet_t *l)".br.ti -1c.RI "int \fBlibnet_close_raw6\fP (libnet_t *l)".br.ti -1c.RI "int \fBlibnet_select_device\fP (libnet_t *l)".br.ti -1c.RI "int \fBlibnet_open_link\fP (libnet_t *l)".br.ti -1c.RI "int \fBlibnet_close_link\fP (libnet_t *l)".br.ti -1c.RI "int \fBlibnet_do_checksum\fP (libnet_t *l, u_int8_t *packet, int protocol, int len)".br.ti -1c.RI "u_int32_t \fBlibnet_compute_crc\fP (u_int8_t *buf, u_int32_t len)".br.ti -1c.RI "u_int16_t \fBlibnet_ip_check\fP (u_int16_t *addr, int len)".br.ti -1c.RI "int \fBlibnet_in_cksum\fP (u_int16_t *addr, int len)".br.ti -1c.RI "libnet_pblock_t * \fBlibnet_pblock_probe\fP (libnet_t *l, libnet_ptag_t ptag, u_int32_t n, u_int8_t type)".br.ti -1c.RI "libnet_pblock_t * \fBlibnet_pblock_new\fP (libnet_t *l, u_int32_t size)".br.ti -1c.RI "int \fBlibnet_pblock_swap\fP (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)".br.ti -1c.RI "int \fBlibnet_pblock_insert_before\fP (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)".br.ti -1c.RI "void \fBlibnet_pblock_delete\fP (libnet_t *l, libnet_pblock_t *p)".br.ti -1c.RI "libnet_ptag_t \fBlibnet_pblock_update\fP (libnet_t *l, libnet_pblock_t *p, u_int32_t h, u_int8_t type)".br.ti -1c.RI "libnet_pblock_t * \fBlibnet_pblock_find\fP (libnet_t *l, libnet_ptag_t ptag)".br.ti -1c.RI "int \fBlibnet_pblock_append\fP (libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, u_int32_t len)".br.ti -1c.RI "void \fBlibnet_pblock_setflags\fP (libnet_pblock_t *p, u_int8_t flags)".br.ti -1c.RI "int \fBlibnet_pblock_p2p\fP (u_int8_t type)".br.ti -1c.RI "int \fBlibnet_pblock_coalesce\fP (libnet_t *l, u_int8_t **packet, u_int32_t *size)".br.ti -1c.RI "int \fBlibnet_check_iface\fP (libnet_t *l)".br.in -1c.SS "Variables".in +1c.ti -1c.RI "const struct libnet_in6_addr \fBin6addr_error\fP".br.in -1c.SH "Detailed Description".PP libnet exported function prototypes .SH "Function Documentation".PP .SS "char* libnet_addr2name4 (u_int32_t in, u_int8_t use_name)".PPTakes a network byte ordered IPv4 address and returns a pointer to either a canonical DNS name (if it has one) or a string of dotted decimals. This may incur a DNS lookup if the hostname and mode is set to LIBNET_RESOLVE. If mode is set to LIBNET_DONT_RESOLVE, no DNS lookup will be performed and the function will return a pointer to a dotted decimal string. The function cannot fail -- if no canonical name exists, it will fall back on returning a dotted decimal string. This function is non-reentrant. .PP\fBParameters:\fP.RS 4\fIin\fP network byte ordered IPv4 address .br\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE .RE.PP\fBReturns:\fP.RS 4a pointer to presentation format string .RE.PP.SS "void libnet_addr2name6_r (struct libnet_in6_addr addr, u_int8_t use_name, char * host_name, int host_name_len)".PPShould document this baby right here. .SS "int libnet_adv_cull_header (libnet_t * l, libnet_ptag_t ptag, u_int8_t ** header, u_int32_t * header_s)".PP[Advanced Interface] Pulls the header from the specified ptag from the given libnet context. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why. .PP\fBParameters:\fP.RS 4\fIl\fP pointer to a libnet context .br\fIptag\fP the ptag referencing the header to pull .br\fIheader\fP will contain the header .br\fIheader_s\fP will contain the header size .RE.PP\fBReturns:\fP.RS 41 on success, -1 on failure .RE.PP.SS "int libnet_adv_cull_packet (libnet_t * l, u_int8_t ** packet, u_int32_t * packet_s)".PP[Advanced Interface] Yanks a prebuilt, wire-ready packet from the given libnet context. If libnet was configured to do so (which it is by default) the packet will have all checksums written in. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. It is important to note that the function performs an implicit malloc() and a corresponding call to \fBlibnet_adv_free_packet()\fP should be made to free the memory packet occupies. If the function fails \fBlibnet_geterror()\fP can tell you why. .PP\fBParameters:\fP.RS 4\fIl\fP pointer to a libnet context .br\fIpacket\fP will contain the wire-ready packet .br\fIpacket_s\fP will contain the packet size .RE.PP\fBReturns:\fP.RS 41 on success, -1 on failure .RE.PP.SS "void libnet_adv_free_packet (libnet_t * l, u_int8_t * packet)".PP[Advanced Interface] Frees the memory allocated when \fBlibnet_adv_cull_packet()\fP is called. .PP\fBParameters:\fP.RS 4\fIl\fP pointer to a libnet context .br\fIpacket\fP a pointer to the packet to free .RE.PP.SS "int libnet_adv_write_link (libnet_t * l, u_int8_t * packet, u_int32_t packet_s)".PP[Advanced Interface] Writes a packet the network at the link layer. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why. .PP\fBParameters:\fP.RS 4\fIl\fP pointer to a libnet context .br\fIpacket\fP a pointer to the packet to inject .br\fIpacket_s\fP the size of the packet .RE.PP\fBReturns:\fP.RS 4the number of bytes written, or -1 on failure .RE.PP.SS "libnet_ptag_t libnet_autobuild_arp (u_int16_t op, u_int8_t * sha, u_int8_t * spa, u_int8_t * tha, u_int8_t * tpa, libnet_t * l)".PPAutouilds an Address Resolution Protocol (ARP) header. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets. .PP\fBParameters:\fP.RS 4\fIop\fP ARP operation type .br\fIsha\fP sender's hardware address .br\fIspa\fP sender's protocol address .br\fItha\fP target hardware address .br\fItpa\fP targer protocol address .br\fIl\fP pointer to a libnet context .RE.PP\fBReturns:\fP.RS 4protocol tag value on success, -1 on error .RE.PP.SS "libnet_ptag_t libnet_autobuild_ethernet (u_int8_t * dst, u_int16_t type, libnet_t * l)".PPAutobuilds an Ethernet header. The RFC 894 Ethernet II header is almost identical to the IEEE 802.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length). You should only use this function when libnet is initialized with the LIBNET_LINK interface. .PP\fBParameters:\fP.RS 4\fIdst\fP destination ethernet address .br\fItype\fP upper layer protocol type .br\fIl\fP pointer to a libnet context .RE.PP\fBReturns:\fP.RS 4protocol tag value on success, -1 on error .RE.PP.SS "libnet_ptag_t libnet_autobuild_fddi (u_int8_t fc, u_int8_t * dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * org, u_int16_t type, libnet_t * l)".PPAutobuilds a Fiber Distributed Data Interface (FDDI) header. .PP\fBParameters:\fP.RS 4\fIfc\fP class format and priority dst destination fddi address .br\fIdsap\fP destination service access point .br\fIssap\fP source service access point .br\fIcf\fP cf .br\fIorg\fP IEEE organizational code .br\fItype\fP upper layer protocol .br\fIl\fP pointer to a libnet context .RE.PP\fBReturns:\fP.RS 4protocol tag value on success, -1 on error .RE.PP.SS "libnet_ptag_t libnet_autobuild_ipv4 (u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t * l)".PPAutobuilds a version 4 Internet Protocol (IP) header. The function is useful * to build an IP header quickly when you do not need a granular level of control. The function takes the same len, prot, and dst arguments as \fBlibnet_build_ipv4()\fP. The function does not accept a ptag argument, but it does return a ptag. In other words, you can use it to build a new IP header but not to modify an existing one. .PP\fBParameters:\fP.RS 4\fIlen\fP total length of the IP packet including all subsequent data .br\fIprot\fP upper layer protocol .br\fIdst\fP destination IPv4 address (little endian) .br\fIl\fP pointer to a libnet context .RE.PP\fBReturns:\fP.RS 4protocol tag value on success, -1 on error .RE.PP.SS "libnet_ptag_t libnet_autobuild_ipv6 (u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, libnet_t * l)".PPThis function is not yet implement and is a NONOP. .PP\fBParameters:\fP.RS 4\fIlen\fP length .br\fInh\fP next header .br\fIdst\fP destination IPv6 address .br\fIpayload\fP optional payload or NULL .br\fIpayload_s\fP payload length or 0 .br\fIl\fP pointer to a libnet context .br\fIptag\fP protocol tag to modify an existing header, 0 to build a new one .RE.PP\fBReturns:\fP.RS 4protocol tag value on success, -1 on error .RE.PP.SS "libnet_ptag_t libnet_autobuild_link (u_int8_t * dst, u_int8_t * oui, u_int16_t type, libnet_t * l)".PPAutomatically builds a link layer header for an initialized l. The function determines the proper link layer header format from how l was initialized. The function current supports Ethernet and Token Ring link layers. .PP\fBParameters:\fP.RS 4\fIdst\fP the destination MAC address .br\fIoui\fP Organizationally Unique Identifier (unused for Ethernet) .br\fItype\fP the upper layer protocol type .br\fIl\fP pointer to a libnet context .RE.PP\fBReturns:\fP.RS 4protocol tag value on success, -1 on error .RE.PP.SS "libnet_ptag_t libnet_autobuild_token_ring (u_int8_t ac, u_int8_t fc, u_int8_t * dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * org, u_int16_t type, libnet_t * l)".PPAuto-builds a token ring header. .PP\fBParameters:\fP.RS 4\fIac\fP access control .br\fIfc\fP frame control .br\fIdst\fP destination address .br\fIdsap\fP destination service access point .br\fIssap\fP source service access point .br\fIcf\fP control field .br\fIoui\fP Organizationally Unique Identifier .br\fItype\fP upper layer protocol type .br\fIl\fP pointer to a libnet context .RE.PP\fBReturns:\fP.RS 4protocol tag value on success, -1 on error .RE.PP.SS "libnet_ptag_t libnet_build_802_1q (u_int8_t * dst, u_int8_t * src, u_int16_t tpi, u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)".PPBuilds an IEEE 802.1q VLAN tagging header. Depending on the value of len_proto, the function wraps the 802.1q header inside either an IEEE 802.3 header or an RFC 894 Ethernet II (DIX) header (both resulting in an 18-byte frame). If len is 1500 or less, most receiving protocol stacks parse the frame as an IEEE 802.3 encapsulated frame. If len is one of the Ethernet type values, most protocol stacks parse the frame as an RFC 894 Ethernet II encapsulated frame. Note the length value is calculated without the 802.1q header of 18 bytes. .PP\fBParameters:\fP.RS 4\fIdst\fP pointer to a six byte source ethernet address .br\fIsrc\fP pointer to a six byte destination ethernet address .br\fItpi\fP tag protocol identifier .br
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -