logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

libnet-functions.h -

Author

       Generated automatically by Doxygen for libnet from the source code.

Version 1.1                                      Thu Mar 29 2012                           libnet-functions.h(3)

Detailed Description

       libnet exported function prototypes

Function Documentation

char*libnet_addr2name4(uint32_tin,uint8_tuse_name)TakesanetworkbyteorderedIPv4addressandreturnsapointertoeitheracanonicalDNSname(ifithasone)orastringofdotteddecimals.ThismayincuraDNSlookupifthehostnameandmodeissettoLIBNET_RESOLVE.IfmodeissettoLIBNET_DONT_RESOLVE,noDNSlookupwillbeperformedandthefunctionwillreturnapointertoadotteddecimalstring.Thefunctioncannotfail--ifnocanonicalnameexists,itwillfallbackonreturningadotteddecimalstring.Thisfunctionisnon-reentrant.Parameters:in network byte ordered IPv4 address
           use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE

       Returns:
           a pointer to presentation format string

   voidlibnet_addr2name6_r(structlibnet_in6_addraddr,uint8_tuse_name,char*host_name,inthost_name_len)Shoulddocumentthisbabyrighthere.intlibnet_adv_cull_header(libnet_t*l,libnet_ptag_tptag,uint8_t**header,uint32_t*header_s)[AdvancedInterface]Pullstheheaderfromthespecifiedptagfromthegivenlibnetcontext.Thisfunctionispartoftheadvancedinterfaceandisonlyavailablewhenlibnetisinitializedinadvancedmode.Ifthefunctionfailslibnet_geterror()cantellyouwhy.Parameters:l pointer to a libnet context
           ptag the ptag referencing the header to pull
           header will contain the header
           header_s will contain the header size

       Returns:
           1 on success, -1 on failure

   intlibnet_adv_cull_packet(libnet_t*l,uint8_t**packet,uint32_t*packet_s)[AdvancedInterface]Yanksaprebuilt,wire-readypacketfromthegivenlibnetcontext.Iflibnetwasconfiguredtodoso(whichitisbydefault)thepacketwillhaveallchecksumswrittenin.Thisfunctionispartoftheadvancedinterfaceandisonlyavailablewhenlibnetisinitializedinadvancedmode.Itisimportanttonotethatthefunctionperformsanimplicitmalloc()andacorrespondingcalltolibnet_adv_free_packet()shouldbemadetofreethememorypacketoccupies.Ifthefunctionfailslibnet_geterror()cantellyouwhy.Parameters:l pointer to a libnet context
           packet will contain the wire-ready packet
           packet_s will contain the packet size

       Returns:
           1 on success, -1 on failure

   voidlibnet_adv_free_packet(libnet_t*l,uint8_t*packet)[AdvancedInterface]Freesthememoryallocatedwhenlibnet_adv_cull_packet()iscalled.Parameters:l pointer to a libnet context
           packet a pointer to the packet to free

   intlibnet_adv_write_link(libnet_t*l,constuint8_t*packet,uint32_tpacket_s)[AdvancedInterface]Writesapacketthenetworkatthelinklayer.Thisfunctionisusefultowriteapacketthathasbeenconstructedbyhandbytheapplicationprogrammeror,morecommonly,towriteapacketthathasbeenreturnedbyacalltolibnet_adv_cull_packet().Thisfunctionispartoftheadvancedinterfaceandisonlyavailablewhenlibnetisinitializedinadvancedmode.Ifthefunctionfailslibnet_geterror()cantellyouwhy.Parameters:l pointer to a libnet context
           packet a pointer to the packet to inject
           packet_s the size of the packet

       Returns:
           the number of bytes written, or -1 on failure

   intlibnet_adv_write_raw_ipv4(libnet_t*l,constuint8_t*packet,uint32_tpacket_s)[AdvancedInterface]Writesapacketthenetworkattherawsocketlayer.Thisfunctionisusefultowriteapacketthathasbeenconstructedbyhandbytheapplicationprogrammeror,morecommonly,towriteapacketthathasbeenreturnedbyacalltolibnet_adv_cull_packet().Thisfunctionispartoftheadvancedinterfaceandisonlyavailablewhenlibnetisinitializedinadvancedmode.Ifthefunctionfailslibnet_geterror()cantellyouwhy.Parameters:l pointer to a libnet context
           packet a pointer to the packet to inject
           packet_s the size of the packet

       Returns:
           the number of bytes written, or -1 on failure

   libnet_ptag_tlibnet_autobuild_arp(uint16_top,constuint8_t*sha,constuint8_t*spa,constuint8_t*tha,uint8_t*tpa,libnet_t*l)AutouildsanAddressResolutionProtocol(ARP)header.Dependingontheopvalue,thefunctionbuildsoneofseveraldifferenttypesofRFC826orRFC903RARPpackets.Parameters:op ARP operation type
           sha sender's hardware address
           spa sender's protocol address
           tha target hardware address
           tpa targer protocol address
           l pointer to a libnet context

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_autobuild_ethernet(constuint8_t*dst,uint16_ttype,libnet_t*l)AutobuildsanEthernetheader.TheRFC894EthernetIIheaderisalmostidenticaltotheIEEE802.3header,withtheexceptionthatthefieldimmediatelyfollowingthesourceaddressholdsthelayer3protocol(asopposedtoframe'slength).YoushouldonlyusethisfunctionwhenlibnetisinitializedwiththeLIBNET_LINKinterface.Parameters:dst destination ethernet address
           type upper layer protocol type
           l pointer to a libnet context

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_autobuild_fddi(uint8_tfc,constuint8_t*dst,uint8_tdsap,uint8_tssap,uint8_tcf,constuint8_t*oui,uint16_ttype,libnet_t*l)AutobuildsaFiberDistributedDataInterface(FDDI)header.Parameters:fc class format and priority
           dst destination fddi address
           dsap destination service access point
           ssap source service access point
           cf cf
           oui IEEE organizational code
           type upper layer protocol
           l pointer to a libnet context

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_autobuild_ipv4(uint16_tlen,uint8_tprot,uint32_tdst,libnet_t*l)Autobuildsaversion4InternetProtocol(IP)header.ThefunctionisusefultobuildanIPheaderquicklywhenyoudonotneedagranularlevelofcontrol.Thefunctiontakesthesamelen,prot,anddstargumentsaslibnet_build_ipv4().Thefunctiondoesnotacceptaptagargument,butitdoesreturnaptag.Inotherwords,youcanuseittobuildanewIPheaderbutnottomodifyanexistingone.Parameters:len total length of the IP packet including all subsequent data
           prot upper layer protocol
           dst destination IPv4 address (little endian)
           l pointer to a libnet context

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_autobuild_ipv6(uint16_tlen,uint8_tnh,structlibnet_in6_addrdst,libnet_t*l,libnet_ptag_tptag)Autobuildsaversion6RFC2460InternetProtocol(IP)header.ThefunctionisusefultobuildanIPheaderquicklywhenyoudonotneedagranularlevelofcontrol.Thefunctiontakesthesamelen,nh,anddstargumentsaslibnet_build_ipv4().Thefunctiondoesnotacceptaptagargument,butitdoesreturnaptag.Inotherwords,youcanuseittobuildanewIPheaderbutnottomodifyanexistingone.Thisfunctionrequireslibnet_get_ipaddr6(),whichisnotyetimplementedforWin32platforms.Parameters:len length
           nh next header
           dst destination IPv6 address
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_autobuild_link(constuint8_t*dst,constuint8_t*oui,uint16_ttype,libnet_t*l)Automaticallybuildsalinklayerheaderforaninitializedl.Thefunctiondeterminestheproperlinklayerheaderformatfromhowlwasinitialized.ThefunctioncurrentsupportsEthernetandTokenRinglinklayers.Parameters:dst the destination MAC address
           oui Organizationally Unique Identifier (unused for Ethernet)
           type the upper layer protocol type
           l pointer to a libnet context

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_autobuild_token_ring(uint8_tac,uint8_tfc,constuint8_t*dst,uint8_tdsap,uint8_tssap,uint8_tcf,constuint8_t*oui,uint16_ttype,libnet_t*l)Auto-buildsatokenringheader.Parameters:ac access control
           fc frame control
           dst destination address
           dsap destination service access point
           ssap source service access point
           cf control field
           oui Organizationally Unique Identifier
           type upper layer protocol type
           l pointer to a libnet context

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_802_1q(constuint8_t*dst,constuint8_t*src,uint16_ttpi,uint8_tpriority,uint8_tcfi,uint16_tvlan_id,uint16_tlen_proto,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag).SHPacketBuilderFunctions
       The core of libnet is the platform-independent packet-building functionality. These functions enable an
       application programmer to build protocol headers (and data) in a simple and consistent manner without
       having to worry (too much) about low-level network odds and ends. Each libnet_build() function builds a
       piece of a packet (generally a protocol header). While it is perfectly possible to build an entire,
       ready-to-transmit packet with a single call to a libnet_build() function, generally more than one
       builder-class function call is required to construct a full packet. A complete wire-ready packet
       generally consists of more than one piece. Every function that builds a protocol header takes a series of
       arguments roughly corresponding to the header values as they appear on the wire. This process is
       intuitive but often makes for functions with huge prototypes and large stack frames. One important thing
       to note is that you must call these functions in order, corresponding to how they should appear on the
       wire (from the highest protocol layer on down). This building process is intuitive; it approximates what
       happens in an operating system kernel. In other words, to build a Network Time Protocol (NTP) packet by
       using the link-layer interface, the application programmer would call the libnet_build() functions in the
       following order: 1. libnet_build_ntp() 2. libnet_build_udp() 3. libnet_build_ipv4() 4.
       libnet_build_ethernet() This ordering is essential for libnet 1.1.x to properly link together the packet
       internally (previous libnet versions did not have the requirement).

   ThePayloadInterface
       The payload interface specifies an optional way to include data directly after the protocol header in
       question. You can use this function for a variety of purposes, including the following:

       • Including  additional  or  arbitrary  protocol  header  information that is not available from a libnet
         interface

       • Including a packet payload (data segment)

       • Building another protocol header that is not available from a libnet interface To employ the interface,
         the application programmer should construct the i payload data and pass a const uint8_t * to this  data
         and its size to the desired libnet_build() function. Libnet handles the rest.

       It  is  important to note that some functions (notably the IPv6 builders) do use the payload interface to
       specify variable length  but  ostensibly  non-optional  data.  See  the  individual  libnet_build_ipv6*()
       functions for more information.

   ProtocolTagsandPacketBuilderReturnValues
       Libnet  uses the protocol tag (ptag) to identify individual pieces of a packet after being created. A new
       ptag results every time a libnet_build() function with an empty (0) ptag argument completes successfully.
       This new ptag now refers to the packet piece just created. The application programmer's responsibility is
       to save this value if he or she plans to modify this particular portion later on in the program.  If  the
       application  programmer  needs  to  modify  some portion of that particular packet piece again, he or she
       calls the same libnet_build() function specifying the saved ptag argument. Libnet then searches for  that
       packet  piece and modifies it rather than creating a new one. Upon failure for any reason, libnet_build()
       functions return -1; libnet_geterror() tells  you  why.  Builds  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.

       Parameters:dst pointer to a six byte source ethernet address
           src pointer to a six byte destination ethernet address
           tpi tag protocol identifier
           priority priority
           cfi canonical format indicator
           vlan_id vlan identifier
           len_proto length (802.3) protocol (Ethernet II)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_802_1x(uint8_teap_ver,uint8_teap_type,uint16_tlength,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIEEE802.1xextendedauthenticationprotocolheader.Parameters:eap_ver the EAP version
           eap_type the EAP type
           length frame length
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_802_2(uint8_tdsap,uint8_tssap,uint8_tcontrol,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIEEE802.2LLCheader.Parameters:dsap destination service access point
           ssap source service access point
           control control field
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_802_2snap(uint8_tdsap,uint8_tssap,uint8_tcontrol,uint8_t*oui,uint16_ttype,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIEEE802.2LLCSNAPheader.Parameters:dsap destination service access point
           ssap source service access point
           control control field
           oui Organizationally Unique Identifier
           type upper layer protocol
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_802_3(constuint8_t*dst,constuint8_t*src,uint16_tlen,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIEEE802.3header.The802.3headerisalmostidenticaltotheRFC894EthernetIIheader,theexceptionbeingthatthefieldimmediatelyfollowingthesourceaddressholdstheframe'slength(asopposedtothelayer3protocol).YoushouldonlyusethisfunctionwhenlibnetisinitializedwiththeLIBNET_LINKinterface.Parameters:dst destination ethernet address
           src source ethernet address
           len frame length sans header
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_arp(uint16_thrd,uint16_tpro,uint8_thln,uint8_tpln,uint16_top,constuint8_t*sha,constuint8_t*spa,constuint8_t*tha,constuint8_t*tpa,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanAddressResolutionProtocol(ARP)header.Dependingontheopvalue,thefunctionbuildsoneofseveraldifferenttypesofRFC826orRFC903RARPpackets.Parameters:hrd hardware address format
           pro protocol address format
           hln hardware address length
           pln protocol address length
           op ARP operation type
           sha sender's hardware address
           spa sender's protocol address
           tha target hardware address
           tpa targer protocol address
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_bgp4_header(uint8_tmarker[LIBNET_BGP4_MARKER_SIZE],uint16_tlen,uint8_ttype,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC1771BorderGatewayProtocol4(BGP-4)header.TheprimaryfunctionofaBGPspeakingsystemistoexchangenetworkreachabilityinformationwithotherBGPsystems.ThisnetworkreachabilityinformationincludesinformationonthelistofAutonomousSystems(ASs)thatreachabilityinformationtraverses.ThisinformationissufficienttoconstructagraphofASconnectivityfromwhichroutingloopsmaybeprunedandsomepolicydecisionsattheASlevelmaybeenforced.ThisfunctionbuildsthebaseBGPheaderwhichisusedasapreamblebeforeanyotherBGPheader.Forexample,aBGPKEEPALIVEmessagemaybebuiltwithonlythisfunction,whileanerrornotificationrequiresasubsequentcalltolibnet_build_bgp4_notification.Parameters:marker a value the receiver can predict (if the message type is not BGP OPEN, or no authentication is
           used, these 16 bytes are normally set as all ones)
           len total length of the BGP message, including the header
           type type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_bgp4_notification(uint8_terr_code,uint8_terr_subcode,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC1771BorderGatewayProtocol4(BGP-4)notificationheader.ANOTIFICATIONmessageissentwhenanerrorconditionisdetected.Specificerrorinformationmaybepassedthroughthepayloadinterface.Parameters:err_code type of notification
           err_subcode more specific information about the reported error.
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_bgp4_open(uint8_tversion,uint16_tsrc_as,uint16_thold_time,uint32_tbgp_id,uint8_topt_len,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC1771BorderGatewayProtocol4(BGP-4)OPENheader.ThisisthefirstmessagesentbyeachsideofaBGPconnection.Theoptionalparametersoptionsshouldbeconstructedusingthepayloadinterface(seeRFC1771fortheoptionsstructures).Parameters:version protocol version (should be set to 4)
           src_as Autonomous System of the sender
           hold_time  used  to  compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE
           messages by the sender
           bgp_id BGP identifier of the sender
           opt_len total length of the optional parameters field in bytes
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_bgp4_update(uint16_tunfeasible_rt_len,constuint8_t*withdrawn_rt,uint16_ttotal_path_attr_len,constuint8_t*path_attributes,uint16_tinfo_len,uint8_t*reachability_info,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC1771BorderGatewayProtocol4(BGP-4)updateheader.UpdatemessagesareusedtotransferroutinginformationbetweenBGPpeers.Parameters:unfeasible_rt_len indicates the length of the (next) 'withdrawn routes' field in bytes
           withdrawn_rt list of IP addresses prefixes for the routes that are being withdrawn; each  IP  address
           prefix is built as a 2-tuple <length (1 byte), prefix (variable)>
           total_path_attr_len indicates the length of the (next) 'path attributes' field in bytes
           path_attributes each attribute is a 3-tuple <type (2 bytes), length, value>
           info_len  indicates  the length of the (next) 'network layer reachability information' field in bytes
           (needed for internal memory size calculation)
           reachability_info 2-tuples <length (1 byte), prefix (variable)>.
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_bootpv4(uint8_topcode,uint8_thtype,uint8_thlen,uint8_thopcount,uint32_txid,uint16_tsecs,uint16_tflags,uint32_tcip,uint32_tyip,uint32_tsip,uint32_tgip,constuint8_t*chaddr,constchar*sname,constchar*file,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:opcodehtypehlenhopcountxidsecsflagscipyipsipgipchaddr client hardware address, length is hlen
           sname server host name, a null terminated string
           file boot file name, a null terminated string
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_cdp(uint8_tversion,uint8_tttl,uint16_tsum,uint16_ttype,uint16_tvalue_s,constuint8_t*value,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsaCiscoDiscoveryProtocol(CDP)header.CiscoSystemsdesignedCDPtoaidinthenetworkmanagementofadjacentCiscodevices.TheCDPprotocolspecifiesdatabyusingatype/length/value(TLV)setup.ThefirstTLVcanspecifiedbyusingthefunctionstype,length,andvaluearguments.TospecifyadditionalTLVs,theprogrammercouldeitherusethepayloadinterfaceorlibnet_build_data()toconstructthem.Parameters:version CDP version
           ttl time to live (time information should be cached by recipient)
           sum checksum (0 for libnet to autofill)
           type type of data contained in value
           value_s length of value argument
           value the CDP information string
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_data(constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsagenericlibnetprotocolheader.Thisisusefulforincludinganoptionalpayloadtoapacketthatmightneedtochangerepeatedlyinsideofaloop.Thiswon'tworkforTCPorIPpayload,theyhavespecialtypes(thisisprobablyabug).Parameters:payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_dhcpv4(uint8_topcode,uint8_thtype,uint8_thlen,uint8_thopcount,uint32_txid,uint16_tsecs,uint16_tflags,uint32_tcip,uint32_tyip,uint32_tsip,uint32_tgip,constuint8_t*chaddr,constchar*sname,constchar*file,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:opcodehtypehlenhopcountxidsecsflagscipyipsipgipchaddr client hardware address, length is hlen
           sname server host name, a null terminated string
           file boot file name, a null terminated string
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_dnsv4(uint16_th_len,uint16_tid,uint16_tflags,uint16_tnum_q,uint16_tnum_anws_rr,uint16_tnum_auth_rr,uint16_tnum_addi_rr,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC1035version4DNSheader.AdditionalDNSpayloadinformationshouldbespecifiedusingthepayloadinterface.Parameters:h_lenid DNS packet id
           flags control flags
           num_q number of questions
           num_anws_rr number of answer resource records
           num_auth_rr number of authority resource records
           num_addi_rr number of additional resource records
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_egre(uint16_tfv,uint16_ttype,uint16_tsum,uint16_toffset,uint32_tkey,uint32_tseq,uint16_tlen,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)GenericRoutingEncapsulation(GRE-RFC1701)isusedtoencapsulateanyprotocol.Hence,theIPpartofthepacketisusuallyreferredas'delivery
        header'. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever).  As
       GRE  is  very modular, the first GRE header describes the structure of the header, using bits and flag to
       specify which fields will be present in the header.

       Parameters:fv the 16 0 to 7: which fields are included in the header (checksum, seq. number, key, ...),  bits  8
           to 12: flag, bits 13 to 15: version.
           type which protocol is encapsulated (PPP, IP, ...)
           sum checksum (0 for libnet to autofill).
           offset byte offset from the start of the routing field to the first byte of the SRE
           key inserted by the encapsulator to authenticate the source
           seq sequence number used by the receiver to sort the packets
           len size of the GRE packet
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ethernet(constuint8_t*dst,constuint8_t*src,uint16_ttype,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanEthernetheader.TheRFC894EthernetIIheaderisalmostidenticaltotheIEEE802.3header,withtheexceptionthatthefieldimmediatelyfollowingthesourceaddressholdsthelayer3protocol(asopposedtoframe'slength).YoushouldonlyusethisfunctionwhenlibnetisinitializedwiththeLIBNET_LINKinterface.Parameters:dst destination ethernet address
           src source ethernet address
           type upper layer protocol type
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_fddi(uint8_tfc,constuint8_t*dst,constuint8_t*src,uint8_tdsap,uint8_tssap,uint8_tcf,constuint8_t*oui,uint16_ttype,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsaFiberDistributedDataInterface(FDDI)header.Parameters:fc class format and priority
           dst destination fddi address
           src source fddi address
           dsap destination service access point
           ssap source service access point
           cf cf
           oui 3 byte IEEE organizational code
           type upper layer protocol
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_gre(uint16_tfv,uint16_ttype,uint16_tsum,uint16_toffset,uint32_tkey,uint32_tseq,uint16_tlen,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)GenericRoutingEncapsulation(GRE-RFC1701)isusedtoencapsulateanyprotocol.Hence,theIPpartofthepacketisusuallyreferredas'delivery
        header'. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever).  As
       GRE  is  very modular, the first GRE header describes the structure of the header, using bits and flag to
       specify which fields will be present in the header.

       Parameters:fv the 16 0 to 7: which fields are included in the header (checksum, seq. number, key, ...),  bits  8
           to 12: flag, bits 13 to 15: version.
           type which protocol is encapsulated (PPP, IP, ...)
           sum checksum (0 for libnet to autofill).
           offset byte offset from the start of the routing field to the first byte of the SRE
           key inserted by the encapsulator to authenticate the source
           seq sequence number used by the receiver to sort the packets
           len size of the GRE packet
           payloadpayload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_gre_last_sre(libnet_t*l,libnet_ptag_tptag)Parameters:l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_gre_sre(uint16_taf,uint8_toffset,uint8_tlength,uint8_t*routing,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:afoffsetlengthroutingpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_hsrp(uint8_tversion,uint8_topcode,uint8_tstate,uint8_thello_time,uint8_thold_time,uint8_tpriority,uint8_tgroup,uint8_treserved,uint8_tauthdata[HSRP_AUTHDATA_LENGTH],uint32_tvirtual_ip,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsaHSRPheader.HSRPisaCiscopropietaryprotocoldefinedinRFC2281Parameters:version version of the HSRP messages
           opcode type of message
           state current state of the router
           hello_time period in seconds between hello messages
           hold_time seconds that the current hello message is valid
           priority priority for the election proccess
           group standby group
           reserved reserved field
           authdata password
           virtual_ip virtual ip address
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv4_echo(uint8_ttype,uint8_tcode,uint16_tsum,uint16_tid,uint16_tseq,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion4RFC792InternetControlMessageProtocol(ICMP)echorequest/replyheaderParameters:type type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO)
           code code of ICMP packet (should be 0)
           sum checksum (0 for libnet to autofill)
           id identification number
           seq packet sequence number
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv4_mask(uint8_ttype,uint8_tcode,uint16_tsum,uint16_tid,uint16_tseq,uint32_tmask,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion4RFC792InternetControlMessageProtocol(ICMP)IPnetmaskrequest/replyheader.Parameters:type type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY)
           code code of ICMP packet (should be 0)
           sum checksum (0 for libnet to autofill)
           id identification number
           seq packet sequence number
           mask subnet mask
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv4_redirect(uint8_ttype,uint8_tcode,uint16_tsum,uint32_tgateway,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion4RFC792InternetMessageControlProtocol(ICMP)redirectheader.TheIPheaderthatcausedtheerrormessageshouldbebuiltbyapreviouscalltolibnet_build_ipv4().Parameters:type type of ICMP packet (should be ICMP_REDIRECT)
           code code of ICMP packet (should be one of the four redirect codes)
           sum checksum (0 for libnet to autofill)
           gatewaypayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv4_timeexceed(uint8_ttype,uint8_tcode,uint16_tsum,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion4RFC792InternetControlMessageProtocol(ICMP)timeexceededheader.TheIPheaderthatcausedtheerrormessageshouldbebuiltbyapreviouscalltolibnet_build_ipv4().Parameters:type type of ICMP packet (should be ICMP_TIMXCEED)
           code code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS)
           sum checksum (0 for libnet to autofill)
           payload optional payload or NULL
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv4_timestamp(uint8_ttype,uint8_tcode,uint16_tsum,uint16_tid,uint16_tseq,uint32_totime,uint32_trtime,uint32_tttime,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion4RFC792InternetControlMessageProtocol(ICMP)timestamprequest/replyheader.Parameters:type type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY)
           code code of ICMP packet (should be 0)
           sum checksum (0 for libnet to autofill)
           id identification number
           seq sequence number
           otime originate timestamp
           rtime receive timestamp
           ttime transmit timestamp
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv4_unreach(uint8_ttype,uint8_tcode,uint16_tsum,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion4RFC792InternetControlMessageProtocol(ICMP)unreachableheader.TheIPheaderthatcausedtheerrormessageshouldbebuiltbyapreviouscalltolibnet_build_ipv4().Parameters:type type of ICMP packet (should be ICMP_UNREACH)
           code code of ICMP packet (should be one of the 16 unreachable codes)
           sum checksum (0 for libnet to autofill)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv6_echo(uint8_ttype,uint8_tcode,uint16_tsum,uint16_tid,uint16_tseq,uint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion6RFC4443InternetControlMessageProtocol(ICMP)echoorechoreplyheader.Parameters:type type of ICMP packet (should be ICMP6_ECHO_REQUEST or ICMP6_ECHO_REPLY)
           code code of ICMP packet (should be zero)
           sum checksum (0 for libnet to autofill)
           id echo id number
           seq echo sequence number
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv6_ndp_nadv(uint8_ttype,uint8_tcode,uint16_tsum,uint32_tflags,structlibnet_in6_addrtarget,uint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion6RFC2461InternetControlMessageProtocol(ICMP)NDPneighbouradvertisementheader.Couldbeusedwithlibnet_build_icmpv6_ndp_opt()andND_OPT_TARGET_LINKADDR.Parameters:type type of ICMP packet (should be ND_NEIGHBOR_ADVERT)
           code code of ICMP packet (should be zero)
           sum checksum (0 for libnet to autofill)
           flags should be a bitwise or of any applicable ND_NA_FLAG_* flags
           target target ipv6 address
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv6_ndp_nsol(uint8_ttype,uint8_tcode,uint16_tsum,structlibnet_in6_addrtarget,uint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion6RFC2461InternetControlMessageProtocol(ICMP)NDPneighboursolicitationheader.Couldbeusedwithlibnet_build_icmpv6_ndp_opt()andICMPV6_NDP_OPT_SLLA.Parameters:type type of ICMP packet (should be ND_NEIGHBOR_SOLICIT)
           code code of ICMP packet (should be zero)
           sum checksum (0 for libnet to autofill)
           target target ipv6 address
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv6_ndp_opt(uint8_ttype,uint8_t*option,uint32_toption_s,libnet_t*l,libnet_ptag_tptag)BuildsICMPv6NDPoptions.Parameters:type one of ND_OPT_* types
           option option data
           option_s size of option data (will be padded out to an 8-byte boundary)
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_icmpv6_unreach(uint8_ttype,uint8_tcode,uint16_tsum,uint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIPversion6RFC4443InternetControlMessageProtocol(ICMP)unreachableheader.TheIPheaderthatcausedtheerrormessageshouldbebuiltbyapreviouscalltolibnet_build_ipv6().Parameters:type type of ICMP packet (should be ICMP6_DST_UNREACH)
           code code of ICMP packet (should be one of the 5 ICMP6_DST_UNREACH_* codes)
           sum checksum (0 for libnet to autofill)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_igmp(uint8_ttype,uint8_treserved,uint16_tsum,uint32_tip,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC1112InternetGroupMemebershipProtocol(IGMP)header.Parameters:type packet type
           reserved (should be 0 for IGMPv1)
           sum checksum (0 for libnet to autofill)
           ip IPv4 address (in standard/network byte order)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

       Note:
           'reserved' was previously called 'code', which it is not, in any IGMP version.

   libnet_ptag_tlibnet_build_ipsec_ah(uint8_tnh,uint8_tlen,uint16_tres,uint32_tspi,uint32_tseq,uint32_tauth,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanInternetProtocolSecurityAuthenticationheader.Parameters:nh next header
           len payload length
           res reserved
           spi security parameter index
           seq sequence number
           auth authentication data
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipsec_esp_ftr(uint8_tlen,uint8_tnh,int8_t*auth,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanInternetProtocolSecurityEncapsulatingSecurityPayloadfooter.Parameters:len padding length
           nh next header
           auth authentication data
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipsec_esp_hdr(uint32_tspi,uint32_tseq,uint32_tiv,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanInternetProtocolSecurityEncapsulatingSecurityPayloadheader.Parameters:spi security parameter index
           seq ESP sequence number
           iv initialization vector
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipv4(uint16_tip_len,uint8_ttos,uint16_tid,uint16_tfrag,uint8_tttl,uint8_tprot,uint16_tsum,uint32_tsrc,uint32_tdst,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsaversion4RFC791InternetProtocol(IP)header.Parameters:ip_len total length of the IP packet including all subsequent data (subsequent data includes  any  IP
           options and IP options padding)
           tos type of service bits
           id IP identification number
           frag fragmentation bits and offset
           ttl time to live in the network
           prot upper layer protocol
           sum checksum (0 for libnet to autofill)
           src source IPv4 address (little endian)
           dst destination IPv4 address (little endian)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipv4_options(constuint8_t*options,uint32_toptions_s,libnet_t*l,libnet_ptag_tptag)Buildsanversion4InternetProtocol(IP)optionsheader.ThefunctionexpectsoptionstobeavalidIPoptionsstringofsizeoptions_s,nolargerthan40bytes(themaximumsizeofanoptionsstring).
       When building a chain, the options must be built, then the IPv4 header.

       When updating a chain, if the block following the options is an IPv4 header, it's total length and header
       length will be updated if the options block size changes.

       Parameters:options byte string of IP options (it will be padded up to be an integral multiple of 32-bit words).
           options_s length of options string
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipv6(uint8_ttc,uint32_tfl,uint16_tlen,uint8_tnh,uint8_thl,structlibnet_in6_addrsrc,structlibnet_in6_addrdst,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsaversion6RFC2460InternetProtocol(IP)header.Parameters:tc traffic class
           fl flow label
           len total length of the IP packet
           nh next header
           hl hop limit
           src source IPv6 address
           dst destination IPv6 address
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipv6_destopts(uint8_tnh,uint8_tlen,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsaversion6RFC2460InternetProtocol(IP)destinationoptionsheader.Thisfunctionisspecialinthatitusesthepayloadinterfacetoincludetheoptionsdata.TheapplicationprogrammerwillbuildanIPv6optionsbytestringandpassittothefunctionusingthepayloadinterface.Parameters:nh next header
           len length of the header in 8-byte octets not including the first 8 octets
           payload options payload
           payload_s payload length
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipv6_frag(uint8_tnh,uint8_treserved,uint16_tfrag,uint32_tid,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsaversion6RFC2460InternetProtocol(IP)fragmentationheader.Parameters:nh next header
           reserved unused value... OR IS IT!
           frag fragmentation bits (ala ipv4)
           id packet identification
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipv6_hbhopts(uint8_tnh,uint8_tlen,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsaversion6RFC2460InternetProtocol(IP)hopbyhopoptionsheader.Thisfunctionisspecialinthatitusesthepayloadinterfacetoincludetheoptionsdata.TheapplicationprogrammerwillbuildanIPv6hopbyhopoptionsbytestringandpassittothefunctionusingthepayloadinterface.Parameters:nh next header
           len length of the header in 8-byte octets not including the first 8 octets
           payload options payload
           payload_s payload length
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ipv6_routing(uint8_tnh,uint8_tlen,uint8_trtype,uint8_tsegments,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsaversion6RFC2460InternetProtocol(IP)routingheader.Thisfunctionisspecialinthatitusesthepayloadinterfacetoincludethe'type-specificdata';thatistheroutinginformation.Mostoftenthiswillbeanumberof128-bitIPv6addresses.TheapplicationprogrammerwillbuildabytestringofIPv6addressandpassthemtothefunctionusingthepayloadinterface.Parameters:nh next header
           len length of the header in 8-byte octets not including the first 8 octets
           rtype routing header type
           segments number of routing segments that follow
           payload optional payload of routing information
           payload_s payload length
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_isl(uint8_t*dhost,uint8_ttype,uint8_tuser,uint8_t*shost,uint16_tlen,constuint8_t*snap,uint16_tvid,uint16_tportindex,uint16_treserved,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsaCiscoInter-SwitchLink(ISL)header.Parameters:dhost destination address (should be 01:00:0c:00:00)
           type type of frame
           user user defined data
           shost source mac address
           len total length of the encapuslated packet less 18 bytes
           snap SNAP information (0xaaaa03 + vendor code)
           vid 15 bit VLAN ID, 1 bit BPDU or CDP indicator
           portindex port index
           reserved used for FDDI and token ring
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_link(constuint8_t*dst,constuint8_t*src,constuint8_t*oui,uint16_ttype,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsalinklayerheaderforaninitializedl.Thefunctiondeterminestheproperlinklayerheaderformatfromhowlwasinitialized.ThefunctioncurrentsupportsEthernetandTokenRinglinklayers.Parameters:dst the destination MAC address
           src the source MAC address
           oui Organizationally Unique Identifier (unused for Ethernet)
           type the upper layer protocol type
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_mpls(uint32_tlabel,uint8_texperimental,uint8_tbos,uint8_tttl,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC3032Multi-ProtocolLabelSwitching(MPLS)header.Parameters:label 20-bit label value
           experimental 3-bit reserved field
           bos 1-bit bottom of stack identifier
           ttl time to live
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ntp(uint8_tleap_indicator,uint8_tversion,uint8_tmode,uint8_tstratum,uint8_tpoll,uint8_tprecision,uint16_tdelay_int,uint16_tdelay_frac,uint16_tdispersion_int,uint16_tdispersion_frac,uint32_treference_id,uint32_tref_ts_int,uint32_tref_ts_frac,uint32_torig_ts_int,uint32_torig_ts_frac,uint32_trec_ts_int,uint32_trec_ts_frac,uint32_txmt_ts_int,uint32_txmt_ts_frac,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC958NetworkTimeProtocol(NTP)header.Parameters:leap_indicator the leap indicator
           version NTP protocol version
           mode NTP mode
           stratum stratum
           poll polling interval
           precision precision
           delay_int delay interval
           delay_frac delay fraction
           dispersion_int dispersion interval
           dispersion_frac dispersion fraction
           reference_id reference id
           ref_ts_int reference timestamp integer
           ref_ts_frac reference timestamp fraction
           orig_ts_int original timestamp integer
           orig_ts_frac original timestamp fraction
           rec_ts_int receiver timestamp integer
           rec_ts_frac receiver timestamp fraction
           xmt_ts_int transmit timestamp integer
           xmt_ts_frac transmit timestamp integer
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2(uint16_tlen,uint8_ttype,uint32_trtr_id,uint32_tarea_id,uint16_tsum,uint16_tautype,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:lentypertr_idarea_idsumautypepayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_dbd(uint16_tdgram_len,uint8_topts,uint8_ttype,uintseqnum,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:dgram_lenoptstypeseqnumpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_hello(uint32_tnetmask,uint16_tinterval,uint8_topts,uint8_tpriority,uintdead_int,uint32_tdes_rtr,uint32_tbkup_rtr,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:netmaskintervaloptsprioritydead_intdes_rtrbkup_rtrpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_lsa(uint16_tage,uint8_topts,uint8_ttype,uintlsid,uint32_tadvrtr,uintseqnum,uint16_tsum,uint16_tlen,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:ageoptstypelsidadvrtrseqnumsumlenpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_lsa_as(uint32_tnmask,uintmetric,uint32_tfwdaddr,uinttag,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:nmaskmetricfwdaddrtagpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_lsa_net(uint32_tnmask,uintrtrid,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:nmaskrtridpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_lsa_rtr(uint16_tflags,uint16_tnum,uintid,uintdata,uint8_ttype,uint8_ttos,uint16_tmetric,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:flagsnumiddatatypetosmetricpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_lsa_sum(uint32_tnmask,uintmetric,uinttos,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:nmaskmetrictospayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_lsr(uinttype,uintlsid,uint32_tadvrtr,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:typelsidadvrtrpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_ospfv2_lsu(uintnum,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Parameters:numpayload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_rip(uint8_tcmd,uint8_tversion,uint16_trd,uint16_taf,uint16_trt,uint32_taddr,uint32_tmask,uint32_tnext_hop,uint32_tmetric,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsaRoutingInformationProtocolheader(RFCs1058and2453).Parameters:cmd command
           version protocol version
           rd version one: 0, version two: routing domain
           af address family
           rt version one: 0, version two: route tag
           addr IPv4 address
           mask version one: 0, version two: subnet mask
           next_hop version one: 0, version two: next hop address
           metric routing metric
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_rpc_call(uint32_trm,uint32_txid,uint32_tprog_num,uint32_tprog_vers,uint32_tprocedure,uint32_tcflavor,uint32_tclength,uint8_t*cdata,uint32_tvflavor,uint32_tvlength,constuint8_t*vdata,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRemoteProcedureCall(Version2)CallmessageheaderasspecifiedinRFC1831.Thisbuilderprovidestheoptionforspecifyingtherecordmarkingwhichisrequiredwhenusedwithstreamingprotocols(TCP).Parameters:rm record marking indicating the position in a stream, 0 otherwise
           xid transaction identifier used to link calls and replies
           prog_num remote program specification typically between 0 - 1fffffff
           prog_vers remote program version specification
           procedure procedure to be performed by remote program
           cflavor authentication credential type
           clength credential length (should be 0)
           cdata opaque credential data (currently unused)
           vflavor authentication verifier type
           vlength verifier length (should be 0)
           vdata opaque verifier data (currently unused)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_sebek(uint32_tmagic,uint16_tversion,uint16_ttype,uint32_tcounter,uint32_ttime_sec,uint32_ttime_usec,uint32_tpid,uint32_tuid,uint32_tfd,uint8_tcmd[SEBEK_CMD_LENGTH],uint32_tlength,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsaSebekheader.TheSebekprotocolwasdesignedbytheHoneynetProjectasatransportmechanismforpost-intrusionforensicdata.Moreinformationmaybefoundhere:http://www.honeynet.org/papers/sebek.pdf.Parameters:magic identify packets that should be hidden
           version protocol version, currently 1
           type type of record (read data is type 0, write data is type 1)
           counter PDU counter used to identify when packet are lost
           time_sec seconds since EPOCH according to the honeypot
           time_usec residual microseconds
           pid PID
           uid UID
           fd FD
           cmd 12 first characters of the command
           length length in bytes of the PDU's body
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_stp_conf(uint16_tid,uint8_tversion,uint8_tbpdu_type,uint8_tflags,constuint8_t*root_id,uint32_troot_pc,constuint8_t*bridge_id,uint16_tport_id,uint16_tmessage_age,uint16_tmax_age,uint16_thello_time,uint16_tf_delay,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIEEE802.1dSpanningTreeProtocol(STP)configurationheader.STPframesareusuallyencapsulatedinsideofan802.2+802.3framecombination.Parameters:id protocol id
           version protocol version
           bpdu_type bridge protocol data unit type
           flags flags
           root_id root id
           root_pc root path cost
           bridge_id bridge id
           port_id port id
           message_age message age
           max_age max age
           hello_time hello time
           f_delay forward delay
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_stp_tcn(uint16_tid,uint8_tversion,uint8_tbpdu_type,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanIEEE802.1dSpanningTreeProtocol(STP)topologychangenotificationheader.STPframesareusuallyencapsulatedinsideofan802.2+802.3framecombination.Parameters:id protocol id
           version protocol version
           bpdu_type bridge protocol data unit type
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_tcp(uint16_tsp,uint16_tdp,uint32_tseq,uint32_tack,uint8_tcontrol,uint16_twin,uint16_tsum,uint16_turg,uint16_tlen,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC793TransmissionControlProtocol(TCP)header.Parameters:sp source port
           dp destination port
           seq sequence number
           ack acknowledgement number
           control control flags
           win window size
           sum checksum (0 for libnet to autofill)
           urg urgent pointer
           len total length of the TCP packet (for checksum calculation)
           payloadpayload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_tcp_options(constuint8_t*options,uint32_toptions_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC793TransmissionControlProtocol(TCP)optionsheader.ThefunctionexpectsoptionstobeavalidTCPoptionsstringofsizeoptions_s,whichisnolargerthan40bytes(themaximumsizeofanoptionsstring).ThefunctioncheckstoensurethatthepacketconsistsofaTCPheaderprecededbyanIPv4header,andthattheadditionoftheoptionsstringwouldnotresultinapacketlargerthan65,535bytes(IPMAXPACKET).Thefunctioncountsupthenumberof32-bitwordsintheoptionsstringandadjuststheTCPheaderlengthvalueasnecessary.Parameters:options byte string of TCP options
           options_s length of options string
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_token_ring(uint8_tac,uint8_tfc,constuint8_t*dst,constuint8_t*src,uint8_tdsap,uint8_tssap,uint8_tcf,constuint8_t*oui,uint16_ttype,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)Buildsatokenringheader.Parameters:ac access control
           fc frame control
           dst destination address
           src source address
           dsap destination service access point
           ssap source service access point
           cf control field
           oui Organizationally Unique Identifier
           type upper layer protocol type
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_udp(uint16_tsp,uint16_tdp,uint16_tlen,uint16_tsum,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC768UserDatagramProtocol(UDP)header.Parameters:sp source port
           dp destination port
           len total length of the UDP packet
           sum checksum (0 for libnet to autofill)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   libnet_ptag_tlibnet_build_vrrp(uint8_tversion,uint8_ttype,uint8_tvrouter_id,uint8_tpriority,uint8_tip_count,uint8_tauth_type,uint8_tadvert_int,uint16_tsum,constuint8_t*payload,uint32_tpayload_s,libnet_t*l,libnet_ptag_tptag)BuildsanRFC2338VirtualRouterRedundacyProtool(VRRP)header.Usethepayloadinterfacetospecifyaddressandautthenticationinformation.Tobuilda'legal'packet,thedestinationIPv4addressshouldbethemulticast*address224.0.0.18,theIPTTLshouldbesetto255,andtheIPprotocolshouldbesetto112.Parameters:version VRRP version (should be 2)
           type VRRP packet type (should be 1 -- ADVERTISEMENT)
           vrouter_id virtual router identification
           priority priority (higher numbers indicate higher priority)
           ip_count number of IPv4 addresses contained in this advertisement
           auth_type type of authentication (0, 1, 2 -- see RFC)
           advert_int interval between advertisements
           sum checksum (0 for libnet to autofill)
           payload optional payload or NULL
           payload_s payload length or 0
           l pointer to a libnet context
           ptag protocol tag to modify an existing header, 0 to build a new one

       Returns:
           protocol tag value on success, -1 on error

   voidlibnet_clear_packet(libnet_t*l)Clearsthecurrentpacketreferencedandfreesallpblocks.Shouldbecalledwhentheprogrammerwanttosendacompletelynewpacketofadifferenttypeusingthesamecontext.Parameters:l pointer to a libnet context

   intlibnet_cq_add(libnet_t*l,char*label)[ContextQueue]Addsanewcontexttothelibnetcontextqueue.Ifnoqueueexists,thisfunctionwillcreatethequeueandaddthespecifiedlibnetcontextasthefirstentryonthelist.ThefunctionscheckstoensurenietherlnorlabelareNULL,andthatlabeldoesn'trefertoanexistingcontextalreadyinthequeue.Additionally,lshouldrefertoalibnetcontextpreviouslyinitializedwithacalltolibnet_init().Ifthecontextqueueinwritelocked,thisfunctionwillfail.Parameters:l pointer to a libnet context
           label a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE

       Returns:
           1 on success, -1 on failure

   voidlibnet_cq_destroy(void)[ContextQueue]Destroystheentirecontextqueue,callinglibnet_destroy()oneachmembercontext.uint32_tlibnet_cq_end_loop(void)[ContextQueue]libnet_t*libnet_cq_find_by_label(char*label)[ContextQueue]Locatesalibnetcontextfromthequeue,indexedbyacanonicallabel.Parameters:label canonical label of the libnet context to retrieve

       Returns:
           the expected libnet context, NULL on failure

   constchar*libnet_cq_getlabel(libnet_t*l)[ContextQueue]Returnsthecanonicallabelassociatedwiththecontext.Parameters:l pointer to a libnet context

       Returns:
           pointer to the libnet context's label

   libnet_t*libnet_cq_head(void)[ContextQueue]Intiailizestheinteratorinterfaceandsetawritelockontheentirequeue.Thisfunctionisintendedtobecalledjustpriortointeratingthroughtheentirelistofcontexts(withtheprobableintentofinjectaseriesofpacketsinrapidsuccession).Thisfunctionisoftenusedasperthefollowing:
       for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next()) { ... }

       Much of the time, the application programmer will use the iterator as  it  is  written  above;  as  such,
       libnet  provides a macro to do exactly that, for_each_context_in_cq(l). Warning: do not call the iterator
       more than once in a single loop.

       Returns:
           the head of the context queue

   intlibnet_cq_last(void)[ContextQueue]Checkwhethertheiteratorisatthelastcontextinthequeue.Returns:
           1 if at the end of the context queue, 0 otherwise

   libnet_t*libnet_cq_next(void)[ContextQueue]Getnextcontextfromthecontextqueue.Returns:
           the next context from the context queue

   libnet_t*libnet_cq_remove(libnet_t*l)[ContextQueue]Removesaspecifiedcontextfromthelibnetcontextqueuebyspecifyingthelibnetcontextpointer.Notethefunctionwillremovethespecifiedcontextfromthecontextqueueandcleanupinternalmemoryfromthequeue,itisuptotheapplicationprogrammertofreethereturnedlibnetcontextwithacalltolibnet_destroy().Also,asitisnotnecessarytokeepthelibnetcontextpointerwheninitiallyaddingittothecontextqueue,mostapplicationprogrammerswillprefertorefertoentriesonthecontextqueuebycanonicalnameandwoulduselibnet_cq_remove_by_label().Ifthecontextqueueiswritelocked,thisfunctionwillfail.Parameters:l pointer to a libnet context

       Returns:
           the pointer to the removed libnet context, NULL on failure

   libnet_t*libnet_cq_remove_by_label(char*label)[ContextQueue]Removesaspecifiedcontextfromthelibnetcontextqueuebyspecifyingthecanonicalname.Notethefunctionwillremovethespecifiedcontextfromthecontextqueueandcleanupinternalmemoryfromthequeue,itisuptotheapplicationprogrammertofreethereturnedlibnetcontextwithacalltolibnet_destroy().Ifthecontextqueueiswritelocked,thisfunctionwillfail.Parameters:label canonical name of the context to remove

       Returns:
           the pointer to the removed libnet context, NULL on failure

   uint32_tlibnet_cq_size(void)[ContextQueue]Functionreturnsthenumberoflibnetcontextsthatareinthequeue.Returns:
           the number of libnet contexts currently in the queue

   voidlibnet_destroy(libnet_t*l)Shutsdownthelibnetsessionreferencedbyl.Itclosesthenetworkinterfaceandfreesallinternalmemorystructuresassociatedwithl.Parameters:l pointer to a libnet context

   voidlibnet_diag_dump_context(libnet_t*l)[Diagnostic]Printsthecontentsofthegivencontext.Parameters:l pointer to a libnet context

   voidlibnet_diag_dump_hex(constuint8_t*packet,uint32_tlen,intswap,FILE*stream)[Diagnostic]Functionprintsthecontentsofthesuppliedbuffertothesuppliedstreampointer.Willswapendiannessbaseddispositionofmodevariable.Usefultobeusedinconjunctionwiththeadvancedinterfaceandaculledpacket.Parameters:packet the packet to print
           len length of the packet in bytes
           swap 1 to swap byte order, 0 to not. Counter-intuitively, it is necessary to swap in order to see the
           byte order as it is on the wire (this may be a bug).
           stream a stream pointer to print to

   voidlibnet_diag_dump_pblock(libnet_t*l)[Diagnostic]Printsthecontentsofeverypblock.Parameters:l pointer to a libnet context

   char*libnet_diag_dump_pblock_type(uint8_ttype)[Diagnostic]Returnsthecanonicalnameofthepblocktype.Parameters:type pblock type

       Returns:
           a string representing the pblock type type or 'unknown' for an unknown value

   structlibnet_ether_addr*libnet_get_hwaddr(libnet_t*l)[read]ReturnstheMACaddressforthedevicelibnetwasinitializedwith.Iflibnetwasinitializedwithoutadevicethefunctionwillattempttofindone.IfthefunctionfailsandreturnsNULLacalltolibnet_geterror()willtellyouwhy.Parameters:l pointer to a libnet context

       Returns:
           a pointer to the MAC address or NULL

   uint32_tlibnet_get_ipaddr4(libnet_t*l)ReturnstheIPaddressforthedevicelibnetwasinitializedwith.Iflibnetwasinitializedwithoutadevice(inrawsocketmode)thefunctionwillattempttofindone.Ifthefunctionfailsandreturns-1acalltolibnet_geterrror()willtellyouwhy.Parameters:l pointer to a libnet context

       Returns:
           a big endian IP address suitable for use in a libnet_build function or -1

   structlibnet_in6_addrlibnet_get_ipaddr6(libnet_t*l)[read]ReturnstheIPv6addressforthedevicelibnetwasinitializedwith.Iflibnetwasinitializedwithoutadevice(inrawsocketmode)thefunctionwillattempttofindone.Ifthefunctionfailsandreturnsin6addr_error,acalltolibnet_geterrror()willtellyouwhy.ThisfunctionisnotyetimplementedforWin32platforms.Parameters:l pointer to a libnet context

       Returns:
           well, nothing yet

   uint32_tlibnet_get_prand(intmod)Generatesanunsignedpsuedo-randomvaluewithintherangespecifiedbymod.LIBNET_PR20-1LIBNET_PR80-255LIBNET_PR160-32767LIBNET_PRu160-65535LIBNET_PR320-2147483647LIBNET_PRu320-4294967295Parameters:mod one the of LIBNET_PR* constants

       Returns:
           1 on success, -1 on failure

   constchar*libnet_getdevice(libnet_t*l)Returnsthecanonicalnameofthedeviceusedforpacketinjection.Parameters:l pointer to a libnet context

       Returns:
           the  canonical  name  of  the  device used for packet injection. Note it can be NULL without being an
           error.

   char*libnet_geterror(libnet_t*l)Returnsthelasterrorsetinsideofthereferencedlibnetcontext.Thisfunctionshouldbecalledanytimeafunctionfailsoranerrorconditionisdetectedinsideoflibnet.Parameters:l pointer to a libnet context

       Returns:
           an error string or NULL if no error has occured

   intlibnet_getfd(libnet_t*l)ReturnstheFILENOofthefiledescriptorusedforpacketinjection.Parameters:l pointer to a libnet context

       Returns:
           the file number of the file descriptor used for packet injection

   uint32_tlibnet_getgre_length(uint16_tfv)Parameters:fv see libnet_build_gre().

       Returns:
           size, see libnet_build_gre().

   uint32_tlibnet_getpacket_size(libnet_t*l)Returnsthesumofthesizeofallofthepblocksinsideofl(thisshouldbetheresulingpacketsize).Parameters:l pointer to a libnet context

       Returns:
           the size of the packet in l

   uint8_t*libnet_getpbuf(libnet_t*l,libnet_ptag_tptag)Returnsthepblockbuffercontentsforthespecifiedptag;asubsequentcalltolibnet_getpbuf_size()shouldbemadetodeterminethesizeofthebuffer.Parameters:l pointer to a libnet context
           ptag the ptag reference number

       Returns:
           a pointer to the pblock buffer or NULL on error

   uint32_tlibnet_getpbuf_size(libnet_t*l,libnet_ptag_tptag)Returnsthepblockbuffersizeforthespecifiedptag;apreviouscalltolibnet_getpbuf()shouldbemadetopulltheactualbuffercontents.Parameters:l pointer to a libnet context
           ptag the ptag reference number

       Returns:
           the size of the pblock buffer

   uint8_t*libnet_hex_aton(constchar*s,int*len)Takesacolonseparatedhexidecimaladdress(fromthecommandline)andreturnsabytestringsuitableforuseinalibnet_buildfunction.Notethisfunctionperformsanimplicitmallocandthereturnvalueshouldbefreedafteritsuse.Parameters:s the string to be parsed
           len the resulting size of the returned byte string

       Returns:
           a byte string or NULL on failure

   intlibnet_in6_is_error(structlibnet_in6_addraddr)Checkalibnet_in6_addrstructureforidentitywithin6addr_error.Parameters:addr address to check

       Returns:
           1 if addr is in6addr_error, 0 if it is not

   libnet_t*libnet_init(intinjection_type,constchar*device,char*err_buf)Createsthelibnetenvironment.Itinitializesthelibraryandreturnsalibnetcontext.Iftheinjection_typeisLIBNET_LINKorLIBNET_LINK_ADV,thefunctioninitializestheinjectionprimitivesforthelink-layerinterfaceenablingtheapplicationprogrammertobuildpacketsstartingatthedata-linklayer(whichalsoprovidesmoregranularcontrolovertheIPlayer).Iflibnetusesthelink-layerandthedeviceargumentisnon-NULL,thefunctionattemptstousethespecifiednetworkdeviceforpacketinjection.Thisiseitheracanonicalstringthatreferencesthedevice(suchas'eth0'fora100MBEthernetcardonLinuxor'fxp0'fora100MBEthernetcardonOpenBSD)orthedotsanddecimalsrepresentationofthedevice'sIPaddress(192.168.0.1).IfdeviceisNULL,libnetattemptstofindasuitabledevicetouse.Iftheinjection_typeisLIBNET_RAW4orLIBNET_RAW4_ADV,thefunctioninitializestheinjectionprimitivesfortheIPv4rawsocketinterface.Thefinalargument,err_buf,shouldbeabufferofsizeLIBNET_ERRBUF_SIZEandholdsanerrormessageifthefunctionfails.Thisfunctionrequiresrootprivilegestoexecutesuccessfully.Uponsuccess,thefunctionreturnsavalidlibnetcontextforuseinlaterfunctioncalls;uponfailure,thefunctionreturnsNULL.Parameters:injection_type packet injection type  (LIBNET_LINK,  LIBNET_LINK_ADV,  LIBNET_RAW4,  LIBNET_RAW4_ADV,
           LIBNET_RAW6, LIBNET_RAW6_ADV)
           device the interface to use (NULL and libnet will choose one)
           err_buf will contain an error message on failure

       Returns:
           libnet context ready for use or NULL on error.

   uint32_tlibnet_name2addr4(libnet_t*l,char*host_name,uint8_tuse_name)TakesadotteddecimalstringoracanonicalDNSnameandreturnsanetworkbyteorderedIPv4address.ThismayincuraDNSlookupifmodeissettoLIBNET_RESOLVEandhost_namereferstoacanonicalDNSname.IfmodeissettoLIBNET_DONT_RESOLVEnoDNSlookupwilloccur.ThefunctioncanfailifDNSlookupfailsorifmodeissettoLIBNET_DONT_RESOLVEandhost_namereferstoacanonicalDNSname.Parameters:l pointer to a libnet context
           host_name pointer to a string containing a presentation format host name
           use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE

       Returns:
           network byte ordered IPv4 address or -1 (2^32 - 1) on error

   structlibnet_in6_addrlibnet_name2addr6(libnet_t*l,constchar*host_name,uint8_tuse_name)[read]TakesadotteddecimalstringoracanonicalDNSnameandreturnsanetworkbyteorderedIPv6address.ThismayincuraDNSlookupifmodeissettoLIBNET_RESOLVEandhost_namereferstoacanonicalDNSname.IfmodeissettoLIBNET_DONT_RESOLVEnoDNSlookupwilloccur.ThefunctioncanfailifDNSlookupfailsorifmodeissettoLIBNET_DONT_RESOLVEandhost_namereferstoacanonicalDNSname.Parameters:l pointer to a libnet context
           host_name pointer to a string containing a presentation format host name
           use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE

       Returns:
           network byte ordered IPv6 address structure

   intlibnet_plist_chain_dump(libnet_plist_t*plist)Runsthroughtheportlistandprintsthecontentsoftheportlistchainlisttostdout.Parameters:plist previously created portlist

       Returns:
           1 on success, -1 on failure

   char*libnet_plist_chain_dump_string(libnet_plist_t*plist)Runsthroughtheportlistandprintsthecontentsoftheportlistchainlisttostring.Thisfunctionusesstrdupandisnotre-entrant.Italsohasamemoryleakandshouldnotreallybeused.Parameters:plist previously created portlist

       Returns:
           a printable string containing the port list contents on success NULL on error

   intlibnet_plist_chain_free(libnet_plist_t*plist)Freesallmemoryassociatedwithportlistchain.Parameters:plist previously created portlist

       Returns:
           1 on success, -1 on failure

   intlibnet_plist_chain_new(libnet_t*l,libnet_plist_t**plist,char*token_list)Createsanewportlist.PortlistchainsareusefulforTCPandUDP-basedapplicationsthatneedtosendpacketstoarangeofports(contiguousorotherwise).Theportlistchain,whichtoken_listpointsto,shouldcontainaseriesofint8_tactersfromthefollowinglist:'0123456789,-'ofthegeneralformat'x-y,z',where'xyz'areportnumbersbetween0and65,535.plistpointstothefrontoftheportlistchainlistforuseinfurtherlibnet_plist_chain()functions.Uponsuccess,thefunctionreturns1.Uponfailure,thefunctionreturns-1andlibnet_geterror()cantellyouwhy.Parameters:l pointer to a libnet context
           plist if successful, will refer to the portlist, if not, NULL
           token_list string containing the port list primitive

       Returns:
           1 on success, -1 on failure

   intlibnet_plist_chain_next_pair(libnet_plist_t*plist,uint16_t*bport,uint16_t*eport)Returnsthenextportlistchainpairfromtheportlistchainplist.bportandeportcontainthestartingportnumberandendingportnumber,respectively.Uponsuccess,thefunctionreturns1andfillsintheportvariables;however,ifthelistisempty,thefunctionreturns0andsetsbothportvariablesto0.Uponfailure,thefunctionreturns-1.Parameters:plist previously created portlist
           bport will contain the beginning port number or 0
           eport will contain the ending port number or 0

       Returns:
           1 on success, 0 if empty, -1 on failure

   intlibnet_seed_prand(libnet_t*l)Seedsthepsuedo-randomnumbergenerator.Parameters:l pointer to a libnet context

       Returns:
           1 on success, -1 on failure

   voidlibnet_stats(libnet_t*l,structlibnet_stats*ls)Fillsinalibnet_statsstructurewithpacketinjectionstatistics(packetswritten,byteswritten,packetsendingerrors).Parameters:l pointer to a libnet context
           ls pointer to a libnet statistics structure

   intlibnet_toggle_checksum(libnet_t*l,libnet_ptag_tptag,intmode)Ifagivenprotocolheaderisbuiltwiththechecksumfieldsetto'0',bydefaultlibnetwillcalculatetheheaderchecksumpriortoinjection.Iftheheaderissettoanyothervalue,bydefaultlibnetwillnotcalculatetheheaderchecksum.Toover-ridethisbehavior,uselibnet_toggle_checksum().Switchesauto-checksummingonoroffforthespecifiedptag.IfmodeissettoLIBNET_ON,libnetwillmarkthespecificedptagtocalculateachecksumfortheptagpriortoinjection.Thisassumesthattheptagreferstoaprotocolthathasachecksumfield.IfmodeissettoLIBNET_OFF,libnetwillclearthechecksumflagandnochecksumwillbecomputedpriortoinjection.Thisassumesthattheprogrammerwillassignavalue(zeroorotherwise)tothechecksumfield.Oftentimesthisisusefulifaprecomputedchecksumorsomeotherpredefinedvalueisgoingtobeused.NotethatwhenlibnetisinitializedwithLIBNET_RAW4,theIPv4headerchecksumwillalwaysbecomputedbythekernelpriortoinjection,regardlessofwhattheprogrammersets.Parameters:l pointer to a libnet context
           ptag the ptag reference number
           mode LIBNET_ON or LIBNET_OFF

       Returns:
           1 on success, -1 on failure

   constchar*libnet_version(void)Returnstheversionoflibnet.Returns:
           the libnet version

   intlibnet_write(libnet_t*l)Writesaprebuiltpackettothenetwork.Thefunctionassumesthatlwaspreviouslyinitialized(viaacalltolibnet_init())andthatapreviouslyconstructedpackethasbeenbuiltinsidethiscontext(viaoneormorecallstothelibnet_build*familyoffunctions)andisreadytogo.Dependingonhowlibnetwasinitialized,thefunctionwillwritethepackettothewireeitherviatheraworlinklayerinterface.Thefunctionwillalsobumpuptheinternallibnetstatcounterswhichareretrievablevialibnet_stats().Parameters:l pointer to a libnet context

       Returns:
           the number of bytes written, -1 on error

Name

       libnet-functions.h -

       libnet exported function prototypes

Synopsis

Functions
       libnet_t * libnet_init (int injection_type, const char *device, char *err_buf)
       void libnet_destroy (libnet_t *l)
       void libnet_clear_packet (libnet_t *l)
       void libnet_stats (libnet_t *l, struct libnet_stats *ls)
       int libnet_getfd (libnet_t *l)
       const char * libnet_getdevice (libnet_t *l)
       uint8_t * libnet_getpbuf (libnet_t *l, libnet_ptag_t ptag)
       uint32_t libnet_getpbuf_size (libnet_t *l, libnet_ptag_t ptag)
       char * libnet_geterror (libnet_t *l)
       uint32_t libnet_getpacket_size (libnet_t *l)
       int libnet_seed_prand (libnet_t *l)
       uint32_t libnet_get_prand (int mod)
       int libnet_toggle_checksum (libnet_t *l, libnet_ptag_t ptag, int mode)
       char * libnet_addr2name4 (uint32_t in, uint8_t use_name)
       uint32_t libnet_name2addr4 (libnet_t *l, char *host_name, uint8_t use_name)
       int libnet_in6_is_error (struct libnet_in6_addr addr)
       struct libnet_in6_addr libnet_name2addr6 (libnet_t *l, const char *host_name, uint8_t use_name)
       void libnet_addr2name6_r (struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int
           host_name_len)
       int libnet_plist_chain_new (libnet_t *l, libnet_plist_t **plist, char *token_list)
       int libnet_plist_chain_next_pair (libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)
       int libnet_plist_chain_dump (libnet_plist_t *plist)
       char * libnet_plist_chain_dump_string (libnet_plist_t *plist)
       int libnet_plist_chain_free (libnet_plist_t *plist)
       libnet_ptag_t libnet_build_802_1q (const uint8_t *dst, const uint8_t *src, uint16_t tpi, uint8_t
           priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_802_1x (uint8_t eap_ver, uint8_t eap_type, uint16_t length, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_802_2 (uint8_t dsap, uint8_t ssap, uint8_t control, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_802_2snap (uint8_t dsap, uint8_t ssap, uint8_t control, uint8_t *oui, uint16_t
           type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_802_3 (const uint8_t *dst, const uint8_t *src, uint16_t len, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ethernet (const uint8_t *dst, const uint8_t *src, uint16_t type, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_autobuild_ethernet (const uint8_t *dst, uint16_t type, libnet_t *l)
       libnet_ptag_t libnet_build_fddi (uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap,
           uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_autobuild_fddi (uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap, uint8_t
           cf, const uint8_t *oui, uint16_t type, libnet_t *l)
       libnet_ptag_t libnet_build_arp (uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln, uint16_t op, const
           uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_autobuild_arp (uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t
           *tha, uint8_t *tpa, libnet_t *l)
       libnet_ptag_t libnet_build_tcp (uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack, uint8_t control,
           uint16_t win, uint16_t sum, uint16_t urg, uint16_t len, const uint8_t *payload, uint32_t payload_s,
           libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_tcp_options (const uint8_t *options, uint32_t options_s, libnet_t *l,
           libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_udp (uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_cdp (uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type, uint16_t
           value_s, const uint8_t *value, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t
           ptag)
       libnet_ptag_t libnet_build_icmpv4_echo (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t
           seq, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv4_mask (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t
           seq, uint32_t mask, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv4_unreach (uint8_t type, uint8_t code, uint16_t sum, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv4_redirect (uint8_t type, uint8_t code, uint16_t sum, uint32_t gateway,
           const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv4_timeexceed (uint8_t type, uint8_t code, uint16_t sum, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv4_timestamp (uint8_t type, uint8_t code, uint16_t sum, uint16_t id,
           uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv6_echo (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t
           seq, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv6_unreach (uint8_t type, uint8_t code, uint16_t sum, uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv6_ndp_nsol (uint8_t type, uint8_t code, uint16_t sum, struct
           libnet_in6_addr target, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv6_ndp_nadv (uint8_t type, uint8_t code, uint16_t sum, uint32_t flags,
           struct libnet_in6_addr target, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_icmpv6_ndp_opt (uint8_t type, uint8_t *option, uint32_t option_s, libnet_t *l,
           libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_igmp (uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipv4 (uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag, uint8_t ttl,
           uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst, const uint8_t *payload, uint32_t payload_s,
           libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipv4_options (const uint8_t *options, uint32_t options_s, libnet_t *l,
           libnet_ptag_t ptag)
       libnet_ptag_t libnet_autobuild_ipv4 (uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)
       libnet_ptag_t libnet_build_ipv6 (uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh, uint8_t hl, struct
           libnet_in6_addr src, struct libnet_in6_addr dst, const uint8_t *payload, uint32_t payload_s, libnet_t
           *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipv6_frag (uint8_t nh, uint8_t reserved, uint16_t frag, uint32_t id, const
           uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipv6_routing (uint8_t nh, uint8_t len, uint8_t rtype, uint8_t segments, const
           uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipv6_destopts (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipv6_hbhopts (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_autobuild_ipv6 (uint16_t len, uint8_t nh, struct libnet_in6_addr dst, libnet_t *l,
           libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_isl (uint8_t *dhost, uint8_t type, uint8_t user, uint8_t *shost, uint16_t len,
           const uint8_t *snap, uint16_t vid, uint16_t portindex, uint16_t reserved, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipsec_esp_hdr (uint32_t spi, uint32_t seq, uint32_t iv, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipsec_esp_ftr (uint8_t len, uint8_t nh, int8_t *auth, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ipsec_ah (uint8_t nh, uint8_t len, uint16_t res, uint32_t spi, uint32_t seq,
           uint32_t auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_dnsv4 (uint16_t h_len, uint16_t id, uint16_t flags, uint16_t num_q, uint16_t
           num_anws_rr, uint16_t num_auth_rr, uint16_t num_addi_rr, const uint8_t *payload, uint32_t payload_s,
           libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_rip (uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af, uint16_t rt,
           uint32_t addr, uint32_t mask, uint32_t next_hop, uint32_t metric, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_rpc_call (uint32_t rm, uint32_t xid, uint32_t prog_num, uint32_t prog_vers,
           uint32_t procedure, uint32_t cflavor, uint32_t clength, uint8_t *cdata, uint32_t vflavor, uint32_t
           vlength, const uint8_t *vdata, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t
           ptag)
       libnet_ptag_t libnet_build_stp_conf (uint16_t id, uint8_t version, uint8_t bpdu_type, uint8_t flags,
           const uint8_t *root_id, uint32_t root_pc, const uint8_t *bridge_id, uint16_t port_id, uint16_t
           message_age, uint16_t max_age, uint16_t hello_time, uint16_t f_delay, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_stp_tcn (uint16_t id, uint8_t version, uint8_t bpdu_type, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_token_ring (uint8_t ac, uint8_t fc, const uint8_t *dst, const uint8_t *src,
           uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_autobuild_token_ring (uint8_t ac, uint8_t fc, const uint8_t *dst, uint8_t dsap,
           uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l)
       libnet_ptag_t libnet_build_vrrp (uint8_t version, uint8_t type, uint8_t vrouter_id, uint8_t priority,
           uint8_t ip_count, uint8_t auth_type, uint8_t advert_int, uint16_t sum, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_mpls (uint32_t label, uint8_t experimental, uint8_t bos, uint8_t ttl, const
           uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ntp (uint8_t leap_indicator, uint8_t version, uint8_t mode, uint8_t stratum,
           uint8_t poll, uint8_t precision, uint16_t delay_int, uint16_t delay_frac, uint16_t dispersion_int,
           uint16_t dispersion_frac, uint32_t reference_id, uint32_t ref_ts_int, uint32_t ref_ts_frac, uint32_t
           orig_ts_int, uint32_t orig_ts_frac, uint32_t rec_ts_int, uint32_t rec_ts_frac, uint32_t xmt_ts_int,
           uint32_t xmt_ts_frac, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2 (uint16_t len, uint8_t type, uint32_t rtr_id, uint32_t area_id,
           uint16_t sum, uint16_t autype, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t
           ptag)
       libnet_ptag_t libnet_build_ospfv2_hello (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t
           priority, uint dead_int, uint32_t des_rtr, uint32_t bkup_rtr, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2_dbd (uint16_t dgram_len, uint8_t opts, uint8_t type, uint seqnum, const
           uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2_lsr (uint type, uint lsid, uint32_t advrtr, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2_lsu (uint num, const uint8_t *payload, uint32_t payload_s, libnet_t *l,
           libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2_lsa (uint16_t age, uint8_t opts, uint8_t type, uint lsid, uint32_t
           advrtr, uint seqnum, uint16_t sum, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t
           *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2_lsa_rtr (uint16_t flags, uint16_t num, uint id, uint data, uint8_t
           type, uint8_t tos, uint16_t metric, const uint8_t *payload, uint32_t payload_s, libnet_t *l,
           libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2_lsa_net (uint32_t nmask, uint rtrid, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2_lsa_sum (uint32_t nmask, uint metric, uint tos, const uint8_t *payload,
           uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_ospfv2_lsa_as (uint32_t nmask, uint metric, uint32_t fwdaddr, uint tag, const
           uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_data (const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t
           ptag)
       libnet_ptag_t libnet_build_dhcpv4 (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount,
           uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip,
           const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_bootpv4 (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount,
           uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip,
           const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_t
           payload_s, libnet_t *l, libnet_ptag_t ptag)
       uint32_t libnet_getgre_length (uint16_t fv)
       libnet_ptag_t libnet_build_gre (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key,
           uint32_t seq, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t
           ptag)
       libnet_ptag_t libnet_build_egre (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key,
           uint32_t seq, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t
           ptag)
       libnet_ptag_t libnet_build_gre_sre (uint16_t af, uint8_t offset, uint8_t length, uint8_t *routing, const
           uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_gre_last_sre (libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_bgp4_header (uint8_t marker[LIBNET_BGP4_MARKER_SIZE], uint16_t len, uint8_t
           type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_bgp4_open (uint8_t version, uint16_t src_as, uint16_t hold_time, uint32_t
           bgp_id, uint8_t opt_len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_bgp4_update (uint16_t unfeasible_rt_len, const uint8_t *withdrawn_rt, uint16_t
           total_path_attr_len, const uint8_t *path_attributes, uint16_t info_len, uint8_t *reachability_info,
           const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_bgp4_notification (uint8_t err_code, uint8_t err_subcode, const uint8_t
           *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_sebek (uint32_t magic, uint16_t version, uint16_t type, uint32_t counter,
           uint32_t time_sec, uint32_t time_usec, uint32_t pid, uint32_t uid, uint32_t fd, uint8_t
           cmd[SEBEK_CMD_LENGTH], uint32_t length, const uint8_t *payload, uint32_t payload_s, libnet_t *l,
           libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_hsrp (uint8_t version, uint8_t opcode, uint8_t state, uint8_t hello_time,
           uint8_t hold_time, uint8_t priority, uint8_t group, uint8_t reserved, uint8_t
           authdata[HSRP_AUTHDATA_LENGTH], uint32_t virtual_ip, const uint8_t *payload, uint32_t payload_s,
           libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_build_link (const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_t
           type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
       libnet_ptag_t libnet_autobuild_link (const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)
       int libnet_write (libnet_t *l)
       uint32_t libnet_get_ipaddr4 (libnet_t *l)
       struct libnet_in6_addr libnet_get_ipaddr6 (libnet_t *l)
       struct libnet_ether_addr * libnet_get_hwaddr (libnet_t *l)
       uint8_t * libnet_hex_aton (const char *s, int *len)
       const char * libnet_version (void)
       int libnet_adv_cull_packet (libnet_t *l, uint8_t **packet, uint32_t *packet_s)
       int libnet_adv_cull_header (libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)
       int libnet_adv_write_link (libnet_t *l, const uint8_t *packet, uint32_t packet_s)
       int libnet_adv_write_raw_ipv4 (libnet_t *l, const uint8_t *packet, uint32_t packet_s)
       void libnet_adv_free_packet (libnet_t *l, uint8_t *packet)
       int libnet_cq_add (libnet_t *l, char *label)
       libnet_t * libnet_cq_remove (libnet_t *l)
       libnet_t * libnet_cq_remove_by_label (char *label)
       const char * libnet_cq_getlabel (libnet_t *l)
       libnet_t * libnet_cq_find_by_label (char *label)
       void libnet_cq_destroy (void)
       libnet_t * libnet_cq_head (void)
       int libnet_cq_last (void)
       libnet_t * libnet_cq_next (void)
       uint32_t libnet_cq_size (void)
       uint32_t libnet_cq_end_loop (void)
       void libnet_diag_dump_context (libnet_t *l)
       void libnet_diag_dump_pblock (libnet_t *l)
       char * libnet_diag_dump_pblock_type (uint8_t type)
       void libnet_diag_dump_hex (const uint8_t *packet, uint32_t len, int swap, FILE *stream)
       int libnet_write_raw_ipv4 (libnet_t *l, const uint8_t *packet, uint32_t size)
       int libnet_write_raw_ipv6 (libnet_t *l, const uint8_t *packet, uint32_t size)
       int libnet_write_link (libnet_t *l, const uint8_t *packet, uint32_t size)
       int libnet_open_raw4 (libnet_t *l)
       int libnet_close_raw4 (libnet_t *l)
       int libnet_open_raw6 (libnet_t *l)
       int libnet_close_raw6 (libnet_t *l)
       int libnet_select_device (libnet_t *l)
       int libnet_open_link (libnet_t *l)
       int libnet_close_link (libnet_t *l)
       int libnet_do_checksum (libnet_t *l, uint8_t *iphdr, int protocol, int h_len)
       int libnet_inet_checksum (libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const uint8_t *beg, const
           uint8_t *end)
       uint32_t libnet_compute_crc (uint8_t *buf, uint32_t len)
       uint16_t libnet_ip_check (uint16_t *addr, int len)
       int libnet_in_cksum (uint16_t *addr, int len)
       libnet_pblock_t * libnet_pblock_probe (libnet_t *l, libnet_ptag_t ptag, uint32_t b_len, uint8_t type)
       libnet_pblock_t * libnet_pblock_new (libnet_t *l, uint32_t b_len)
       int libnet_pblock_swap (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)
       int libnet_pblock_insert_before (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)
       void libnet_pblock_delete (libnet_t *l, libnet_pblock_t *p)
       libnet_ptag_t libnet_pblock_update (libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type)
       libnet_pblock_t * libnet_pblock_find (libnet_t *l, libnet_ptag_t ptag)
       int libnet_pblock_append (libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t len)
       void libnet_pblock_setflags (libnet_pblock_t *p, uint8_t flags)
       int libnet_pblock_p2p (uint8_t type)
       int libnet_pblock_coalesce (libnet_t *l, uint8_t **packet, uint32_t *size)
       int libnet_check_iface (libnet_t *l)

   Variables
       struct libnet_in6_addr in6addr_error

See Also