<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libnet: libnet-functions.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">libnet <span id="projectnumber">1.1</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">libnet-functions.h File Reference</div> </div>
</div>
<div class="contents">
<p>libnet exported function prototypes
<a href="#details">More...</a></p>
<p><a href="libnet-functions_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0422723053baf0b254d1ba2215d88118">libnet_init</a> (int injection_type, const char *device, char *err_buf)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a591804711cffa92582703a5aedbd9b25">libnet_destroy</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ab84889f7fe57a1801cf03eceac47463e">libnet_clear_packet</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a886dc359d6add4b0608e8611af7e1b35">libnet_stats</a> (libnet_t *l, struct libnet_stats *ls)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ab9b137f454b3da05d4ac5fe388c1f2b8">libnet_getfd</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a1e68365ece2c976a75bc50e91df40ea0">libnet_getdevice</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a37ac07877d74f4dad59b86a15f5318d8">libnet_getpbuf</a> (libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a23ada8f4ab826966aeaf4ab070f3298e">libnet_getpbuf_size</a> (libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a2a500c6b60a329d873a970ecda4ff6e9">libnet_getpacket_size</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a69470998be995ec8c5e11ecbb19137f5">libnet_seed_prand</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ab74bd339ef6343077dc79bab2063aee3">libnet_get_prand</a> (int mod)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ad36144707ce7994c12ef9d87dc9a2edf">libnet_toggle_checksum</a> (libnet_t *l, libnet_ptag_t ptag, int mode)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#af6b11f82cfc7982bd0b21a6d4a857d1a">libnet_addr2name4</a> (uint32_t in, uint8_t use_name)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a05a7f3f901c57be5aebfbd8b79416de9">libnet_name2addr4</a> (libnet_t *l, char *host_name, uint8_t use_name)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a917ef012eab1449bba7a0fd33438b292">libnet_in6_is_error</a> (struct libnet_in6_addr addr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct libnet_in6_addr </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a69a216eb71e3309c787bd00507148d15">libnet_name2addr6</a> (libnet_t *l, const char *host_name, uint8_t use_name)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a5b7581c7b75c7ecd3e4220c72752efd4">libnet_addr2name6_r</a> (struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int host_name_len)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aaee8e5f54482bf3c9b7c5b101fa8f41f">libnet_plist_chain_new</a> (libnet_t *l, libnet_plist_t **plist, char *token_list)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aa4f1d2acd6b7411d3bf2be73cb617cb2">libnet_plist_chain_next_pair</a> (libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a39e332daa771627372a01867818b4301">libnet_plist_chain_dump</a> (libnet_plist_t *plist)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ab854695d1306f9af440145fc6767d953">libnet_plist_chain_dump_string</a> (libnet_plist_t *plist)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ab5cb1d70164207a7c279a909576058be">libnet_plist_chain_free</a> (libnet_plist_t *plist)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0fdc98930697ff63e2938efd4082cc16">libnet_build_802_1q</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a9c6bae7032a3e32b70f9480f9a30a1ad">libnet_build_802_1x</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a83c65a0bc641803572115f9f290f39fa">libnet_build_802_2</a> (uint8_t dsap, uint8_t ssap, uint8_t control, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0780d8317f3bd7a5e4a2ed10abdbe39b">libnet_build_802_2snap</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a5a200d8b8b3b2a64921db960e8b0da60">libnet_build_802_3</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ac0e53234dfc5205142b0f53c69ab46ae">libnet_build_ethernet</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#acd0747f212c04efd2a4dcb947a3db40b">libnet_autobuild_ethernet</a> (const uint8_t *dst, uint16_t type, libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#af313dd4a88c8bb42f023637aec5d7abf">libnet_build_fddi</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a071f9dc69d6992e2c164ed3827f79cc1">libnet_autobuild_fddi</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ac81464e42636bc0b9e4800bcf135da57">libnet_build_arp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a11bb29bc300b46b1a59009b9e66b6dee">libnet_autobuild_arp</a> (uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, uint8_t *tpa, libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a729cfdedc3e59a3152c99c914d66ec6f">libnet_build_tcp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a11d0bd23cb198f3e940336b62a94839a">libnet_build_tcp_options</a> (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a1dee17aa5276df3587ee276b1b90d8fa">libnet_build_udp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0549535c9d15498e169bc5b96bc9c946">libnet_build_cdp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#af2a31d44e931c774bfc50a8a8d0a71af">libnet_build_icmpv4_echo</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a6cff4ee3328d18a02de3ffa467b4a783">libnet_build_icmpv4_mask</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aeb4d9c27fe201737ba139dde6c5c0f2e">libnet_build_icmpv4_unreach</a> (uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a80e6e045aa6e2b249294112171129b28">libnet_build_icmpv4_redirect</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a9f4204ece5d336ef11e777c2d5e50186">libnet_build_icmpv4_timeexceed</a> (uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a68d0c6a2b394b15e9064e404842a1989">libnet_build_icmpv4_timestamp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ab25c002229189641d723847c6fd06f5a">libnet_build_icmpv6_echo</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a4e46b8ea4becc7fe4d10fc1af6a5aefa">libnet_build_icmpv6_unreach</a> (uint8_t type, uint8_t code, uint16_t sum, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a806d7200cc479b065f7a26d1057b4fcd">libnet_build_icmpv6_ndp_nsol</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a8351efc0261c66660b362e16a68f9001">libnet_build_icmpv6_ndp_nadv</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0ac427a5e4fe8281724fd17619c0db12">libnet_build_icmpv6_ndp_opt</a> (uint8_t type, uint8_t *option, uint32_t option_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a66590b72b65d46bf15544327235edc66">libnet_build_igmp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a326cf29f24a37dc9232b8b6a56a3f12f">libnet_build_ipv4</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#af1e1c66ed14370114d61ca919d558092">libnet_build_ipv4_options</a> (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a17d44748537af9d97cbafe9c1040c7d3">libnet_autobuild_ipv4</a> (uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ae568214e9b386ca23e6628431eda1f7e">libnet_build_ipv6</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a16867e9f92b162ff4c00a5587fd3377d">libnet_build_ipv6_frag</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0aeda945e0b6d1ce4bee591107d8887b">libnet_build_ipv6_routing</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a463971e2d708f4e14f2ed9bea7f197be">libnet_build_ipv6_destopts</a> (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#accbcb7a6342997afd1a5410c7006f748">libnet_build_ipv6_hbhopts</a> (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a9af33cad0a1f688907c675fb577514dd">libnet_autobuild_ipv6</a> (uint16_t len, uint8_t nh, struct libnet_in6_addr dst, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a8c3b2833b869c4628240bb5be8b7c864">libnet_build_isl</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ad75f92207cb45587e18e898b344c7600">libnet_build_ipsec_esp_hdr</a> (uint32_t spi, uint32_t seq, uint32_t iv, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a277c0db9a61ea2d24b58b452df0edda0">libnet_build_ipsec_esp_ftr</a> (uint8_t len, uint8_t nh, int8_t *auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a9506a46bfe340f8284ae58656a02c574">libnet_build_ipsec_ah</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a5b4d53861194f34da21ca87bcc158517">libnet_build_dnsv4</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ad8e0469edf11477ccc3fc0b9cb031d00">libnet_build_rip</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a7bc36e79f132c1b7ff449e9df2a459b7">libnet_build_rpc_call</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a5051a29044af5ac103f6604ef8d480e5">libnet_build_stp_conf</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a20cda717c9254f73230b95f9eb808bc1">libnet_build_stp_tcn</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aed08f26e3bc9afd750a3b515a8d83526">libnet_build_token_ring</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a4280cf3a4ffdff6d11c11dcd5f69f0d7">libnet_autobuild_token_ring</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a687daca40884d1125c4115ce215060f6">libnet_build_vrrp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ada1854f38dd301252fc97c93084ac4eb">libnet_build_mpls</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a8a13581c5722c0ee77c2486465c10275">libnet_build_ntp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a215924e3d5c0cbcc4479579e45e60b58">libnet_build_ospfv2</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aff42a70a3b00a91d14200798d10889f2">libnet_build_ospfv2_hello</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a08a78bd747a22581c5ab036b73ca8867">libnet_build_ospfv2_dbd</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a1cfa7596a2f85b2b7226d81fa47e7d39">libnet_build_ospfv2_lsr</a> (uint type, uint lsid, uint32_t advrtr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a65617e2355459bc9ec2db6b979bee9d4">libnet_build_ospfv2_lsu</a> (uint num, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a611d140c425ab18996909be01e02f1c6">libnet_build_ospfv2_lsa</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ad85342b88f62015f11c85e5b387af465">libnet_build_ospfv2_lsa_rtr</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0e067929f1e1dfe92062603c6ba12e71">libnet_build_ospfv2_lsa_net</a> (uint32_t nmask, uint rtrid, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#af3a2ccf97bfd42d3e4760ebf10d71fa5">libnet_build_ospfv2_lsa_sum</a> (uint32_t nmask, uint metric, uint tos, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ab1a6927f757475cd9734772cc93779a7">libnet_build_ospfv2_lsa_as</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a6b46a684b738fde7b4012e55eff31b73">libnet_build_data</a> (const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a399fd399a3cbb884ca3cd9dc7a22509f">libnet_build_dhcpv4</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aeb5caf6fd933b6e909f427405fa99f96">libnet_build_bootpv4</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a223c01dcaba5f098964342ef2737fd85">libnet_getgre_length</a> (uint16_t fv)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a8406f0a8d836df764bedd849ce24a14c">libnet_build_gre</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aa62e7006bab99d1528571bba42118350">libnet_build_egre</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#abf78669b728f6ec879a38bc9fcf7e4d4">libnet_build_gre_sre</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a578594ad820ae9d82fe3f9ea470f0b27">libnet_build_gre_last_sre</a> (libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a9ba6e1d6e95256e67f4a8765bacb901d">libnet_build_bgp4_header</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a99eadbed880ccc2cd3334fa4e32ca193">libnet_build_bgp4_open</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ad2111145ddb5222d70025f568ab22b75">libnet_build_bgp4_update</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a8bbc446c78e7201faf61e8e732919527">libnet_build_bgp4_notification</a> (uint8_t err_code, uint8_t err_subcode, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a9a182529f97b05e9a2a5bd120f2f8456">libnet_build_sebek</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a673f627bdc332ec131135d58a1e44a9d">libnet_build_hsrp</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a76a5b279a29e54057b1fb3e3786ce32f">libnet_build_link</a> (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)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a84b5f1f2c40e2411e5792dcfc152c988">libnet_autobuild_link</a> (const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a53375552efe95906e152152fc170cc0d">libnet_write</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ae1981c8f0923176ecf484e9cd07fea15">libnet_get_ipaddr4</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct libnet_in6_addr </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a3d7de8968c2087df7a22140d7993e267">libnet_get_ipaddr6</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct libnet_ether_addr * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a6531e479687de8d195bd1605422735ca">libnet_get_hwaddr</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0b668af5fd10b0a2879a9a0ea343dce4">libnet_hex_aton</a> (const char *s, int *len)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a5264b060183d307688780bf862fae37c">libnet_version</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a42d0af11102be3209e3f207072946906">libnet_adv_cull_packet</a> (libnet_t *l, uint8_t **packet, uint32_t *packet_s)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a5297581f7aec5f42abede6bd45cd46e9">libnet_adv_cull_header</a> (libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a760ea88b395ac3baad0111d569132ae7">libnet_adv_write_link</a> (libnet_t *l, const uint8_t *packet, uint32_t packet_s)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ae339adcfdccf212acf3f27538d22c1c5">libnet_adv_write_raw_ipv4</a> (libnet_t *l, const uint8_t *packet, uint32_t packet_s)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a1309b57e3571306d9bad13ae93600644">libnet_adv_free_packet</a> (libnet_t *l, uint8_t *packet)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a20887ffe940f1d2c5bcae79a188176c6">libnet_cq_add</a> (libnet_t *l, char *label)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a29f60504a0fe9b7bf6f5a962063118bb">libnet_cq_remove</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a4e972664a0d839eab039f8fb2379987a">libnet_cq_remove_by_label</a> (char *label)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#abb1341d217de4d9c39ec484951e518b0">libnet_cq_getlabel</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a0cd216f0e5563ee06043a8ebfa16fe57">libnet_cq_find_by_label</a> (char *label)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a565d99e292980d5033bef2d186596217">libnet_cq_destroy</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a7e98a045ac6e29ca421507d9a200b5aa">libnet_cq_head</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aab1eb1e3ae64cde579a5a6035d5406c8">libnet_cq_last</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ad312f3182e3e5367db87fc6bab32604d">libnet_cq_next</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ad26ce874f56c59091f4811a7816400a8">libnet_cq_size</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a127764f17e4457f96fb4b976a1666efa">libnet_cq_end_loop</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a3aa6623246e13310dc6f9f9834e7313b">libnet_diag_dump_context</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a9825c6c69efd6ef24545d59177a333e6">libnet_diag_dump_pblock</a> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a57fed7106abf515c5883611eded7ad88">libnet_diag_dump_pblock_type</a> (uint8_t type)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#adb2f7d417f05a058c0c2c7f76b6f66e6">libnet_diag_dump_hex</a> (const uint8_t *packet, uint32_t len, int swap, FILE *stream)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2bd28c9064ea0a30e4b6a3f16b0cb1e0"></a><!-- doxytag: member="libnet-functions.h::libnet_write_raw_ipv4" ref="a2bd28c9064ea0a30e4b6a3f16b0cb1e0" args="(libnet_t *l, const uint8_t *packet, uint32_t size)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_write_raw_ipv4</b> (libnet_t *l, const uint8_t *packet, uint32_t size)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a129520392b83e646abcbf1565b7c3bad"></a><!-- doxytag: member="libnet-functions.h::libnet_write_raw_ipv6" ref="a129520392b83e646abcbf1565b7c3bad" args="(libnet_t *l, const uint8_t *packet, uint32_t size)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_write_raw_ipv6</b> (libnet_t *l, const uint8_t *packet, uint32_t size)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6e89e062ac91f948ac39186dff255835"></a><!-- doxytag: member="libnet-functions.h::libnet_write_link" ref="a6e89e062ac91f948ac39186dff255835" args="(libnet_t *l, const uint8_t *packet, uint32_t size)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_write_link</b> (libnet_t *l, const uint8_t *packet, uint32_t size)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9c939bfce1e95e6c4000543e4747bd25"></a><!-- doxytag: member="libnet-functions.h::libnet_open_raw4" ref="a9c939bfce1e95e6c4000543e4747bd25" args="(libnet_t *l)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_open_raw4</b> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a637b6c3d06ba0c7bb81641f95d9b9817"></a><!-- doxytag: member="libnet-functions.h::libnet_close_raw4" ref="a637b6c3d06ba0c7bb81641f95d9b9817" args="(libnet_t *l)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_close_raw4</b> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acfa541f84cd8b66fbfe88684920621dc"></a><!-- doxytag: member="libnet-functions.h::libnet_open_raw6" ref="acfa541f84cd8b66fbfe88684920621dc" args="(libnet_t *l)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_open_raw6</b> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac26f71561c5a3069cb17681d02de15d2"></a><!-- doxytag: member="libnet-functions.h::libnet_close_raw6" ref="ac26f71561c5a3069cb17681d02de15d2" args="(libnet_t *l)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_close_raw6</b> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a848cce024af46ad0b283ae962379ee5c"></a><!-- doxytag: member="libnet-functions.h::libnet_select_device" ref="a848cce024af46ad0b283ae962379ee5c" args="(libnet_t *l)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_select_device</b> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad924dd4bcaaa9d9f1638232d69ab1b3c"></a><!-- doxytag: member="libnet-functions.h::libnet_open_link" ref="ad924dd4bcaaa9d9f1638232d69ab1b3c" args="(libnet_t *l)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_open_link</b> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a14ba6b1f8e79d6c1e8d0d398aa2300a4"></a><!-- doxytag: member="libnet-functions.h::libnet_close_link" ref="a14ba6b1f8e79d6c1e8d0d398aa2300a4" args="(libnet_t *l)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_close_link</b> (libnet_t *l)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a823e9f64deecb0609a0028cd64d8de82"></a><!-- doxytag: member="libnet-functions.h::libnet_do_checksum" ref="a823e9f64deecb0609a0028cd64d8de82" args="(libnet_t *l, uint8_t *iphdr, int protocol, int h_len)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_do_checksum</b> (libnet_t *l, uint8_t *iphdr, int protocol, int h_len)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a837d23cfa79d859665d4d2765283ce6c"></a><!-- doxytag: member="libnet-functions.h::libnet_inet_checksum" ref="a837d23cfa79d859665d4d2765283ce6c" args="(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const uint8_t *beg, const uint8_t *end)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_inet_checksum</b> (libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const uint8_t *beg, const uint8_t *end)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad00eb3c5589f3175d87dd5b4e24650e2"></a><!-- doxytag: member="libnet-functions.h::libnet_compute_crc" ref="ad00eb3c5589f3175d87dd5b4e24650e2" args="(uint8_t *buf, uint32_t len)" -->
uint32_t </td><td class="memItemRight" valign="bottom"><b>libnet_compute_crc</b> (uint8_t *buf, uint32_t len)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a786e2c4fbb323bd79fea01135a21d384"></a><!-- doxytag: member="libnet-functions.h::libnet_ip_check" ref="a786e2c4fbb323bd79fea01135a21d384" args="(uint16_t *addr, int len)" -->
uint16_t </td><td class="memItemRight" valign="bottom"><b>libnet_ip_check</b> (uint16_t *addr, int len)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8083a6f5694d6d2be7b2cde19a8ee41c"></a><!-- doxytag: member="libnet-functions.h::libnet_in_cksum" ref="a8083a6f5694d6d2be7b2cde19a8ee41c" args="(uint16_t *addr, int len)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_in_cksum</b> (uint16_t *addr, int len)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afbb0b9424f2106f2f1cc64739421aa21"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_probe" ref="afbb0b9424f2106f2f1cc64739421aa21" args="(libnet_t *l, libnet_ptag_t ptag, uint32_t b_len, uint8_t type)" -->
libnet_pblock_t * </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_probe</b> (libnet_t *l, libnet_ptag_t ptag, uint32_t b_len, uint8_t type)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3866e7a53060f1bc02a35022589ce374"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_new" ref="a3866e7a53060f1bc02a35022589ce374" args="(libnet_t *l, uint32_t b_len)" -->
libnet_pblock_t * </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_new</b> (libnet_t *l, uint32_t b_len)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad74cffce51462163ec68af50573148a8"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_swap" ref="ad74cffce51462163ec68af50573148a8" args="(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_swap</b> (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0d9f18e13741c16a7b98fa5d8652995d"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_insert_before" ref="a0d9f18e13741c16a7b98fa5d8652995d" args="(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_insert_before</b> (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af6cfc6d31463e8067908ea5dac698de8"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_delete" ref="af6cfc6d31463e8067908ea5dac698de8" args="(libnet_t *l, libnet_pblock_t *p)" -->
void </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_delete</b> (libnet_t *l, libnet_pblock_t *p)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0b9272cac79f2b5eaba90058a4a50697"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_update" ref="a0b9272cac79f2b5eaba90058a4a50697" args="(libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type)" -->
libnet_ptag_t </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_update</b> (libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6bcc33ff1096bb349c8ffb70953acded"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_find" ref="a6bcc33ff1096bb349c8ffb70953acded" args="(libnet_t *l, libnet_ptag_t ptag)" -->
libnet_pblock_t * </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_find</b> (libnet_t *l, libnet_ptag_t ptag)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6a53bc9534fe3e4e8bb1d516e8bfbe2e"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_append" ref="a6a53bc9534fe3e4e8bb1d516e8bfbe2e" args="(libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t len)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_append</b> (libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t len)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a40e905401d0e59f3c1fd6eb9cd78f52f"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_setflags" ref="a40e905401d0e59f3c1fd6eb9cd78f52f" args="(libnet_pblock_t *p, uint8_t flags)" -->
void </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_setflags</b> (libnet_pblock_t *p, uint8_t flags)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8dbb5bfe4e9b30a907cc43248652441b"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_p2p" ref="a8dbb5bfe4e9b30a907cc43248652441b" args="(uint8_t type)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_p2p</b> (uint8_t type)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afa003d857fbed4674159247c24ae7ee3"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_coalesce" ref="afa003d857fbed4674159247c24ae7ee3" args="(libnet_t *l, uint8_t **packet, uint32_t *size)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_coalesce</b> (libnet_t *l, uint8_t **packet, uint32_t *size)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad71dbbd506317e90548aa4600b5d62c4"></a><!-- doxytag: member="libnet-functions.h::libnet_check_iface" ref="ad71dbbd506317e90548aa4600b5d62c4" args="(libnet_t *l)" -->
int </td><td class="memItemRight" valign="bottom"><b>libnet_check_iface</b> (libnet_t *l)</td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1dc04717e621f421d7edc848183f8549"></a><!-- doxytag: member="libnet-functions.h::in6addr_error" ref="a1dc04717e621f421d7edc848183f8549" args="" -->
struct libnet_in6_addr </td><td class="memItemRight" valign="bottom"><b>in6addr_error</b></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>libnet exported function prototypes </p>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="af6b11f82cfc7982bd0b21a6d4a857d1a"></a><!-- doxytag: member="libnet-functions.h::libnet_addr2name4" ref="af6b11f82cfc7982bd0b21a6d4a857d1a" args="(uint32_t in, uint8_t use_name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* libnet_addr2name4 </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>use_name</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Takes a network byte ordered IPv4 address and returns a pointer to either a canonical DNS name (if it has one) or a string of dotted decimals. This may incur a DNS lookup if the hostname and mode is set to LIBNET_RESOLVE. If mode is set to LIBNET_DONT_RESOLVE, no DNS lookup will be performed and the function will return a pointer to a dotted decimal string. The function cannot fail -- if no canonical name exists, it will fall back on returning a dotted decimal string. This function is non-reentrant. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">in</td><td>network byte ordered IPv4 address </td></tr>
<tr><td class="paramname">use_name</td><td>LIBNET_RESOLVE or LIBNET_DONT_RESOLVE </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to presentation format string </dd></dl>
</div>
</div>
<a class="anchor" id="a5b7581c7b75c7ecd3e4220c72752efd4"></a><!-- doxytag: member="libnet-functions.h::libnet_addr2name6_r" ref="a5b7581c7b75c7ecd3e4220c72752efd4" args="(struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int host_name_len)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_addr2name6_r </td>
<td>(</td>
<td class="paramtype">struct libnet_in6_addr </td>
<td class="paramname"><em>addr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>use_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>host_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>host_name_len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Should document this baby right here. </p>
</div>
</div>
<a class="anchor" id="a5297581f7aec5f42abede6bd45cd46e9"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_cull_header" ref="a5297581f7aec5f42abede6bd45cd46e9" args="(libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_adv_cull_header </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t ** </td>
<td class="paramname"><em>header</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t * </td>
<td class="paramname"><em>header_s</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Advanced Interface] Pulls the header from the specified ptag from the given libnet context. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails <a class="el" href="libnet-functions_8h.html#a36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>the ptag referencing the header to pull </td></tr>
<tr><td class="paramname">header</td><td>will contain the header </td></tr>
<tr><td class="paramname">header_s</td><td>will contain the header size </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a42d0af11102be3209e3f207072946906"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_cull_packet" ref="a42d0af11102be3209e3f207072946906" args="(libnet_t *l, uint8_t **packet, uint32_t *packet_s)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_adv_cull_packet </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t ** </td>
<td class="paramname"><em>packet</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t * </td>
<td class="paramname"><em>packet_s</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Advanced Interface] Yanks a prebuilt, wire-ready packet from the given libnet context. If libnet was configured to do so (which it is by default) the packet will have all checksums written in. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. It is important to note that the function performs an implicit malloc() and a corresponding call to <a class="el" href="libnet-functions_8h.html#a1309b57e3571306d9bad13ae93600644">libnet_adv_free_packet()</a> should be made to free the memory packet occupies. If the function fails <a class="el" href="libnet-functions_8h.html#a36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">packet</td><td>will contain the wire-ready packet </td></tr>
<tr><td class="paramname">packet_s</td><td>will contain the packet size </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a1309b57e3571306d9bad13ae93600644"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_free_packet" ref="a1309b57e3571306d9bad13ae93600644" args="(libnet_t *l, uint8_t *packet)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_adv_free_packet </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>packet</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Advanced Interface] Frees the memory allocated when <a class="el" href="libnet-functions_8h.html#a42d0af11102be3209e3f207072946906">libnet_adv_cull_packet()</a> is called. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">packet</td><td>a pointer to the packet to free </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a760ea88b395ac3baad0111d569132ae7"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_write_link" ref="a760ea88b395ac3baad0111d569132ae7" args="(libnet_t *l, const uint8_t *packet, uint32_t packet_s)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_adv_write_link </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>packet</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>packet_s</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Advanced Interface] Writes a packet the network at the link layer. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to <a class="el" href="libnet-functions_8h.html#a42d0af11102be3209e3f207072946906">libnet_adv_cull_packet()</a>. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails <a class="el" href="libnet-functions_8h.html#a36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">packet</td><td>a pointer to the packet to inject </td></tr>
<tr><td class="paramname">packet_s</td><td>the size of the packet </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of bytes written, or -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="ae339adcfdccf212acf3f27538d22c1c5"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_write_raw_ipv4" ref="ae339adcfdccf212acf3f27538d22c1c5" args="(libnet_t *l, const uint8_t *packet, uint32_t packet_s)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_adv_write_raw_ipv4 </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>packet</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>packet_s</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Advanced Interface] Writes a packet the network at the raw socket layer. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to <a class="el" href="libnet-functions_8h.html#a42d0af11102be3209e3f207072946906">libnet_adv_cull_packet()</a>. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails <a class="el" href="libnet-functions_8h.html#a36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">packet</td><td>a pointer to the packet to inject </td></tr>
<tr><td class="paramname">packet_s</td><td>the size of the packet </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of bytes written, or -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a11bb29bc300b46b1a59009b9e66b6dee"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_arp" ref="a11bb29bc300b46b1a59009b9e66b6dee" args="(uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, uint8_t *tpa, libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_autobuild_arp </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>op</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>sha</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>spa</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>tha</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>tpa</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Autouilds an Address Resolution Protocol (ARP) header. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">op</td><td>ARP operation type </td></tr>
<tr><td class="paramname">sha</td><td>sender's hardware address </td></tr>
<tr><td class="paramname">spa</td><td>sender's protocol address </td></tr>
<tr><td class="paramname">tha</td><td>target hardware address </td></tr>
<tr><td class="paramname">tpa</td><td>targer protocol address </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="acd0747f212c04efd2a4dcb947a3db40b"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_ethernet" ref="acd0747f212c04efd2a4dcb947a3db40b" args="(const uint8_t *dst, uint16_t type, libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_autobuild_ethernet </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Autobuilds an Ethernet header. The RFC 894 Ethernet II header is almost identical to the IEEE 802.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length). You should only use this function when libnet is initialized with the LIBNET_LINK interface. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dst</td><td>destination ethernet address </td></tr>
<tr><td class="paramname">type</td><td>upper layer protocol type </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a071f9dc69d6992e2c164ed3827f79cc1"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_fddi" ref="a071f9dc69d6992e2c164ed3827f79cc1" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_autobuild_fddi </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>fc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>dsap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ssap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>cf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>oui</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Autobuilds a Fiber Distributed Data Interface (FDDI) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">fc</td><td>class format and priority </td></tr>
<tr><td class="paramname">dst</td><td>destination fddi address </td></tr>
<tr><td class="paramname">dsap</td><td>destination service access point </td></tr>
<tr><td class="paramname">ssap</td><td>source service access point </td></tr>
<tr><td class="paramname">cf</td><td>cf </td></tr>
<tr><td class="paramname">oui</td><td>IEEE organizational code </td></tr>
<tr><td class="paramname">type</td><td>upper layer protocol </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a17d44748537af9d97cbafe9c1040c7d3"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_ipv4" ref="a17d44748537af9d97cbafe9c1040c7d3" args="(uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_autobuild_ipv4 </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>prot</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Autobuilds a version 4 Internet Protocol (IP) header. The function is useful to build an IP header quickly when you do not need a granular level of control. The function takes the same len, prot, and dst arguments as <a class="el" href="libnet-functions_8h.html#a326cf29f24a37dc9232b8b6a56a3f12f">libnet_build_ipv4()</a>. The function does not accept a ptag argument, but it does return a ptag. In other words, you can use it to build a new IP header but not to modify an existing one. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">len</td><td>total length of the IP packet including all subsequent data </td></tr>
<tr><td class="paramname">prot</td><td>upper layer protocol </td></tr>
<tr><td class="paramname">dst</td><td>destination IPv4 address (little endian) </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a9af33cad0a1f688907c675fb577514dd"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_ipv6" ref="a9af33cad0a1f688907c675fb577514dd" args="(uint16_t len, uint8_t nh, struct libnet_in6_addr dst, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_autobuild_ipv6 </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>nh</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct libnet_in6_addr </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Autobuilds a version 6 RFC 2460 Internet Protocol (IP) header. The function is useful to build an IP header quickly when you do not need a granular level of control. The function takes the same len, nh, and dst arguments as <a class="el" href="libnet-functions_8h.html#a326cf29f24a37dc9232b8b6a56a3f12f">libnet_build_ipv4()</a>. The function does not accept a ptag argument, but it does return a ptag. In other words, you can use it to build a new IP header but not to modify an existing one. This function requires <a class="el" href="libnet-functions_8h.html#a3d7de8968c2087df7a22140d7993e267">libnet_get_ipaddr6()</a>, which is not yet implemented for Win32 platforms. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">len</td><td>length </td></tr>
<tr><td class="paramname">nh</td><td>next header </td></tr>
<tr><td class="paramname">dst</td><td>destination IPv6 address </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a84b5f1f2c40e2411e5792dcfc152c988"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_link" ref="a84b5f1f2c40e2411e5792dcfc152c988" args="(const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_autobuild_link </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>oui</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Automatically builds a link layer header for an initialized l. The function determines the proper link layer header format from how l was initialized. The function current supports Ethernet and Token Ring link layers. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dst</td><td>the destination MAC address </td></tr>
<tr><td class="paramname">oui</td><td>Organizationally Unique Identifier (unused for Ethernet) </td></tr>
<tr><td class="paramname">type</td><td>the upper layer protocol type </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a4280cf3a4ffdff6d11c11dcd5f69f0d7"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_token_ring" ref="a4280cf3a4ffdff6d11c11dcd5f69f0d7" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_autobuild_token_ring </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>fc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>dsap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ssap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>cf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>oui</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Auto-builds a token ring header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">ac</td><td>access control </td></tr>
<tr><td class="paramname">fc</td><td>frame control </td></tr>
<tr><td class="paramname">dst</td><td>destination address </td></tr>
<tr><td class="paramname">dsap</td><td>destination service access point </td></tr>
<tr><td class="paramname">ssap</td><td>source service access point </td></tr>
<tr><td class="paramname">cf</td><td>control field </td></tr>
<tr><td class="paramname">oui</td><td>Organizationally Unique Identifier </td></tr>
<tr><td class="paramname">type</td><td>upper layer protocol type </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a0fdc98930697ff63e2938efd4082cc16"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_1q" ref="a0fdc98930697ff63e2938efd4082cc16" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_802_1q </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>tpi</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>priority</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>cfi</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>vlan_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len_proto</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="PBF"></a>
Packet Builder Functions</h2>
<p>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. <a class="el" href="libnet-functions_8h.html#a8a13581c5722c0ee77c2486465c10275">libnet_build_ntp()</a> 2. <a class="el" href="libnet-functions_8h.html#a1dee17aa5276df3587ee276b1b90d8fa">libnet_build_udp()</a> 3. <a class="el" href="libnet-functions_8h.html#a326cf29f24a37dc9232b8b6a56a3f12f">libnet_build_ipv4()</a> 4. <a class="el" href="libnet-functions_8h.html#ac0e53234dfc5205142b0f53c69ab46ae">libnet_build_ethernet()</a> This ordering is essential for libnet 1.1.x to properly link together the packet internally (previous libnet versions did not have the requirement).</p>
<h3><a class="anchor" id="TPI"></a>
The Payload Interface</h3>
<p>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:</p>
<ul>
<li>Including additional or arbitrary protocol header information that is not available from a libnet interface</li>
<li>Including a packet payload (data segment)</li>
<li>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.</li>
</ul>
<p>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.</p>
<h3><a class="anchor" id="PT"></a>
Protocol Tags and Packet Builder Return Values</h3>
<p>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; <a class="el" href="libnet-functions_8h.html#a36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> 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. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dst</td><td>pointer to a six byte source ethernet address </td></tr>
<tr><td class="paramname">src</td><td>pointer to a six byte destination ethernet address </td></tr>
<tr><td class="paramname">tpi</td><td>tag protocol identifier </td></tr>
<tr><td class="paramname">priority</td><td>priority </td></tr>
<tr><td class="paramname">cfi</td><td>canonical format indicator </td></tr>
<tr><td class="paramname">vlan_id</td><td>vlan identifier </td></tr>
<tr><td class="paramname">len_proto</td><td>length (802.3) protocol (Ethernet II) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a9c6bae7032a3e32b70f9480f9a30a1ad"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_1x" ref="a9c6bae7032a3e32b70f9480f9a30a1ad" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_802_1x </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>eap_ver</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>eap_type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IEEE 802.1x extended authentication protocol header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">eap_ver</td><td>the EAP version </td></tr>
<tr><td class="paramname">eap_type</td><td>the EAP type </td></tr>
<tr><td class="paramname">length</td><td>frame length </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a83c65a0bc641803572115f9f290f39fa"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_2" ref="a83c65a0bc641803572115f9f290f39fa" args="(uint8_t dsap, uint8_t ssap, uint8_t control, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_802_2 </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>dsap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ssap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>control</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IEEE 802.2 LLC header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dsap</td><td>destination service access point </td></tr>
<tr><td class="paramname">ssap</td><td>source service access point </td></tr>
<tr><td class="paramname">control</td><td>control field </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a0780d8317f3bd7a5e4a2ed10abdbe39b"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_2snap" ref="a0780d8317f3bd7a5e4a2ed10abdbe39b" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_802_2snap </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>dsap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ssap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>control</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>oui</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IEEE 802.2 LLC SNAP header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dsap</td><td>destination service access point </td></tr>
<tr><td class="paramname">ssap</td><td>source service access point </td></tr>
<tr><td class="paramname">control</td><td>control field </td></tr>
<tr><td class="paramname">oui</td><td>Organizationally Unique Identifier </td></tr>
<tr><td class="paramname">type</td><td>upper layer protocol </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a5a200d8b8b3b2a64921db960e8b0da60"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_3" ref="a5a200d8b8b3b2a64921db960e8b0da60" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_802_3 </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IEEE 802.3 header. The 802.3 header is almost identical to the RFC 894 Ethernet II header, the exception being that the field immediately following the source address holds the frame's length (as opposed to the layer 3 protocol). You should only use this function when libnet is initialized with the LIBNET_LINK interface. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dst</td><td>destination ethernet address </td></tr>
<tr><td class="paramname">src</td><td>source ethernet address </td></tr>
<tr><td class="paramname">len</td><td>frame length sans header </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ac81464e42636bc0b9e4800bcf135da57"></a><!-- doxytag: member="libnet-functions.h::libnet_build_arp" ref="ac81464e42636bc0b9e4800bcf135da57" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_arp </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>hrd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>pro</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>hln</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>pln</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>op</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>sha</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>spa</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>tha</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>tpa</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an Address Resolution Protocol (ARP) header. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">hrd</td><td>hardware address format </td></tr>
<tr><td class="paramname">pro</td><td>protocol address format </td></tr>
<tr><td class="paramname">hln</td><td>hardware address length </td></tr>
<tr><td class="paramname">pln</td><td>protocol address length </td></tr>
<tr><td class="paramname">op</td><td>ARP operation type </td></tr>
<tr><td class="paramname">sha</td><td>sender's hardware address </td></tr>
<tr><td class="paramname">spa</td><td>sender's protocol address </td></tr>
<tr><td class="paramname">tha</td><td>target hardware address </td></tr>
<tr><td class="paramname">tpa</td><td>targer protocol address </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a9ba6e1d6e95256e67f4a8765bacb901d"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bgp4_header" ref="a9ba6e1d6e95256e67f4a8765bacb901d" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_bgp4_header </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>marker</em>[LIBNET_BGP4_MARKER_SIZE], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) header. The primary function of a BGP speaking system is to exchange network reachability information with other BGP systems. This network reachability information includes information on the list of Autonomous Systems (ASs) that reachability information traverses. This information is sufficient to construct a graph of AS connectivity from which routing loops may be pruned and some policy decisions at the AS level may be enforced. This function builds the base BGP header which is used as a preamble before any other BGP header. For example, a BGP KEEPALIVE message may be built with only this function, while an error notification requires a subsequent call to libnet_build_bgp4_notification. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">marker</td><td>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) </td></tr>
<tr><td class="paramname">len</td><td>total length of the BGP message, including the header </td></tr>
<tr><td class="paramname">type</td><td>type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a8bbc446c78e7201faf61e8e732919527"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bgp4_notification" ref="a8bbc446c78e7201faf61e8e732919527" args="(uint8_t err_code, uint8_t err_subcode, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_bgp4_notification </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>err_code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>err_subcode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) notification header. A NOTIFICATION message is sent when an error condition is detected. Specific error information may be passed through the payload interface. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">err_code</td><td>type of notification </td></tr>
<tr><td class="paramname">err_subcode</td><td>more specific information about the reported error. </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a99eadbed880ccc2cd3334fa4e32ca193"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bgp4_open" ref="a99eadbed880ccc2cd3334fa4e32ca193" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_bgp4_open </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>src_as</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>hold_time</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>bgp_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>opt_len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) OPEN header. This is the first message sent by each side of a BGP connection. The optional parameters options should be constructed using the payload interface (see RFC 1771 for the options structures). </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">version</td><td>protocol version (should be set to 4) </td></tr>
<tr><td class="paramname">src_as</td><td>Autonomous System of the sender </td></tr>
<tr><td class="paramname">hold_time</td><td>used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender </td></tr>
<tr><td class="paramname">bgp_id</td><td>BGP identifier of the sender </td></tr>
<tr><td class="paramname">opt_len</td><td>total length of the optional parameters field in bytes </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ad2111145ddb5222d70025f568ab22b75"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bgp4_update" ref="ad2111145ddb5222d70025f568ab22b75" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_bgp4_update </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>unfeasible_rt_len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>withdrawn_rt</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>total_path_attr_len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>path_attributes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>info_len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>reachability_info</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header. Update messages are used to transfer routing information between BGP peers. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">unfeasible_rt_len</td><td>indicates the length of the (next) "withdrawn routes" field in bytes </td></tr>
<tr><td class="paramname">withdrawn_rt</td><td>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)> </td></tr>
<tr><td class="paramname">total_path_attr_len</td><td>indicates the length of the (next) "path attributes" field in bytes </td></tr>
<tr><td class="paramname">path_attributes</td><td>each attribute is a 3-tuple <type (2 bytes), length, value> </td></tr>
<tr><td class="paramname">info_len</td><td>indicates the length of the (next) "network layer reachability information" field in bytes (needed for internal memory size calculation) </td></tr>
<tr><td class="paramname">reachability_info</td><td>2-tuples <length (1 byte), prefix (variable)>. </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="aeb5caf6fd933b6e909f427405fa99f96"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bootpv4" ref="aeb5caf6fd933b6e909f427405fa99f96" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_bootpv4 </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>opcode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>htype</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>hlen</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>hopcount</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>xid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>secs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>cip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>yip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>sip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>gip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>chaddr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>sname</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>file</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">opcode</td><td></td></tr>
<tr><td class="paramname">htype</td><td></td></tr>
<tr><td class="paramname">hlen</td><td></td></tr>
<tr><td class="paramname">hopcount</td><td></td></tr>
<tr><td class="paramname">xid</td><td></td></tr>
<tr><td class="paramname">secs</td><td></td></tr>
<tr><td class="paramname">flags</td><td></td></tr>
<tr><td class="paramname">cip</td><td></td></tr>
<tr><td class="paramname">yip</td><td></td></tr>
<tr><td class="paramname">sip</td><td></td></tr>
<tr><td class="paramname">gip</td><td></td></tr>
<tr><td class="paramname">chaddr</td><td>client hardware address, length is hlen </td></tr>
<tr><td class="paramname">sname</td><td>server host name, a null terminated string </td></tr>
<tr><td class="paramname">file</td><td>boot file name, a null terminated string </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a0549535c9d15498e169bc5b96bc9c946"></a><!-- doxytag: member="libnet-functions.h::libnet_build_cdp" ref="a0549535c9d15498e169bc5b96bc9c946" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_cdp </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ttl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>value_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a Cisco Discovery Protocol (CDP) header. Cisco Systems designed CDP to aid in the network management of adjacent Cisco devices. The CDP protocol specifies data by using a type/length/value (TLV) setup. The first TLV can specified by using the functions type, length, and value arguments. To specify additional TLVs, the programmer could either use the payload interface or <a class="el" href="libnet-functions_8h.html#a6b46a684b738fde7b4012e55eff31b73">libnet_build_data()</a> to construct them. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">version</td><td>CDP version </td></tr>
<tr><td class="paramname">ttl</td><td>time to live (time information should be cached by recipient) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">type</td><td>type of data contained in value </td></tr>
<tr><td class="paramname">value_s</td><td>length of value argument </td></tr>
<tr><td class="paramname">value</td><td>the CDP information string </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a6b46a684b738fde7b4012e55eff31b73"></a><!-- doxytag: member="libnet-functions.h::libnet_build_data" ref="a6b46a684b738fde7b4012e55eff31b73" args="(const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_data </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a generic libnet protocol header. This is useful for including an optional payload to a packet that might need to change repeatedly inside of a loop. This won't work for TCP or IP payload, they have special types (this is probably a bug). </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a399fd399a3cbb884ca3cd9dc7a22509f"></a><!-- doxytag: member="libnet-functions.h::libnet_build_dhcpv4" ref="a399fd399a3cbb884ca3cd9dc7a22509f" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_dhcpv4 </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>opcode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>htype</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>hlen</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>hopcount</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>xid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>secs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>cip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>yip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>sip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>gip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>chaddr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>sname</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>file</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">opcode</td><td></td></tr>
<tr><td class="paramname">htype</td><td></td></tr>
<tr><td class="paramname">hlen</td><td></td></tr>
<tr><td class="paramname">hopcount</td><td></td></tr>
<tr><td class="paramname">xid</td><td></td></tr>
<tr><td class="paramname">secs</td><td></td></tr>
<tr><td class="paramname">flags</td><td></td></tr>
<tr><td class="paramname">cip</td><td></td></tr>
<tr><td class="paramname">yip</td><td></td></tr>
<tr><td class="paramname">sip</td><td></td></tr>
<tr><td class="paramname">gip</td><td></td></tr>
<tr><td class="paramname">chaddr</td><td>client hardware address, length is hlen </td></tr>
<tr><td class="paramname">sname</td><td>server host name, a null terminated string </td></tr>
<tr><td class="paramname">file</td><td>boot file name, a null terminated string </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a5b4d53861194f34da21ca87bcc158517"></a><!-- doxytag: member="libnet-functions.h::libnet_build_dnsv4" ref="a5b4d53861194f34da21ca87bcc158517" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_dnsv4 </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>h_len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>num_q</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>num_anws_rr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>num_auth_rr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>num_addi_rr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 1035 version 4 DNS header. Additional DNS payload information should be specified using the payload interface. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">h_len</td><td></td></tr>
<tr><td class="paramname">id</td><td>DNS packet id </td></tr>
<tr><td class="paramname">flags</td><td>control flags </td></tr>
<tr><td class="paramname">num_q</td><td>number of questions </td></tr>
<tr><td class="paramname">num_anws_rr</td><td>number of answer resource records </td></tr>
<tr><td class="paramname">num_auth_rr</td><td>number of authority resource records </td></tr>
<tr><td class="paramname">num_addi_rr</td><td>number of additional resource records </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="aa62e7006bab99d1528571bba42118350"></a><!-- doxytag: member="libnet-functions.h::libnet_build_egre" ref="aa62e7006bab99d1528571bba42118350" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_egre </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>fv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as "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. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">fv</td><td>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. </td></tr>
<tr><td class="paramname">type</td><td>which protocol is encapsulated (PPP, IP, ...) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill). </td></tr>
<tr><td class="paramname">offset</td><td>byte offset from the start of the routing field to the first byte of the SRE </td></tr>
<tr><td class="paramname">key</td><td>inserted by the encapsulator to authenticate the source </td></tr>
<tr><td class="paramname">seq</td><td>sequence number used by the receiver to sort the packets </td></tr>
<tr><td class="paramname">len</td><td>size of the GRE packet </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ac0e53234dfc5205142b0f53c69ab46ae"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ethernet" ref="ac0e53234dfc5205142b0f53c69ab46ae" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ethernet </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an Ethernet header. The RFC 894 Ethernet II header is almost identical to the IEEE 802.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length). You should only use this function when libnet is initialized with the LIBNET_LINK interface. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dst</td><td>destination ethernet address </td></tr>
<tr><td class="paramname">src</td><td>source ethernet address </td></tr>
<tr><td class="paramname">type</td><td>upper layer protocol type </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="af313dd4a88c8bb42f023637aec5d7abf"></a><!-- doxytag: member="libnet-functions.h::libnet_build_fddi" ref="af313dd4a88c8bb42f023637aec5d7abf" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_fddi </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>fc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>dsap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ssap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>cf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>oui</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a Fiber Distributed Data Interface (FDDI) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">fc</td><td>class format and priority </td></tr>
<tr><td class="paramname">dst</td><td>destination fddi address </td></tr>
<tr><td class="paramname">src</td><td>source fddi address </td></tr>
<tr><td class="paramname">dsap</td><td>destination service access point </td></tr>
<tr><td class="paramname">ssap</td><td>source service access point </td></tr>
<tr><td class="paramname">cf</td><td>cf </td></tr>
<tr><td class="paramname">oui</td><td>3 byte IEEE organizational code </td></tr>
<tr><td class="paramname">type</td><td>upper layer protocol </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a8406f0a8d836df764bedd849ce24a14c"></a><!-- doxytag: member="libnet-functions.h::libnet_build_gre" ref="a8406f0a8d836df764bedd849ce24a14c" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_gre </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>fv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as "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. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">fv</td><td>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. </td></tr>
<tr><td class="paramname">type</td><td>which protocol is encapsulated (PPP, IP, ...) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill). </td></tr>
<tr><td class="paramname">offset</td><td>byte offset from the start of the routing field to the first byte of the SRE </td></tr>
<tr><td class="paramname">key</td><td>inserted by the encapsulator to authenticate the source </td></tr>
<tr><td class="paramname">seq</td><td>sequence number used by the receiver to sort the packets </td></tr>
<tr><td class="paramname">len</td><td>size of the GRE packet </td></tr>
<tr><td class="paramname">payload</td><td></td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a578594ad820ae9d82fe3f9ea470f0b27"></a><!-- doxytag: member="libnet-functions.h::libnet_build_gre_last_sre" ref="a578594ad820ae9d82fe3f9ea470f0b27" args="(libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_gre_last_sre </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="abf78669b728f6ec879a38bc9fcf7e4d4"></a><!-- doxytag: member="libnet-functions.h::libnet_build_gre_sre" ref="abf78669b728f6ec879a38bc9fcf7e4d4" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_gre_sre </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>af</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>routing</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">af</td><td></td></tr>
<tr><td class="paramname">offset</td><td></td></tr>
<tr><td class="paramname">length</td><td></td></tr>
<tr><td class="paramname">routing</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a673f627bdc332ec131135d58a1e44a9d"></a><!-- doxytag: member="libnet-functions.h::libnet_build_hsrp" ref="a673f627bdc332ec131135d58a1e44a9d" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_hsrp </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>opcode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>state</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>hello_time</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>hold_time</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>priority</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>group</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>reserved</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>authdata</em>[HSRP_AUTHDATA_LENGTH], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>virtual_ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a HSRP header. HSRP is a Cisco propietary protocol defined in RFC 2281 </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">version</td><td>version of the HSRP messages </td></tr>
<tr><td class="paramname">opcode</td><td>type of message </td></tr>
<tr><td class="paramname">state</td><td>current state of the router </td></tr>
<tr><td class="paramname">hello_time</td><td>period in seconds between hello messages </td></tr>
<tr><td class="paramname">hold_time</td><td>seconds that the current hello message is valid </td></tr>
<tr><td class="paramname">priority</td><td>priority for the election proccess </td></tr>
<tr><td class="paramname">group</td><td>standby group </td></tr>
<tr><td class="paramname">reserved</td><td>reserved field </td></tr>
<tr><td class="paramname">authdata</td><td>password </td></tr>
<tr><td class="paramname">virtual_ip</td><td>virtual ip address </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="af2a31d44e931c774bfc50a8a8d0a71af"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_echo" ref="af2a31d44e931c774bfc50a8a8d0a71af" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv4_echo </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be 0) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">id</td><td>identification number </td></tr>
<tr><td class="paramname">seq</td><td>packet sequence number </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a6cff4ee3328d18a02de3ffa467b4a783"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_mask" ref="a6cff4ee3328d18a02de3ffa467b4a783" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv4_mask </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>mask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) IP netmask request/reply header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be 0) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">id</td><td>identification number </td></tr>
<tr><td class="paramname">seq</td><td>packet sequence number </td></tr>
<tr><td class="paramname">mask</td><td>subnet mask </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a80e6e045aa6e2b249294112171129b28"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_redirect" ref="a80e6e045aa6e2b249294112171129b28" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv4_redirect </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>gateway</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 4 RFC 792 Internet Message Control Protocol (ICMP) redirect header. The IP header that caused the error message should be built by a previous call to <a class="el" href="libnet-functions_8h.html#a326cf29f24a37dc9232b8b6a56a3f12f">libnet_build_ipv4()</a>. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ICMP_REDIRECT) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be one of the four redirect codes) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">gateway</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a9f4204ece5d336ef11e777c2d5e50186"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_timeexceed" ref="a9f4204ece5d336ef11e777c2d5e50186" args="(uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv4_timeexceed </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) time exceeded header. The IP header that caused the error message should be built by a previous call to <a class="el" href="libnet-functions_8h.html#a326cf29f24a37dc9232b8b6a56a3f12f">libnet_build_ipv4()</a>. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ICMP_TIMXCEED) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a68d0c6a2b394b15e9064e404842a1989"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_timestamp" ref="a68d0c6a2b394b15e9064e404842a1989" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv4_timestamp </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>otime</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>rtime</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>ttime</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be 0) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">id</td><td>identification number </td></tr>
<tr><td class="paramname">seq</td><td>sequence number </td></tr>
<tr><td class="paramname">otime</td><td>originate timestamp </td></tr>
<tr><td class="paramname">rtime</td><td>receive timestamp </td></tr>
<tr><td class="paramname">ttime</td><td>transmit timestamp </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="aeb4d9c27fe201737ba139dde6c5c0f2e"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_unreach" ref="aeb4d9c27fe201737ba139dde6c5c0f2e" args="(uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv4_unreach </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) unreachable header. The IP header that caused the error message should be built by a previous call to <a class="el" href="libnet-functions_8h.html#a326cf29f24a37dc9232b8b6a56a3f12f">libnet_build_ipv4()</a>. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ICMP_UNREACH) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be one of the 16 unreachable codes) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ab25c002229189641d723847c6fd06f5a"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv6_echo" ref="ab25c002229189641d723847c6fd06f5a" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv6_echo </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 6 RFC 4443 Internet Control Message Protocol (ICMP) echo or echo reply header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ICMP6_ECHO_REQUEST or ICMP6_ECHO_REPLY) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be zero) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">id</td><td>echo id number </td></tr>
<tr><td class="paramname">seq</td><td>echo sequence number </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a8351efc0261c66660b362e16a68f9001"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv6_ndp_nadv" ref="a8351efc0261c66660b362e16a68f9001" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv6_ndp_nadv </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct libnet_in6_addr </td>
<td class="paramname"><em>target</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 6 RFC 2461 Internet Control Message Protocol (ICMP) NDP neighbour advertisement header. Could be used with <a class="el" href="libnet-functions_8h.html#a0ac427a5e4fe8281724fd17619c0db12">libnet_build_icmpv6_ndp_opt()</a> and ND_OPT_TARGET_LINKADDR. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ND_NEIGHBOR_ADVERT) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be zero) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">flags</td><td>should be a bitwise or of any applicable ND_NA_FLAG_* flags </td></tr>
<tr><td class="paramname">target</td><td>target ipv6 address </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a806d7200cc479b065f7a26d1057b4fcd"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv6_ndp_nsol" ref="a806d7200cc479b065f7a26d1057b4fcd" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv6_ndp_nsol </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct libnet_in6_addr </td>
<td class="paramname"><em>target</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 6 RFC 2461 Internet Control Message Protocol (ICMP) NDP neighbour solicitation header. Could be used with <a class="el" href="libnet-functions_8h.html#a0ac427a5e4fe8281724fd17619c0db12">libnet_build_icmpv6_ndp_opt()</a> and ICMPV6_NDP_OPT_SLLA. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ND_NEIGHBOR_SOLICIT) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be zero) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">target</td><td>target ipv6 address </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a0ac427a5e4fe8281724fd17619c0db12"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv6_ndp_opt" ref="a0ac427a5e4fe8281724fd17619c0db12" args="(uint8_t type, uint8_t *option, uint32_t option_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv6_ndp_opt </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>option</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>option_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds ICMPv6 NDP options. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>one of ND_OPT_* types </td></tr>
<tr><td class="paramname">option</td><td>option data </td></tr>
<tr><td class="paramname">option_s</td><td>size of option data (will be padded out to an 8-byte boundary) </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a4e46b8ea4becc7fe4d10fc1af6a5aefa"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv6_unreach" ref="a4e46b8ea4becc7fe4d10fc1af6a5aefa" args="(uint8_t type, uint8_t code, uint16_t sum, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_icmpv6_unreach </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>code</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IP version 6 RFC 4443 Internet Control Message Protocol (ICMP) unreachable header. The IP header that caused the error message should be built by a previous call to <a class="el" href="libnet-functions_8h.html#ae568214e9b386ca23e6628431eda1f7e">libnet_build_ipv6()</a>. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>type of ICMP packet (should be ICMP6_DST_UNREACH) </td></tr>
<tr><td class="paramname">code</td><td>code of ICMP packet (should be one of the 5 ICMP6_DST_UNREACH_* codes) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a66590b72b65d46bf15544327235edc66"></a><!-- doxytag: member="libnet-functions.h::libnet_build_igmp" ref="a66590b72b65d46bf15544327235edc66" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_igmp </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>reserved</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>packet type </td></tr>
<tr><td class="paramname">reserved</td><td>(should be 0 for IGMPv1) </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">ip</td><td>IPv4 address (in standard/network byte order) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>'reserved' was previously called 'code', which it is not, in any IGMP version. </dd></dl>
</div>
</div>
<a class="anchor" id="a9506a46bfe340f8284ae58656a02c574"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipsec_ah" ref="a9506a46bfe340f8284ae58656a02c574" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipsec_ah </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>nh</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>res</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>spi</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>auth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an Internet Protocol Security Authentication header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">nh</td><td>next header </td></tr>
<tr><td class="paramname">len</td><td>payload length </td></tr>
<tr><td class="paramname">res</td><td>reserved </td></tr>
<tr><td class="paramname">spi</td><td>security parameter index </td></tr>
<tr><td class="paramname">seq</td><td>sequence number </td></tr>
<tr><td class="paramname">auth</td><td>authentication data </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a277c0db9a61ea2d24b58b452df0edda0"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipsec_esp_ftr" ref="a277c0db9a61ea2d24b58b452df0edda0" args="(uint8_t len, uint8_t nh, int8_t *auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipsec_esp_ftr </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>nh</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int8_t * </td>
<td class="paramname"><em>auth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an Internet Protocol Security Encapsulating Security Payload footer. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">len</td><td>padding length </td></tr>
<tr><td class="paramname">nh</td><td>next header </td></tr>
<tr><td class="paramname">auth</td><td>authentication data </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ad75f92207cb45587e18e898b344c7600"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipsec_esp_hdr" ref="ad75f92207cb45587e18e898b344c7600" args="(uint32_t spi, uint32_t seq, uint32_t iv, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipsec_esp_hdr </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>spi</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>iv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an Internet Protocol Security Encapsulating Security Payload header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">spi</td><td>security parameter index </td></tr>
<tr><td class="paramname">seq</td><td>ESP sequence number </td></tr>
<tr><td class="paramname">iv</td><td>initialization vector </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a326cf29f24a37dc9232b8b6a56a3f12f"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv4" ref="a326cf29f24a37dc9232b8b6a56a3f12f" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipv4 </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>ip_len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>tos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>frag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ttl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>prot</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a version 4 RFC 791 Internet Protocol (IP) header.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">ip_len</td><td>total length of the IP packet including all subsequent data (subsequent data includes any IP options and IP options padding) </td></tr>
<tr><td class="paramname">tos</td><td>type of service bits </td></tr>
<tr><td class="paramname">id</td><td>IP identification number </td></tr>
<tr><td class="paramname">frag</td><td>fragmentation bits and offset </td></tr>
<tr><td class="paramname">ttl</td><td>time to live in the network </td></tr>
<tr><td class="paramname">prot</td><td>upper layer protocol </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">src</td><td>source IPv4 address (little endian) </td></tr>
<tr><td class="paramname">dst</td><td>destination IPv4 address (little endian) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="af1e1c66ed14370114d61ca919d558092"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv4_options" ref="af1e1c66ed14370114d61ca919d558092" args="(const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipv4_options </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>options</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>options_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an version 4 Internet Protocol (IP) options header. The function expects options to be a valid IP options string of size options_s, no larger than 40 bytes (the maximum size of an options string).</p>
<p>When building a chain, the options must be built, then the IPv4 header.</p>
<p>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.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">options</td><td>byte string of IP options (it will be padded up to be an integral multiple of 32-bit words). </td></tr>
<tr><td class="paramname">options_s</td><td>length of options string </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ae568214e9b386ca23e6628431eda1f7e"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6" ref="ae568214e9b386ca23e6628431eda1f7e" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipv6 </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>tc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>fl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>nh</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>hl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct libnet_in6_addr </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct libnet_in6_addr </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a version 6 RFC 2460 Internet Protocol (IP) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">tc</td><td>traffic class </td></tr>
<tr><td class="paramname">fl</td><td>flow label </td></tr>
<tr><td class="paramname">len</td><td>total length of the IP packet </td></tr>
<tr><td class="paramname">nh</td><td>next header </td></tr>
<tr><td class="paramname">hl</td><td>hop limit </td></tr>
<tr><td class="paramname">src</td><td>source IPv6 address </td></tr>
<tr><td class="paramname">dst</td><td>destination IPv6 address </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a463971e2d708f4e14f2ed9bea7f197be"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6_destopts" ref="a463971e2d708f4e14f2ed9bea7f197be" args="(uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipv6_destopts </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>nh</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a version 6 RFC 2460 Internet Protocol (IP) destination options header. This function is special in that it uses the payload interface to include the options data. The application programmer will build an IPv6 options byte string and pass it to the function using the payload interface. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">nh</td><td>next header </td></tr>
<tr><td class="paramname">len</td><td>length of the header in 8-byte octets not including the first 8 octets </td></tr>
<tr><td class="paramname">payload</td><td>options payload </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a16867e9f92b162ff4c00a5587fd3377d"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6_frag" ref="a16867e9f92b162ff4c00a5587fd3377d" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipv6_frag </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>nh</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>reserved</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>frag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">nh</td><td>next header </td></tr>
<tr><td class="paramname">reserved</td><td>unused value... OR IS IT! </td></tr>
<tr><td class="paramname">frag</td><td>fragmentation bits (ala ipv4) </td></tr>
<tr><td class="paramname">id</td><td>packet identification </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="accbcb7a6342997afd1a5410c7006f748"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6_hbhopts" ref="accbcb7a6342997afd1a5410c7006f748" args="(uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipv6_hbhopts </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>nh</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a version 6 RFC 2460 Internet Protocol (IP) hop by hop options header. This function is special in that it uses the payload interface to include the options data. The application programmer will build an IPv6 hop by hop options byte string and pass it to the function using the payload interface. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">nh</td><td>next header </td></tr>
<tr><td class="paramname">len</td><td>length of the header in 8-byte octets not including the first 8 octets </td></tr>
<tr><td class="paramname">payload</td><td>options payload </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a0aeda945e0b6d1ce4bee591107d8887b"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6_routing" ref="a0aeda945e0b6d1ce4bee591107d8887b" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ipv6_routing </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>nh</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>rtype</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>segments</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a version 6 RFC 2460 Internet Protocol (IP) routing header. This function is special in that it uses the payload interface to include the "type-specific data"; that is the routing information. Most often this will be a number of 128-bit IPv6 addresses. The application programmer will build a byte string of IPv6 address and pass them to the function using the payload interface. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">nh</td><td>next header </td></tr>
<tr><td class="paramname">len</td><td>length of the header in 8-byte octets not including the first 8 octets </td></tr>
<tr><td class="paramname">rtype</td><td>routing header type </td></tr>
<tr><td class="paramname">segments</td><td>number of routing segments that follow </td></tr>
<tr><td class="paramname">payload</td><td>optional payload of routing information </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a8c3b2833b869c4628240bb5be8b7c864"></a><!-- doxytag: member="libnet-functions.h::libnet_build_isl" ref="a8c3b2833b869c4628240bb5be8b7c864" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_isl </td>
<td>(</td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>dhost</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>user</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>shost</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>snap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>vid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>portindex</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>reserved</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a Cisco Inter-Switch Link (ISL) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dhost</td><td>destination address (should be 01:00:0c:00:00) </td></tr>
<tr><td class="paramname">type</td><td>type of frame </td></tr>
<tr><td class="paramname">user</td><td>user defined data </td></tr>
<tr><td class="paramname">shost</td><td>source mac address </td></tr>
<tr><td class="paramname">len</td><td>total length of the encapuslated packet less 18 bytes </td></tr>
<tr><td class="paramname">snap</td><td>SNAP information (0xaaaa03 + vendor code) </td></tr>
<tr><td class="paramname">vid</td><td>15 bit VLAN ID, 1 bit BPDU or CDP indicator </td></tr>
<tr><td class="paramname">portindex</td><td>port index </td></tr>
<tr><td class="paramname">reserved</td><td>used for FDDI and token ring </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a76a5b279a29e54057b1fb3e3786ce32f"></a><!-- doxytag: member="libnet-functions.h::libnet_build_link" ref="a76a5b279a29e54057b1fb3e3786ce32f" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_link </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>oui</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a link layer header for an initialized l. The function determines the proper link layer header format from how l was initialized. The function current supports Ethernet and Token Ring link layers. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dst</td><td>the destination MAC address </td></tr>
<tr><td class="paramname">src</td><td>the source MAC address </td></tr>
<tr><td class="paramname">oui</td><td>Organizationally Unique Identifier (unused for Ethernet) </td></tr>
<tr><td class="paramname">type</td><td>the upper layer protocol type </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ada1854f38dd301252fc97c93084ac4eb"></a><!-- doxytag: member="libnet-functions.h::libnet_build_mpls" ref="ada1854f38dd301252fc97c93084ac4eb" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_mpls </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>label</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>experimental</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>bos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ttl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">label</td><td>20-bit label value </td></tr>
<tr><td class="paramname">experimental</td><td>3-bit reserved field </td></tr>
<tr><td class="paramname">bos</td><td>1-bit bottom of stack identifier </td></tr>
<tr><td class="paramname">ttl</td><td>time to live </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a8a13581c5722c0ee77c2486465c10275"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ntp" ref="a8a13581c5722c0ee77c2486465c10275" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ntp </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>leap_indicator</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>mode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>stratum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>poll</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>precision</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>delay_int</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>delay_frac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>dispersion_int</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>dispersion_frac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>reference_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>ref_ts_int</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>ref_ts_frac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>orig_ts_int</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>orig_ts_frac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>rec_ts_int</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>rec_ts_frac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>xmt_ts_int</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>xmt_ts_frac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 958 Network Time Protocol (NTP) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">leap_indicator</td><td>the leap indicator </td></tr>
<tr><td class="paramname">version</td><td>NTP protocol version </td></tr>
<tr><td class="paramname">mode</td><td>NTP mode </td></tr>
<tr><td class="paramname">stratum</td><td>stratum </td></tr>
<tr><td class="paramname">poll</td><td>polling interval </td></tr>
<tr><td class="paramname">precision</td><td>precision </td></tr>
<tr><td class="paramname">delay_int</td><td>delay interval </td></tr>
<tr><td class="paramname">delay_frac</td><td>delay fraction </td></tr>
<tr><td class="paramname">dispersion_int</td><td>dispersion interval </td></tr>
<tr><td class="paramname">dispersion_frac</td><td>dispersion fraction </td></tr>
<tr><td class="paramname">reference_id</td><td>reference id </td></tr>
<tr><td class="paramname">ref_ts_int</td><td>reference timestamp integer </td></tr>
<tr><td class="paramname">ref_ts_frac</td><td>reference timestamp fraction </td></tr>
<tr><td class="paramname">orig_ts_int</td><td>original timestamp integer </td></tr>
<tr><td class="paramname">orig_ts_frac</td><td>original timestamp fraction </td></tr>
<tr><td class="paramname">rec_ts_int</td><td>receiver timestamp integer </td></tr>
<tr><td class="paramname">rec_ts_frac</td><td>reciever timestamp fraction </td></tr>
<tr><td class="paramname">xmt_ts_int</td><td>transmit timestamp integer </td></tr>
<tr><td class="paramname">xmt_ts_frac</td><td>transmit timestamp integer </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a215924e3d5c0cbcc4479579e45e60b58"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2" ref="a215924e3d5c0cbcc4479579e45e60b58" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2 </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>rtr_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>area_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>autype</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">len</td><td></td></tr>
<tr><td class="paramname">type</td><td></td></tr>
<tr><td class="paramname">rtr_id</td><td></td></tr>
<tr><td class="paramname">area_id</td><td></td></tr>
<tr><td class="paramname">sum</td><td></td></tr>
<tr><td class="paramname">autype</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a08a78bd747a22581c5ab036b73ca8867"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_dbd" ref="a08a78bd747a22581c5ab036b73ca8867" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_dbd </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>dgram_len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>opts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>seqnum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">dgram_len</td><td></td></tr>
<tr><td class="paramname">opts</td><td></td></tr>
<tr><td class="paramname">type</td><td></td></tr>
<tr><td class="paramname">seqnum</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="aff42a70a3b00a91d14200798d10889f2"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_hello" ref="aff42a70a3b00a91d14200798d10889f2" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_hello </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>netmask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>interval</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>opts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>priority</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>dead_int</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>des_rtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>bkup_rtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">netmask</td><td></td></tr>
<tr><td class="paramname">interval</td><td></td></tr>
<tr><td class="paramname">opts</td><td></td></tr>
<tr><td class="paramname">priority</td><td></td></tr>
<tr><td class="paramname">dead_int</td><td></td></tr>
<tr><td class="paramname">des_rtr</td><td></td></tr>
<tr><td class="paramname">bkup_rtr</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a611d140c425ab18996909be01e02f1c6"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa" ref="a611d140c425ab18996909be01e02f1c6" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_lsa </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>age</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>opts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>lsid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>advrtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>seqnum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">age</td><td></td></tr>
<tr><td class="paramname">opts</td><td></td></tr>
<tr><td class="paramname">type</td><td></td></tr>
<tr><td class="paramname">lsid</td><td></td></tr>
<tr><td class="paramname">advrtr</td><td></td></tr>
<tr><td class="paramname">seqnum</td><td></td></tr>
<tr><td class="paramname">sum</td><td></td></tr>
<tr><td class="paramname">len</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ab1a6927f757475cd9734772cc93779a7"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa_as" ref="ab1a6927f757475cd9734772cc93779a7" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_lsa_as </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>nmask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>metric</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>fwdaddr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>tag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">nmask</td><td></td></tr>
<tr><td class="paramname">metric</td><td></td></tr>
<tr><td class="paramname">fwdaddr</td><td></td></tr>
<tr><td class="paramname">tag</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a0e067929f1e1dfe92062603c6ba12e71"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa_net" ref="a0e067929f1e1dfe92062603c6ba12e71" args="(uint32_t nmask, uint rtrid, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_lsa_net </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>nmask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>rtrid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">nmask</td><td></td></tr>
<tr><td class="paramname">rtrid</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ad85342b88f62015f11c85e5b387af465"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa_rtr" ref="ad85342b88f62015f11c85e5b387af465" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_lsa_rtr </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>num</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>tos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>metric</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">flags</td><td></td></tr>
<tr><td class="paramname">num</td><td></td></tr>
<tr><td class="paramname">id</td><td></td></tr>
<tr><td class="paramname">data</td><td></td></tr>
<tr><td class="paramname">type</td><td></td></tr>
<tr><td class="paramname">tos</td><td></td></tr>
<tr><td class="paramname">metric</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="af3a2ccf97bfd42d3e4760ebf10d71fa5"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa_sum" ref="af3a2ccf97bfd42d3e4760ebf10d71fa5" args="(uint32_t nmask, uint metric, uint tos, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_lsa_sum </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>nmask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>metric</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>tos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">nmask</td><td></td></tr>
<tr><td class="paramname">metric</td><td></td></tr>
<tr><td class="paramname">tos</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a1cfa7596a2f85b2b7226d81fa47e7d39"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsr" ref="a1cfa7596a2f85b2b7226d81fa47e7d39" args="(uint type, uint lsid, uint32_t advrtr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_lsr </td>
<td>(</td>
<td class="paramtype">uint </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint </td>
<td class="paramname"><em>lsid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>advrtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td></td></tr>
<tr><td class="paramname">lsid</td><td></td></tr>
<tr><td class="paramname">advrtr</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a65617e2355459bc9ec2db6b979bee9d4"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsu" ref="a65617e2355459bc9ec2db6b979bee9d4" args="(uint num, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_ospfv2_lsu </td>
<td>(</td>
<td class="paramtype">uint </td>
<td class="paramname"><em>num</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">num</td><td></td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ad8e0469edf11477ccc3fc0b9cb031d00"></a><!-- doxytag: member="libnet-functions.h::libnet_build_rip" ref="ad8e0469edf11477ccc3fc0b9cb031d00" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_rip </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>cmd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>rd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>af</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>rt</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>addr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>mask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>next_hop</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>metric</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a Routing Information Protocol header (RFCs 1058 and 2453). </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">cmd</td><td>command </td></tr>
<tr><td class="paramname">version</td><td>protocol version </td></tr>
<tr><td class="paramname">rd</td><td>version one: 0, version two: routing domain </td></tr>
<tr><td class="paramname">af</td><td>address family </td></tr>
<tr><td class="paramname">rt</td><td>version one: 0, version two: route tag </td></tr>
<tr><td class="paramname">addr</td><td>IPv4 address </td></tr>
<tr><td class="paramname">mask</td><td>version one: 0, version two: subnet mask </td></tr>
<tr><td class="paramname">next_hop</td><td>version one: 0, version two: next hop address </td></tr>
<tr><td class="paramname">metric</td><td>routing metric </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a7bc36e79f132c1b7ff449e9df2a459b7"></a><!-- doxytag: member="libnet-functions.h::libnet_build_rpc_call" ref="a7bc36e79f132c1b7ff449e9df2a459b7" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_rpc_call </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>rm</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>xid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>prog_num</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>prog_vers</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>procedure</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>cflavor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>clength</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>cdata</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>vflavor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>vlength</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>vdata</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an Remote Procedure Call (Version 2) Call message header as specified in RFC 1831. This builder provides the option for specifying the record marking which is required when used with streaming protocols (TCP). </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">rm</td><td>record marking indicating the position in a stream, 0 otherwise </td></tr>
<tr><td class="paramname">xid</td><td>transaction identifier used to link calls and replies </td></tr>
<tr><td class="paramname">prog_num</td><td>remote program specification typically between 0 - 1fffffff </td></tr>
<tr><td class="paramname">prog_vers</td><td>remote program version specification </td></tr>
<tr><td class="paramname">procedure</td><td>procedure to be performed by remote program </td></tr>
<tr><td class="paramname">cflavor</td><td>authentication credential type </td></tr>
<tr><td class="paramname">clength</td><td>credential length (should be 0) </td></tr>
<tr><td class="paramname">cdata</td><td>opaque credential data (currently unused) </td></tr>
<tr><td class="paramname">vflavor</td><td>authentication verifier type </td></tr>
<tr><td class="paramname">vlength</td><td>verifier length (should be 0) </td></tr>
<tr><td class="paramname">vdata</td><td>opaque verifier data (currently unused) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a9a182529f97b05e9a2a5bd120f2f8456"></a><!-- doxytag: member="libnet-functions.h::libnet_build_sebek" ref="a9a182529f97b05e9a2a5bd120f2f8456" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_sebek </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>magic</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>counter</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>time_sec</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>time_usec</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>pid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>uid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>cmd</em>[SEBEK_CMD_LENGTH], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a Sebek header. The Sebek protocol was designed by the Honeynet Project as a transport mechanism for post-intrusion forensic data. More information may be found here: <a href="http://www.honeynet.org/papers/sebek.pdf.">http://www.honeynet.org/papers/sebek.pdf.</a> </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">magic</td><td>identify packets that should be hidden </td></tr>
<tr><td class="paramname">version</td><td>protocol version, currently 1 </td></tr>
<tr><td class="paramname">type</td><td>type of record (read data is type 0, write data is type 1) </td></tr>
<tr><td class="paramname">counter</td><td>PDU counter used to identify when packet are lost </td></tr>
<tr><td class="paramname">time_sec</td><td>seconds since EPOCH according to the honeypot </td></tr>
<tr><td class="paramname">time_usec</td><td>residual microseconds </td></tr>
<tr><td class="paramname">pid</td><td>PID </td></tr>
<tr><td class="paramname">uid</td><td>UID </td></tr>
<tr><td class="paramname">fd</td><td>FD </td></tr>
<tr><td class="paramname">cmd</td><td>12 first characters of the command </td></tr>
<tr><td class="paramname">length</td><td>length in bytes of the PDU's body </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a5051a29044af5ac103f6604ef8d480e5"></a><!-- doxytag: member="libnet-functions.h::libnet_build_stp_conf" ref="a5051a29044af5ac103f6604ef8d480e5" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_stp_conf </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>bpdu_type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>root_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>root_pc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>bridge_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>port_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>message_age</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>max_age</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>hello_time</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>f_delay</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IEEE 802.1d Spanning Tree Protocol (STP) configuration header. STP frames are usually encapsulated inside of an 802.2 + 802.3 frame combination. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">id</td><td>protocol id </td></tr>
<tr><td class="paramname">version</td><td>protocol version </td></tr>
<tr><td class="paramname">bpdu_type</td><td>bridge protocol data unit type </td></tr>
<tr><td class="paramname">flags</td><td>flags </td></tr>
<tr><td class="paramname">root_id</td><td>root id </td></tr>
<tr><td class="paramname">root_pc</td><td>root path cost </td></tr>
<tr><td class="paramname">bridge_id</td><td>bridge id </td></tr>
<tr><td class="paramname">port_id</td><td>port id </td></tr>
<tr><td class="paramname">message_age</td><td>message age </td></tr>
<tr><td class="paramname">max_age</td><td>max age </td></tr>
<tr><td class="paramname">hello_time</td><td>hello time </td></tr>
<tr><td class="paramname">f_delay</td><td>forward delay </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a20cda717c9254f73230b95f9eb808bc1"></a><!-- doxytag: member="libnet-functions.h::libnet_build_stp_tcn" ref="a20cda717c9254f73230b95f9eb808bc1" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_stp_tcn </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>bpdu_type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an IEEE 802.1d Spanning Tree Protocol (STP) topology change notification header. STP frames are usually encapsulated inside of an 802.2 + 802.3 frame combination. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">id</td><td>protocol id </td></tr>
<tr><td class="paramname">version</td><td>protocol version </td></tr>
<tr><td class="paramname">bpdu_type</td><td>bridge protocol data unit type </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a729cfdedc3e59a3152c99c914d66ec6f"></a><!-- doxytag: member="libnet-functions.h::libnet_build_tcp" ref="a729cfdedc3e59a3152c99c914d66ec6f" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_tcp </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>dp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>seq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>ack</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>control</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>win</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>urg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 793 Transmission Control Protocol (TCP) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">sp</td><td>source port </td></tr>
<tr><td class="paramname">dp</td><td>destination port </td></tr>
<tr><td class="paramname">seq</td><td>sequence number </td></tr>
<tr><td class="paramname">ack</td><td>acknowledgement number </td></tr>
<tr><td class="paramname">control</td><td>control flags </td></tr>
<tr><td class="paramname">win</td><td>window size </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">urg</td><td>urgent pointer </td></tr>
<tr><td class="paramname">len</td><td>total length of the TCP packet (for checksum calculation) </td></tr>
<tr><td class="paramname">payload</td><td></td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a11d0bd23cb198f3e940336b62a94839a"></a><!-- doxytag: member="libnet-functions.h::libnet_build_tcp_options" ref="a11d0bd23cb198f3e940336b62a94839a" args="(const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_tcp_options </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>options</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>options_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 793 Transmission Control Protocol (TCP) options header. The function expects options to be a valid TCP options string of size options_s, which is no larger than 40 bytes (the maximum size of an options string). The function checks to ensure that the packet consists of a TCP header preceded by an IPv4 header, and that the addition of the options string would not result in a packet larger than 65,535 bytes (IPMAXPACKET). The function counts up the number of 32-bit words in the options string and adjusts the TCP header length value as necessary. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">options</td><td>byte string of TCP options </td></tr>
<tr><td class="paramname">options_s</td><td>length of options string </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="aed08f26e3bc9afd750a3b515a8d83526"></a><!-- doxytag: member="libnet-functions.h::libnet_build_token_ring" ref="aed08f26e3bc9afd750a3b515a8d83526" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_token_ring </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>fc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>dsap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ssap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>cf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>oui</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds a token ring header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">ac</td><td>access control </td></tr>
<tr><td class="paramname">fc</td><td>frame control </td></tr>
<tr><td class="paramname">dst</td><td>destination address </td></tr>
<tr><td class="paramname">src</td><td>source address </td></tr>
<tr><td class="paramname">dsap</td><td>destination service access point </td></tr>
<tr><td class="paramname">ssap</td><td>source service access point </td></tr>
<tr><td class="paramname">cf</td><td>control field </td></tr>
<tr><td class="paramname">oui</td><td>Organizationally Unique Identifier </td></tr>
<tr><td class="paramname">type</td><td>upper layer protocol type </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a1dee17aa5276df3587ee276b1b90d8fa"></a><!-- doxytag: member="libnet-functions.h::libnet_build_udp" ref="a1dee17aa5276df3587ee276b1b90d8fa" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_udp </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>dp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 768 User Datagram Protocol (UDP) header. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">sp</td><td>source port </td></tr>
<tr><td class="paramname">dp</td><td>destination port </td></tr>
<tr><td class="paramname">len</td><td>total length of the UDP packet </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="a687daca40884d1125c4115ce215060f6"></a><!-- doxytag: member="libnet-functions.h::libnet_build_vrrp" ref="a687daca40884d1125c4115ce215060f6" args="(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)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_ptag_t libnet_build_vrrp </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>vrouter_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>priority</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>ip_count</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>auth_type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>advert_int</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>sum</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>payload</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>payload_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Builds an RFC 2338 Virtual Router Redundacy Protool (VRRP) header. Use the payload interface to specify address and autthentication information. To build a "legal" packet, the destination IPv4 address should be the multicast * address 224.0.0.18, the IP TTL should be set to 255, and the IP protocol should be set to 112. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">version</td><td>VRRP version (should be 2) </td></tr>
<tr><td class="paramname">type</td><td>VRRP packet type (should be 1 -- ADVERTISEMENT) </td></tr>
<tr><td class="paramname">vrouter_id</td><td>virtual router identification </td></tr>
<tr><td class="paramname">priority</td><td>priority (higher numbers indicate higher priority) </td></tr>
<tr><td class="paramname">ip_count</td><td>number of IPv4 addresses contained in this advertisement </td></tr>
<tr><td class="paramname">auth_type</td><td>type of authentication (0, 1, 2 -- see RFC) </td></tr>
<tr><td class="paramname">advert_int</td><td>interval between advertisements </td></tr>
<tr><td class="paramname">sum</td><td>checksum (0 for libnet to autofill) </td></tr>
<tr><td class="paramname">payload</td><td>optional payload or NULL </td></tr>
<tr><td class="paramname">payload_s</td><td>payload length or 0 </td></tr>
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl>
</div>
</div>
<a class="anchor" id="ab84889f7fe57a1801cf03eceac47463e"></a><!-- doxytag: member="libnet-functions.h::libnet_clear_packet" ref="ab84889f7fe57a1801cf03eceac47463e" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_clear_packet </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Clears the current packet referenced and frees all pblocks. Should be called when the programmer want to send a completely new packet of a different type using the same context. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a20887ffe940f1d2c5bcae79a188176c6"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_add" ref="a20887ffe940f1d2c5bcae79a188176c6" args="(libnet_t *l, char *label)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_cq_add </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>label</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Adds a new context to the libnet context queue. If no queue exists, this function will create the queue and add the specified libnet context as the first entry on the list. The functions checks to ensure niether l nor label are NULL, and that label doesn't refer to an existing context already in the queue. Additionally, l should refer to a libnet context previously initialized with a call to <a class="el" href="libnet-functions_8h.html#a0422723053baf0b254d1ba2215d88118">libnet_init()</a>. If the context queue in write locked, this function will fail. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">label</td><td>a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a565d99e292980d5033bef2d186596217"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_destroy" ref="a565d99e292980d5033bef2d186596217" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_cq_destroy </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Destroys the entire context queue, calling <a class="el" href="libnet-functions_8h.html#a591804711cffa92582703a5aedbd9b25">libnet_destroy()</a> on each member context. </p>
</div>
</div>
<a class="anchor" id="a127764f17e4457f96fb4b976a1666efa"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_end_loop" ref="a127764f17e4457f96fb4b976a1666efa" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t libnet_cq_end_loop </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] </p>
</div>
</div>
<a class="anchor" id="a0cd216f0e5563ee06043a8ebfa16fe57"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_find_by_label" ref="a0cd216f0e5563ee06043a8ebfa16fe57" args="(char *label)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_t* libnet_cq_find_by_label </td>
<td>(</td>
<td class="paramtype">char * </td>
<td class="paramname"><em>label</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Locates a libnet context from the queue, indexed by a canonical label. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">label</td><td>canonical label of the libnet context to retrieve </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the expected libnet context, NULL on failure </dd></dl>
</div>
</div>
<a class="anchor" id="abb1341d217de4d9c39ec484951e518b0"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_getlabel" ref="abb1341d217de4d9c39ec484951e518b0" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* libnet_cq_getlabel </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Returns the canonical label associated with the context. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>pointer to the libnet context's label </dd></dl>
</div>
</div>
<a class="anchor" id="a7e98a045ac6e29ca421507d9a200b5aa"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_head" ref="a7e98a045ac6e29ca421507d9a200b5aa" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_t* libnet_cq_head </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Intiailizes the interator interface and set a write lock on the entire queue. This function is intended to be called just prior to interating through the entire list of contexts (with the probable intent of inject a series of packets in rapid succession). This function is often used as per the following:</p>
<p>for (l = <a class="el" href="libnet-functions_8h.html#a7e98a045ac6e29ca421507d9a200b5aa">libnet_cq_head()</a>; <a class="el" href="libnet-functions_8h.html#aab1eb1e3ae64cde579a5a6035d5406c8">libnet_cq_last()</a>; l = <a class="el" href="libnet-functions_8h.html#ad312f3182e3e5367db87fc6bab32604d">libnet_cq_next()</a>) { ... }</p>
<p>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, <a class="el" href="libnet-macros_8h.html#af36eb84eee10c525720134cfadb50a3e">for_each_context_in_cq(l)</a>. Warning: do not call the iterator more than once in a single loop. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the head of the context queue </dd></dl>
</div>
</div>
<a class="anchor" id="aab1eb1e3ae64cde579a5a6035d5406c8"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_last" ref="aab1eb1e3ae64cde579a5a6035d5406c8" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_cq_last </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Check whether the iterator is at the last context in the queue. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 if at the end of the context queue, 0 otherwise </dd></dl>
</div>
</div>
<a class="anchor" id="ad312f3182e3e5367db87fc6bab32604d"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_next" ref="ad312f3182e3e5367db87fc6bab32604d" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_t* libnet_cq_next </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Get next context from the context queue. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the next context from the context queue </dd></dl>
</div>
</div>
<a class="anchor" id="a29f60504a0fe9b7bf6f5a962063118bb"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_remove" ref="a29f60504a0fe9b7bf6f5a962063118bb" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_t* libnet_cq_remove </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Removes a specified context from the libnet context queue by specifying the libnet context pointer. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to <a class="el" href="libnet-functions_8h.html#a591804711cffa92582703a5aedbd9b25">libnet_destroy()</a>. Also, as it is not necessary to keep the libnet context pointer when initially adding it to the context queue, most application programmers will prefer to refer to entries on the context queue by canonical name and would use <a class="el" href="libnet-functions_8h.html#a4e972664a0d839eab039f8fb2379987a">libnet_cq_remove_by_label()</a>. If the context queue is write locked, this function will fail. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the pointer to the removed libnet context, NULL on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a4e972664a0d839eab039f8fb2379987a"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_remove_by_label" ref="a4e972664a0d839eab039f8fb2379987a" args="(char *label)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_t* libnet_cq_remove_by_label </td>
<td>(</td>
<td class="paramtype">char * </td>
<td class="paramname"><em>label</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Removes a specified context from the libnet context queue by specifying the canonical name. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to <a class="el" href="libnet-functions_8h.html#a591804711cffa92582703a5aedbd9b25">libnet_destroy()</a>. If the context queue is write locked, this function will fail. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">label</td><td>canonical name of the context to remove </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the pointer to the removed libnet context, NULL on failure </dd></dl>
</div>
</div>
<a class="anchor" id="ad26ce874f56c59091f4811a7816400a8"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_size" ref="ad26ce874f56c59091f4811a7816400a8" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t libnet_cq_size </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Context Queue] Function returns the number of libnet contexts that are in the queue. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of libnet contexts currently in the queue </dd></dl>
</div>
</div>
<a class="anchor" id="a591804711cffa92582703a5aedbd9b25"></a><!-- doxytag: member="libnet-functions.h::libnet_destroy" ref="a591804711cffa92582703a5aedbd9b25" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_destroy </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Shuts down the libnet session referenced by l. It closes the network interface and frees all internal memory structures associated with l. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a3aa6623246e13310dc6f9f9834e7313b"></a><!-- doxytag: member="libnet-functions.h::libnet_diag_dump_context" ref="a3aa6623246e13310dc6f9f9834e7313b" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_diag_dump_context </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Diagnostic] Prints the contents of the given context. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="adb2f7d417f05a058c0c2c7f76b6f66e6"></a><!-- doxytag: member="libnet-functions.h::libnet_diag_dump_hex" ref="adb2f7d417f05a058c0c2c7f76b6f66e6" args="(const uint8_t *packet, uint32_t len, int swap, FILE *stream)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_diag_dump_hex </td>
<td>(</td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>packet</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>swap</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">FILE * </td>
<td class="paramname"><em>stream</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Diagnostic] Function prints the contents of the supplied buffer to the supplied stream pointer. Will swap endianness based disposition of mode variable. Useful to be used in conjunction with the advanced interface and a culled packet. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">packet</td><td>the packet to print </td></tr>
<tr><td class="paramname">len</td><td>length of the packet in bytes </td></tr>
<tr><td class="paramname">swap</td><td>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). </td></tr>
<tr><td class="paramname">stream</td><td>a stream pointer to print to </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9825c6c69efd6ef24545d59177a333e6"></a><!-- doxytag: member="libnet-functions.h::libnet_diag_dump_pblock" ref="a9825c6c69efd6ef24545d59177a333e6" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_diag_dump_pblock </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Diagnostic] Prints the contents of every pblock. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a57fed7106abf515c5883611eded7ad88"></a><!-- doxytag: member="libnet-functions.h::libnet_diag_dump_pblock_type" ref="a57fed7106abf515c5883611eded7ad88" args="(uint8_t type)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* libnet_diag_dump_pblock_type </td>
<td>(</td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>type</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>[Diagnostic] Returns the canonical name of the pblock type. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>pblock type </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a string representing the pblock type type or "unknown" for an unknown value </dd></dl>
</div>
</div>
<a class="anchor" id="a6531e479687de8d195bd1605422735ca"></a><!-- doxytag: member="libnet-functions.h::libnet_get_hwaddr" ref="a6531e479687de8d195bd1605422735ca" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct libnet_ether_addr* libnet_get_hwaddr </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td><code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the MAC address for the device libnet was initialized with. If libnet was initialized without a device the function will attempt to find one. If the function fails and returns NULL a call to <a class="el" href="libnet-functions_8h.html#a36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> will tell you why. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to the MAC address or NULL </dd></dl>
</div>
</div>
<a class="anchor" id="ae1981c8f0923176ecf484e9cd07fea15"></a><!-- doxytag: member="libnet-functions.h::libnet_get_ipaddr4" ref="ae1981c8f0923176ecf484e9cd07fea15" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t libnet_get_ipaddr4 </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the IP address for the device libnet was initialized with. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one. If the function fails and returns -1 a call to libnet_geterrror() will tell you why. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a big endian IP address suitable for use in a libnet_build function or -1 </dd></dl>
</div>
</div>
<a class="anchor" id="a3d7de8968c2087df7a22140d7993e267"></a><!-- doxytag: member="libnet-functions.h::libnet_get_ipaddr6" ref="a3d7de8968c2087df7a22140d7993e267" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct libnet_in6_addr libnet_get_ipaddr6 </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td><code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the IPv6 address for the device libnet was initialized with. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one. If the function fails and returns in6addr_error, a call to libnet_geterrror() will tell you why. This function is not yet implemented for Win32 platforms. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>well, nothing yet </dd></dl>
</div>
</div>
<a class="anchor" id="ab74bd339ef6343077dc79bab2063aee3"></a><!-- doxytag: member="libnet-functions.h::libnet_get_prand" ref="ab74bd339ef6343077dc79bab2063aee3" args="(int mod)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t libnet_get_prand </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>mod</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Generates an unsigned psuedo-random value within the range specified by mod. LIBNET_PR2 0 - 1 LIBNET_PR8 0 - 255 LIBNET_PR16 0 - 32767 LIBNET_PRu16 0 - 65535 LIBNET_PR32 0 - 2147483647 LIBNET_PRu32 0 - 4294967295</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">mod</td><td>one the of LIBNET_PR* constants </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a1e68365ece2c976a75bc50e91df40ea0"></a><!-- doxytag: member="libnet-functions.h::libnet_getdevice" ref="a1e68365ece2c976a75bc50e91df40ea0" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* libnet_getdevice </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the canonical name of the device used for packet injection. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the canonical name of the device used for packet injection. Note it can be NULL without being an error. </dd></dl>
</div>
</div>
<a class="anchor" id="a36c0b24a4926a8f5d9d392836e915f2e"></a><!-- doxytag: member="libnet-functions.h::libnet_geterror" ref="a36c0b24a4926a8f5d9d392836e915f2e" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* libnet_geterror </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the last error set inside of the referenced libnet context. This function should be called anytime a function fails or an error condition is detected inside of libnet. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>an error string or NULL if no error has occured </dd></dl>
</div>
</div>
<a class="anchor" id="ab9b137f454b3da05d4ac5fe388c1f2b8"></a><!-- doxytag: member="libnet-functions.h::libnet_getfd" ref="ab9b137f454b3da05d4ac5fe388c1f2b8" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_getfd </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the FILENO of the file descriptor used for packet injection. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the file number of the file descriptor used for packet injection </dd></dl>
</div>
</div>
<a class="anchor" id="a223c01dcaba5f098964342ef2737fd85"></a><!-- doxytag: member="libnet-functions.h::libnet_getgre_length" ref="a223c01dcaba5f098964342ef2737fd85" args="(uint16_t fv)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t libnet_getgre_length </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>fv</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">fv</td><td>see <a class="el" href="libnet-functions_8h.html#a8406f0a8d836df764bedd849ce24a14c">libnet_build_gre()</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>size, see <a class="el" href="libnet-functions_8h.html#a8406f0a8d836df764bedd849ce24a14c">libnet_build_gre()</a>. </dd></dl>
</div>
</div>
<a class="anchor" id="a2a500c6b60a329d873a970ecda4ff6e9"></a><!-- doxytag: member="libnet-functions.h::libnet_getpacket_size" ref="a2a500c6b60a329d873a970ecda4ff6e9" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t libnet_getpacket_size </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the sum of the size of all of the pblocks inside of l (this should be the resuling packet size). </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the size of the packet in l </dd></dl>
</div>
</div>
<a class="anchor" id="a37ac07877d74f4dad59b86a15f5318d8"></a><!-- doxytag: member="libnet-functions.h::libnet_getpbuf" ref="a37ac07877d74f4dad59b86a15f5318d8" args="(libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t* libnet_getpbuf </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the pblock buffer contents for the specified ptag; a subsequent call to <a class="el" href="libnet-functions_8h.html#a23ada8f4ab826966aeaf4ab070f3298e">libnet_getpbuf_size()</a> should be made to determine the size of the buffer. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>the ptag reference number </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to the pblock buffer or NULL on error </dd></dl>
</div>
</div>
<a class="anchor" id="a23ada8f4ab826966aeaf4ab070f3298e"></a><!-- doxytag: member="libnet-functions.h::libnet_getpbuf_size" ref="a23ada8f4ab826966aeaf4ab070f3298e" args="(libnet_t *l, libnet_ptag_t ptag)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t libnet_getpbuf_size </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the pblock buffer size for the specified ptag; a previous call to <a class="el" href="libnet-functions_8h.html#a37ac07877d74f4dad59b86a15f5318d8">libnet_getpbuf()</a> should be made to pull the actual buffer contents. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>the ptag reference number </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the size of the pblock buffer </dd></dl>
</div>
</div>
<a class="anchor" id="a0b668af5fd10b0a2879a9a0ea343dce4"></a><!-- doxytag: member="libnet-functions.h::libnet_hex_aton" ref="a0b668af5fd10b0a2879a9a0ea343dce4" args="(const char *s, int *len)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t* libnet_hex_aton </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Takes a colon separated hexidecimal address (from the command line) and returns a bytestring suitable for use in a libnet_build function. Note this function performs an implicit malloc and the return value should be freed after its use. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">s</td><td>the string to be parsed </td></tr>
<tr><td class="paramname">len</td><td>the resulting size of the returned byte string </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a byte string or NULL on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a917ef012eab1449bba7a0fd33438b292"></a><!-- doxytag: member="libnet-functions.h::libnet_in6_is_error" ref="a917ef012eab1449bba7a0fd33438b292" args="(struct libnet_in6_addr addr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_in6_is_error </td>
<td>(</td>
<td class="paramtype">struct libnet_in6_addr </td>
<td class="paramname"><em>addr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Check a libnet_in6_addr structure for identity with in6addr_error. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">addr</td><td>address to check </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 if addr is in6addr_error, 0 if it is not </dd></dl>
</div>
</div>
<a class="anchor" id="a0422723053baf0b254d1ba2215d88118"></a><!-- doxytag: member="libnet-functions.h::libnet_init" ref="a0422723053baf0b254d1ba2215d88118" args="(int injection_type, const char *device, char *err_buf)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libnet_t* libnet_init </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>injection_type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>device</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>err_buf</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates the libnet environment. It initializes the library and returns a libnet context. If the injection_type is LIBNET_LINK or LIBNET_LINK_ADV, the function initializes the injection primitives for the link-layer interface enabling the application programmer to build packets starting at the data-link layer (which also provides more granular control over the IP layer). If libnet uses the link-layer and the device argument is non-NULL, the function attempts to use the specified network device for packet injection. This is either a canonical string that references the device (such as "eth0" for a 100MB Ethernet card on Linux or "fxp0" for a 100MB Ethernet card on OpenBSD) or the dots and decimals representation of the device's IP address (192.168.0.1). If device is NULL, libnet attempts to find a suitable device to use. If the injection_type is LIBNET_RAW4 or LIBNET_RAW4_ADV, the function initializes the injection primitives for the IPv4 raw socket interface. The final argument, err_buf, should be a buffer of size LIBNET_ERRBUF_SIZE and holds an error message if the function fails. This function requires root privileges to execute successfully. Upon success, the function returns a valid libnet context for use in later function calls; upon failure, the function returns NULL. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">injection_type</td><td>packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV) </td></tr>
<tr><td class="paramname">device</td><td>the interface to use (NULL and libnet will choose one) </td></tr>
<tr><td class="paramname">err_buf</td><td>will contain an error message on failure </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>libnet context ready for use or NULL on error. </dd></dl>
</div>
</div>
<a class="anchor" id="a05a7f3f901c57be5aebfbd8b79416de9"></a><!-- doxytag: member="libnet-functions.h::libnet_name2addr4" ref="a05a7f3f901c57be5aebfbd8b79416de9" args="(libnet_t *l, char *host_name, uint8_t use_name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t libnet_name2addr4 </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>host_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>use_name</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv4 address. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">host_name</td><td>pointer to a string containing a presentation format host name </td></tr>
<tr><td class="paramname">use_name</td><td>LIBNET_RESOLVE or LIBNET_DONT_RESOLVE </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>network byte ordered IPv4 address or -1 (2^32 - 1) on error </dd></dl>
</div>
</div>
<a class="anchor" id="a69a216eb71e3309c787bd00507148d15"></a><!-- doxytag: member="libnet-functions.h::libnet_name2addr6" ref="a69a216eb71e3309c787bd00507148d15" args="(libnet_t *l, const char *host_name, uint8_t use_name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct libnet_in6_addr libnet_name2addr6 </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>host_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>use_name</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv6 address. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">host_name</td><td>pointer to a string containing a presentation format host name </td></tr>
<tr><td class="paramname">use_name</td><td>LIBNET_RESOLVE or LIBNET_DONT_RESOLVE </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>network byte ordered IPv6 address structure </dd></dl>
</div>
</div>
<a class="anchor" id="a39e332daa771627372a01867818b4301"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_dump" ref="a39e332daa771627372a01867818b4301" args="(libnet_plist_t *plist)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_plist_chain_dump </td>
<td>(</td>
<td class="paramtype">libnet_plist_t * </td>
<td class="paramname"><em>plist</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Runs through the port list and prints the contents of the port list chain list to stdout. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">plist</td><td>previously created portlist </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="ab854695d1306f9af440145fc6767d953"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_dump_string" ref="ab854695d1306f9af440145fc6767d953" args="(libnet_plist_t *plist)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* libnet_plist_chain_dump_string </td>
<td>(</td>
<td class="paramtype">libnet_plist_t * </td>
<td class="paramname"><em>plist</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Runs through the port list and prints the contents of the port list chain list to string. This function uses strdup and is not re-entrant. It also has a memory leak and should not really be used. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">plist</td><td>previously created portlist </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a printable string containing the port list contents on success NULL on error </dd></dl>
</div>
</div>
<a class="anchor" id="ab5cb1d70164207a7c279a909576058be"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_free" ref="ab5cb1d70164207a7c279a909576058be" args="(libnet_plist_t *plist)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_plist_chain_free </td>
<td>(</td>
<td class="paramtype">libnet_plist_t * </td>
<td class="paramname"><em>plist</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Frees all memory associated with port list chain. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">plist</td><td>previously created portlist </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="aaee8e5f54482bf3c9b7c5b101fa8f41f"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_new" ref="aaee8e5f54482bf3c9b7c5b101fa8f41f" args="(libnet_t *l, libnet_plist_t **plist, char *token_list)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_plist_chain_new </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_plist_t ** </td>
<td class="paramname"><em>plist</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>token_list</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a new port list. Port list chains are useful for TCP and UDP-based applications that need to send packets to a range of ports (contiguous or otherwise). The port list chain, which token_list points to, should contain a series of int8_tacters from the following list: "0123456789,-" of the general format "x - y, z", where "xyz" are port numbers between 0 and 65,535. plist points to the front of the port list chain list for use in further libnet_plist_chain() functions. Upon success, the function returns 1. Upon failure, the function returns -1 and <a class="el" href="libnet-functions_8h.html#a36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">plist</td><td>if successful, will refer to the portlist, if not, NULL </td></tr>
<tr><td class="paramname">token_list</td><td>string containing the port list primitive </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="aa4f1d2acd6b7411d3bf2be73cb617cb2"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_next_pair" ref="aa4f1d2acd6b7411d3bf2be73cb617cb2" args="(libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_plist_chain_next_pair </td>
<td>(</td>
<td class="paramtype">libnet_plist_t * </td>
<td class="paramname"><em>plist</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t * </td>
<td class="paramname"><em>bport</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t * </td>
<td class="paramname"><em>eport</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the next port list chain pair from the port list chain plist. bport and eport contain the starting port number and ending port number, respectively. Upon success, the function returns 1 and fills in the port variables; however, if the list is empty, the function returns 0 and sets both port variables to 0. Upon failure, the function returns -1. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">plist</td><td>previously created portlist </td></tr>
<tr><td class="paramname">bport</td><td>will contain the beginning port number or 0 </td></tr>
<tr><td class="paramname">eport</td><td>will contain the ending port number or 0 </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, 0 if empty, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a69470998be995ec8c5e11ecbb19137f5"></a><!-- doxytag: member="libnet-functions.h::libnet_seed_prand" ref="a69470998be995ec8c5e11ecbb19137f5" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_seed_prand </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Seeds the psuedo-random number generator. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a886dc359d6add4b0608e8611af7e1b35"></a><!-- doxytag: member="libnet-functions.h::libnet_stats" ref="a886dc359d6add4b0608e8611af7e1b35" args="(libnet_t *l, struct libnet_stats *ls)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void libnet_stats </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct libnet_stats * </td>
<td class="paramname"><em>ls</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Fills in a libnet_stats structure with packet injection statistics (packets written, bytes written, packet sending errors). </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ls</td><td>pointer to a libnet statistics structure </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ad36144707ce7994c12ef9d87dc9a2edf"></a><!-- doxytag: member="libnet-functions.h::libnet_toggle_checksum" ref="ad36144707ce7994c12ef9d87dc9a2edf" args="(libnet_t *l, libnet_ptag_t ptag, int mode)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_toggle_checksum </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">libnet_ptag_t </td>
<td class="paramname"><em>ptag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>mode</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>If a given protocol header is built with the checksum field set to "0", by default libnet will calculate the header checksum prior to injection. If the header is set to any other value, by default libnet will not calculate the header checksum. To over-ride this behavior, use <a class="el" href="libnet-functions_8h.html#ad36144707ce7994c12ef9d87dc9a2edf">libnet_toggle_checksum()</a>. Switches auto-checksumming on or off for the specified ptag. If mode is set to LIBNET_ON, libnet will mark the specificed ptag to calculate a checksum for the ptag prior to injection. This assumes that the ptag refers to a protocol that has a checksum field. If mode is set to LIBNET_OFF, libnet will clear the checksum flag and no checksum will be computed prior to injection. This assumes that the programmer will assign a value (zero or otherwise) to the checksum field. Often times this is useful if a precomputed checksum or some other predefined value is going to be used. Note that when libnet is initialized with LIBNET_RAW4, the IPv4 header checksum will always be computed by the kernel prior to injection, regardless of what the programmer sets. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
<tr><td class="paramname">ptag</td><td>the ptag reference number </td></tr>
<tr><td class="paramname">mode</td><td>LIBNET_ON or LIBNET_OFF </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl>
</div>
</div>
<a class="anchor" id="a5264b060183d307688780bf862fae37c"></a><!-- doxytag: member="libnet-functions.h::libnet_version" ref="a5264b060183d307688780bf862fae37c" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* libnet_version </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the version of libnet. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the libnet version </dd></dl>
</div>
</div>
<a class="anchor" id="a53375552efe95906e152152fc170cc0d"></a><!-- doxytag: member="libnet-functions.h::libnet_write" ref="a53375552efe95906e152152fc170cc0d" args="(libnet_t *l)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int libnet_write </td>
<td>(</td>
<td class="paramtype">libnet_t * </td>
<td class="paramname"><em>l</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Writes a prebuilt packet to the network. The function assumes that l was previously initialized (via a call to <a class="el" href="libnet-functions_8h.html#a0422723053baf0b254d1ba2215d88118">libnet_init()</a>) and that a previously constructed packet has been built inside this context (via one or more calls to the libnet_build* family of functions) and is ready to go. Depending on how libnet was initialized, the function will write the packet to the wire either via the raw or link layer interface. The function will also bump up the internal libnet stat counters which are retrievable via <a class="el" href="libnet-functions_8h.html#a886dc359d6add4b0608e8611af7e1b35">libnet_stats()</a>. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">l</td><td>pointer to a libnet context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of bytes written, -1 on error </dd></dl>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Thu Mar 29 2012 14:19:18 for libnet by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>