📄 libnet-functions.h
字号:
*/libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_ospfv2_lsa_rtr( u_int16_t, /* flags */ u_int16_t, /* number */ u_int, /* id */ u_int, /* data */ u_int8_t, /* type */ u_int8_t, /* type of service */ u_int16_t, /* metric */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ ); /* * libnet_build_ospfv2_lsa_net * * Function builds an OSPF lsa net header. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_ospfv2_lsa_net( u_int32_t, /* netmask */ u_int, /* router id */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ ); /* * libnet_build_ospfv2_lsa_sum * * Function builds an OSPF lsa sum header. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_ospfv2_lsa_sum( u_int32_t, /* netmask */ u_int, /* metric */ u_int, /* type of service */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ ); /* * libnet_build_ospfv2_lsa_as * * Function builds an OSPF lsa as header. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_ospfv2_lsa_as( u_int32_t, /* netmask */ u_int, /* metric */ u_int32_t, /* forward address */ u_int, /* tag */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_build_data * * Function builds a generic data unit. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_data( u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_build_dhcpv4 * * Function builds a DHCPv4 header. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_dhcpv4( u_int8_t, /* opcode */ u_int8_t, /* hardware address type */ u_int8_t, /* hardware address length */ u_int8_t, /* hopcount */ u_int32_t, /* transaction ID */ u_int16_t, /* number of seconds since trying to bootstrap */ u_int16_t, /* unused */ u_int32_t, /* client's IP */ u_int32_t, /* your IP */ u_int32_t, /* server's IP */ u_int32_t, /* gateway IP */ u_int8_t *, /* client hardware address */ u_int8_t *, /* server host name */ u_int8_t *, /* boot file name */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_build_bootpv4 * * Function builds a BOOTPv4 header. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_bootpv4( u_int8_t, /* opcode */ u_int8_t, /* hardware address type */ u_int8_t, /* hardware address length */ u_int8_t, /* hopcount */ u_int32_t, /* transaction ID */ u_int16_t, /* number of seconds since trying to bootstrap */ u_int16_t, /* flags */ u_int32_t, /* client's IP */ u_int32_t, /* your IP */ u_int32_t, /* server's IP */ u_int32_t, /* gateway IP */ u_int8_t *, /* client hardware address */ u_int8_t *, /* server host name */ u_int8_t *, /* boot file name */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_gre_length * As length of a GRE 1701 packet depends on flags and version field, this function * computes it. */inline u_int32_t /* length of the packet according to its flags */libnet_gre_length( u_int16_t /* flags and version */ );#define libnet_egre_length libnet_gre_length/* * libnet_build_gre * * Function builds a GRE header. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_gre( u_int16_t, /* flags and version */ u_int16_t, /* type */ u_int16_t, /* checksum */ u_int16_t, /* offset */ u_int32_t, /* key */ u_int32_t, /* sequence number*/ u_int16_t, /* length for checksum computation */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );#define libnet_build_egre libnet_build_gre/* * libnet_build_gre_sre * * Function builds a GRE Source Route Entries header. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_gre_sre( u_int16_t, /* address family */ u_int8_t, /* offset */ u_int8_t, /* length */ u_int8_t *, /* routing */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_build_gre_last_sre * * Function builds the last GRE Source Route Entries header. */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_gre_last_sre( libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_build_bgp4_header * * Function builds a BGP4 header. * */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_bgp4_header( u_int8_t *, /* marker */ u_int16_t, /* length */ u_int8_t, /* type */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_build_bgp4_open * * Function builds a BGP4 open message. * * If options are needed (for instance, for authentication), one must use * the payload as no specific pblock is yet provided. * */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_bgp4_open( u_int8_t, /* version */ u_int16_t, /* my Autonomous System */ u_int16_t, /* hold time */ u_int32_t, /* BGP Identifier */ u_int8_t, /* option length */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_build_bgp4_update * * Function builds a BGP4 update message. * * the info_len parameter is not present in the packet, but is requested * so that we can compute the needed memory size. * */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_bgp4_update( u_int16_t, /* Unfeasible Routes Length */ u_int8_t *, /* Withdrawn Routes */ u_int16_t, /* Total Path Attribute Length */ u_int8_t *, /* Path Attributes */ u_int16_t, /* Network Layer Reachability Information length */ u_int8_t *, /* Network Layer Reachability Information */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );/* * libnet_build_bgp4_notification * * Function builds a BGP4 notification message. * * Use the payload if you need more data to pass * */libnet_ptag_t /* packet id on success, -1 on failure */libnet_build_bgp4_notification( u_int8_t, /* error code */ u_int8_t, /* error subcode */ u_int8_t *, /* pointer to packet data (or NULL) */ u_int32_t, /* payload length */ libnet_t *, /* libnet context pointer */ libnet_ptag_t /* packet id */ );libnet_ptag_tlibnet_build_link(u_int8_t *, /* destination */u_int8_t *, /* source */u_int16_t, /* type */u_int8_t *, /* pointer to packet data (or NULL) */u_int32_t, /* payload length */libnet_t *, /* libnet context pointer */libnet_ptag_t /* packet id */ );libnet_ptag_tlibnet_autobuild_link(u_int8_t *,u_int16_t,libnet_t * );/* * libnet_write * * Function writes a packet to the wire. Libnet will know which injection * method to use, as well as if the user wants checksums to be calculated. * Planned functionality for multiple packets will allow for tunable sleep * times between packet writes. */int /* number of bytes written if successful, -1 on error */libnet_write( libnet_t * /* libnet context pointer */ );/* * libnet_write_ipv4 * * Function writes an ipv4 packet through the raw socket interface. Used * internally by libnet. */int /* number of bytes written if successful, -1 on error */libnet_write_raw_ipv4( libnet_t *, /* libnet context pointer */ u_int8_t *, /* pointer to the assembled packet */ u_int32_t /* size of the assembled packet */ );/* * libnet_write_ipv6 * * Function writes an ipv6 packet through the raw socket interface. Used * internally by libnet. */int /* number of bytes written if successful, -1 on error */libnet_write_raw_ipv6( libnet_t *, /* libnet context pointer */ u_int8_t *, /* pointer to the assembled packet */ u_int32_t /* size of the assembled packet */ );/* * libnet_write_link * * Function writes a packet through the link-layer interface. Used * internally by libnet. */int /* number of bytes written if successful, -1 on error */libnet_write_link( libnet_t *, /* libnet context pointer */ u_int8_t *, /* pointer to the assembled packet */ u_int32_t /* size of the assembled packet */ );/* * libnet_open_raw4 * * Function opens a IPv4 raw socket and sets IP_HDRINCL socket option. * Under linux it also sets SO_BROADCAST in order to write broadcast packets. */#if ((_WIN32) && !(__CYGWIN__))SOCKETlibnet_open_raw4( libnet_t * );#elseint /* opened file desciptor, or -1 on error */libnet_open_raw4( libnet_t * /* libnet context pointer */ );#endif/* * libnet_close_raw4 * * Function closes the IPv4 raw socket. */int /* 1 upon success, or -1 on error */libnet_close_raw4( libnet_t * /* libnet context pointer */ );/* * libnet_open_raw6 * * Function opens a IPv6 raw socket and sets IP_HDRINCL socket option. * Under linux it also sets SO_BROADCAST in order to write broadcast packets. */int /* opened file desciptor, or -1 on error */libnet_open_raw6( libnet_t * /* libnet context pointer */ ); /* * libnet_close_raw6 * * Function closes the IPv6 raw socket. */int /* 1 upon success, or -1 on error */libnet_close_raw6( libnet_t * /* libnet context pointer */ );/* * libnet_select_device * * Function finds a device for use with libnet's link-layer interface. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -