diff options
Diffstat (limited to 'unmerged')
174 files changed, 30124 insertions, 0 deletions
diff --git a/unmerged/debian/build-pkg b/unmerged/debian/build-pkg new file mode 100755 index 0000000..34c549e --- /dev/null +++ b/unmerged/debian/build-pkg @@ -0,0 +1,6 @@ +#!/bin/sh + +#V=`svn info . | grep Revision | sed -e's/.*: //'` +#sed -e"s/%SVNREVISION%/$V/" < debian/changelog.template > debian/changelog +dpkg-buildpackage -b -us -uc -rfakeroot -i -I.svn -I.swp + diff --git a/unmerged/debian/changelog b/unmerged/debian/changelog new file mode 100644 index 0000000..ea76c9c --- /dev/null +++ b/unmerged/debian/changelog @@ -0,0 +1,6 @@ +libnet (1.1.4) unstable; urgency=low + + * libnet-1.1.4. + + -- Sam Roberts <vieuxtech@gmail.com> Fri, 12 Jun 2009 11:27:14 -0800 + diff --git a/unmerged/debian/compat b/unmerged/debian/compat new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/unmerged/debian/compat @@ -0,0 +1 @@ +6 diff --git a/unmerged/debian/control b/unmerged/debian/control new file mode 100644 index 0000000..0e84fc0 --- /dev/null +++ b/unmerged/debian/control @@ -0,0 +1,85 @@ +Source: libnet +Section: net +Priority: optional +Maintainer: David Paleino <d.paleino@gmail.com> +Uploaders: Chris Hanson <cph@debian.org> +Build-Depends: debhelper, sharutils, libpcap-dev, quilt, + autotools-dev, automake, autoconf, libtool +Standards-Version: 3.8.0 +Homepage: http://www.packetfactory.net/libnet + +Package: libnet1 +Architecture: any +Section: libs +Depends: ${shlibs:Depends} +Description: library for the construction and handling of network packets + libnet provides a portable framework for low-level network packet + writing and handling. + . + libnet features portable packet creation interfaces at the IP layer + and link layer, as well as a host of supplementary functionality. + . + Using libnet, quick and simple packet assembly applications can be + whipped up with little effort. With a bit more time, more complex + programs can be written (Traceroute and ping were easily rewritten + using libnet and libpcap). + . + This package contains the shared library. + +Package: libnet1-dbg +Architecture: any +Priority: extra +Section: libs +Depends: ${shlibs:Depends}, libnet1 (= ${binary:Version}) +Description: debugging symbols for libnet + libnet provides a portable framework for low-level network packet + writing and handling. + . + libnet features portable packet creation interfaces at the IP layer + and link layer, as well as a host of supplementary functionality. + . + Using libnet, quick and simple packet assembly applications can be + whipped up with little effort. With a bit more time, more complex + programs can be written (Traceroute and ping were easily rewritten + using libnet and libpcap). + . + This package contains the debugging symbols for libnet. + +Package: libnet1-dev +Architecture: any +Section: libdevel +Provides: libnet-dev +Conflicts: libnet-dev +Depends: libc6-dev, libnet1 (= ${binary:Version}) +Description: development files for libnet + libnet provides a portable framework for low-level network packet + writing and handling. + . + libnet features portable packet creation interfaces at the IP layer + and link layer, as well as a host of supplementary functionality. + . + Using libnet, quick and simple packet assembly applications can be + whipped up with little effort. With a bit more time, more complex + programs can be written (Traceroute and ping were easily rewritten + using libnet and libpcap). + . + This package contains the files needed to compile and link programs + that use libnet. + +Package: libnet1-doc +Architecture: all +Section: doc +Suggests: libnet1-dev +Description: developers documentation files for libnet + libnet provides a portable framework for low-level network packet + writing and handling. + . + libnet features portable packet creation interfaces at the IP layer + and link layer, as well as a host of supplementary functionality. + . + Using libnet, quick and simple packet assembly applications can be + whipped up with little effort. With a bit more time, more complex + programs can be written (Traceroute and ping were easily rewritten + using libnet and libpcap). + . + This package contains the documentation files for developers. diff --git a/unmerged/debian/copyright b/unmerged/debian/copyright new file mode 100644 index 0000000..b776c81 --- /dev/null +++ b/unmerged/debian/copyright @@ -0,0 +1,234 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Upstream-Author: Mike D. Schiffman <mike@infonexus.com> +Packaged-By: Domenico Andreoli <cavok@debian.org> +Packaged-Date: Mon, 18 Nov 2002 23:53:40 +0100 +Original-Source-Location: http://www.packetfactory.net/libnet/ + +Files: debian/* +Copyright: © 2008, David Paleino <d.paleino@gmail.com> + © 2002-2008, Domenico Andreoli <cavok@debian.org> +License: BSD-2 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED.IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: include/bpf.h + include/win32/getopt.h + include/win32/in_systm.h + sample/win32/getopt.c +Copyright: © 1982-1997, The Regents of the University of California +License: BSD-4 + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +Files: include/ifaddrlist.h +Copyright: © 1997, The Regents of the University of California +License: BSD-3 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +Files: include/libnet/libnet-asn1.h +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1989, Carnegie Mellon University +License: BSD-2 | other + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: sample/bgp4* + sample/dns.c + sample/gre.c + sample/ip_link.c + sample/ip_raw.c + sample/sebek.c + sample/tftp.c + src/libnet_build_bgp.c + src/libnet_build_gre.c +Copyright: © 2003-2004 Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/icmp_redirect.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Alberto Ornaghi <alor@antifork.org> +License: BSD-2 + +Files: sample/icmp_timeexceed.c + src/libnet_build_sebek.c + src/libnet_cq.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/ospf* + src/libnet_build_ospf.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2000, Andrew Reiter <areiter@bindview.com> +License: BSD-2 + +Files: sample/ping_of_death.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2001, Dug Song <dugsong@monkey.org> +License: BSD-2 + +Files: srct/libnet_asn1.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1992, Carnegie Mellon University + © 1993-1996, 1998, The Regents of the University of California +License: BSD-3 | other +==> BSD-3 <== + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +==> other <== + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: src/libnet_build_fddi.c + src/libnet_build_rpc.c + src/libnet_build_token_ring.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © Jason Damron <jsdamron@hushmail.com> <jdamron@stackheap.org> +License: BSD-2 + +Files: src/libnet_build_ipsec.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2002, Jose Nazario <jose@crimelabs.net> +License: BSD-2 + +Files: src/libnet_build_link.c + src/libnet_write.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_dll.c +Copyright: © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_link_dlpi.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1993-1997, The Regents of the University of California + © Atanu Ghosh <atanu@cs.ucl.ac.uk>, University College London +License: BSD-3 + +Files: src/libnet_link_nit.c + src/libnet_link_none.c + src/libnet_link_pf.c + src/libnet_link_snoop.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. +License: BSD-3 + +Files: src/libnet_link_snit.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. + © 1989, Micky Liu <micky@cunixc.cc.columbia.edu>, Columbia University +License: BSD-3 + +Files: src/libnet_link_win32.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2001-2002, Don Bowman <don@sandvine.com> + © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: * +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> +License: BSD-2 diff --git a/unmerged/debian/files b/unmerged/debian/files new file mode 100644 index 0000000..faf8d48 --- /dev/null +++ b/unmerged/debian/files @@ -0,0 +1,4 @@ +libnet1_1.1.2.1-4._amd64.deb libs optional +libnet1-dbg_1.1.2.1-4._amd64.deb libs extra +libnet1-dev_1.1.2.1-4._amd64.deb libdevel optional +libnet1-doc_1.1.2.1-4._all.deb doc optional diff --git a/unmerged/debian/libnet-config.1 b/unmerged/debian/libnet-config.1 new file mode 100644 index 0000000..28b74ea --- /dev/null +++ b/unmerged/debian/libnet-config.1 @@ -0,0 +1,33 @@ +.\" Written by Domenico Andreoli for Debian GNU/Linux. +.\" Do whatever you want with this file. +.\" NO warranty is provided. +.TH libnet-config 1 "18 November 2002" "Libnet 1.1.0" "libnet-config manual" +.SH NAME +libnet-config \- Get information about a libnet installation +.SH SYNOPSIS +.B libnet-config [options] +.SH DESCRIPTION +.B libnet-config +displays information about a previous libnet installation. +.SH OPTIONS +.IP "--cflags" +Set of compiler options (CFLAGS) to use when compiling files that use +libnet. +.IP "--libs" +Shows the complete set of libs and other linker options you will need in order +to link your application with libnet. +.IP "--defines" +Set of compiler defines used to compile libnet. +.SH "EXAMPLES" +What linker options do I need when I link with libnet? + + libnet-config \-\-libs + +What compiler options do I need when I compile using libnet functions? + + libnet-config \-\-cflags +.SH SEE ALSO +.BR libnet (3) +.SH AUTHOR +This manual page was written by Domenico Andreoli <cavok@debian.org> +for the Debian GNU/Linux system (but may be used by others). diff --git a/unmerged/debian/libnet1-dbg/DEBIAN/control b/unmerged/debian/libnet1-dbg/DEBIAN/control new file mode 100644 index 0000000..6a4e9ed --- /dev/null +++ b/unmerged/debian/libnet1-dbg/DEBIAN/control @@ -0,0 +1,22 @@ +Package: libnet1-dbg +Source: libnet +Version: 1.1.2.1-4. +Architecture: amd64 +Maintainer: David Paleino <d.paleino@gmail.com> +Installed-Size: 356 +Depends: libnet1 (= 1.1.2.1-4.) +Section: libs +Priority: extra +Description: debugging symbols for libnet + libnet provides a portable framework for low-level network packet + writing and handling. + . + libnet features portable packet creation interfaces at the IP layer + and link layer, as well as a host of supplementary functionality. + . + Using libnet, quick and simple packet assembly applications can be + whipped up with little effort. With a bit more time, more complex + programs can be written (Traceroute and ping were easily rewritten + using libnet and libpcap). + . + This package contains the debugging symbols for libnet. diff --git a/unmerged/debian/libnet1-dbg/DEBIAN/md5sums b/unmerged/debian/libnet1-dbg/DEBIAN/md5sums new file mode 100644 index 0000000..dce8297 --- /dev/null +++ b/unmerged/debian/libnet1-dbg/DEBIAN/md5sums @@ -0,0 +1,4 @@ +2bb1a3c48e190c9e8b877b00729b0b66 usr/share/doc/libnet1-dbg/copyright +a65eb69d689ab766481cd36089be4a01 usr/share/doc/libnet1-dbg/changelog.Debian.gz +bb5f0c20d189bb0184e0dbb892768d32 usr/share/doc/libnet1-dbg/changelog.gz +1402dc537ba0c8fcf6a8f8a134a62e75 usr/lib/debug/usr/lib/libnet.so.1.5.0 diff --git a/unmerged/debian/libnet1-dbg/usr/lib/debug/usr/lib/libnet.so.1.5.0 b/unmerged/debian/libnet1-dbg/usr/lib/debug/usr/lib/libnet.so.1.5.0 Binary files differnew file mode 100644 index 0000000..08bf493 --- /dev/null +++ b/unmerged/debian/libnet1-dbg/usr/lib/debug/usr/lib/libnet.so.1.5.0 diff --git a/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/changelog.Debian.gz b/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/changelog.Debian.gz Binary files differnew file mode 100644 index 0000000..92759cd --- /dev/null +++ b/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/changelog.Debian.gz diff --git a/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/changelog.gz b/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/changelog.gz Binary files differnew file mode 100644 index 0000000..0f0c0f8 --- /dev/null +++ b/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/changelog.gz diff --git a/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/copyright b/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/copyright new file mode 100644 index 0000000..b776c81 --- /dev/null +++ b/unmerged/debian/libnet1-dbg/usr/share/doc/libnet1-dbg/copyright @@ -0,0 +1,234 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Upstream-Author: Mike D. Schiffman <mike@infonexus.com> +Packaged-By: Domenico Andreoli <cavok@debian.org> +Packaged-Date: Mon, 18 Nov 2002 23:53:40 +0100 +Original-Source-Location: http://www.packetfactory.net/libnet/ + +Files: debian/* +Copyright: © 2008, David Paleino <d.paleino@gmail.com> + © 2002-2008, Domenico Andreoli <cavok@debian.org> +License: BSD-2 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED.IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: include/bpf.h + include/win32/getopt.h + include/win32/in_systm.h + sample/win32/getopt.c +Copyright: © 1982-1997, The Regents of the University of California +License: BSD-4 + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +Files: include/ifaddrlist.h +Copyright: © 1997, The Regents of the University of California +License: BSD-3 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +Files: include/libnet/libnet-asn1.h +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1989, Carnegie Mellon University +License: BSD-2 | other + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: sample/bgp4* + sample/dns.c + sample/gre.c + sample/ip_link.c + sample/ip_raw.c + sample/sebek.c + sample/tftp.c + src/libnet_build_bgp.c + src/libnet_build_gre.c +Copyright: © 2003-2004 Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/icmp_redirect.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Alberto Ornaghi <alor@antifork.org> +License: BSD-2 + +Files: sample/icmp_timeexceed.c + src/libnet_build_sebek.c + src/libnet_cq.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/ospf* + src/libnet_build_ospf.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2000, Andrew Reiter <areiter@bindview.com> +License: BSD-2 + +Files: sample/ping_of_death.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2001, Dug Song <dugsong@monkey.org> +License: BSD-2 + +Files: srct/libnet_asn1.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1992, Carnegie Mellon University + © 1993-1996, 1998, The Regents of the University of California +License: BSD-3 | other +==> BSD-3 <== + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +==> other <== + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: src/libnet_build_fddi.c + src/libnet_build_rpc.c + src/libnet_build_token_ring.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © Jason Damron <jsdamron@hushmail.com> <jdamron@stackheap.org> +License: BSD-2 + +Files: src/libnet_build_ipsec.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2002, Jose Nazario <jose@crimelabs.net> +License: BSD-2 + +Files: src/libnet_build_link.c + src/libnet_write.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_dll.c +Copyright: © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_link_dlpi.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1993-1997, The Regents of the University of California + © Atanu Ghosh <atanu@cs.ucl.ac.uk>, University College London +License: BSD-3 + +Files: src/libnet_link_nit.c + src/libnet_link_none.c + src/libnet_link_pf.c + src/libnet_link_snoop.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. +License: BSD-3 + +Files: src/libnet_link_snit.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. + © 1989, Micky Liu <micky@cunixc.cc.columbia.edu>, Columbia University +License: BSD-3 + +Files: src/libnet_link_win32.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2001-2002, Don Bowman <don@sandvine.com> + © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: * +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> +License: BSD-2 diff --git a/unmerged/debian/libnet1-dev.README.Debian b/unmerged/debian/libnet1-dev.README.Debian new file mode 100644 index 0000000..a51106f --- /dev/null +++ b/unmerged/debian/libnet1-dev.README.Debian @@ -0,0 +1,31 @@ +Message received at 224674@bugs.debian.org: + +Date: Tue, 6 Jan 2004 17:13:04 +0100 +From: Enrico Zini <zinie@cs.unibo.it> + +... + + From what I've seen in the libnet mailing list, the current libnet +package still has documentation and function export issues: + + - if that function is only used internally, it should not be exported + in the header file + - the HTML documentation seems to refer to the old API of libnet + - I've later found out that the manpage suggests to create many libnet + contexts if one wants to create many packets at a time; although I + don't really like that idea, there is a documented way of doing it + and many packets can be created without using libnet_pblock_coalesce + - In the mailing list, sandr8 suggests to use libnet_adv_cull_packet(), + however that function is not documented in the manpage, but only as a + short comment in the header file, which doesn't tell how and if the + resulting packet should be deallocated + - In the mailing list, sandr8 and Mike Schiffman suggest using the + context queue interface, for which I haven't found any documented + overview on what its concepts are, but only the single functions + briefly documented in the header file + - Mike Schiffman also talks about initializing libnet with the ADVANCED + interface, but again I only found the LIBNET_????_ADV constants + briefly documented, with no overview on what the advanced mode is and + does + +... diff --git a/unmerged/debian/libnet1-dev.dirs b/unmerged/debian/libnet1-dev.dirs new file mode 100644 index 0000000..835e4d9 --- /dev/null +++ b/unmerged/debian/libnet1-dev.dirs @@ -0,0 +1,4 @@ +usr/lib +usr/include +usr/share/doc/libnet1-dev +usr/share/man/man3 diff --git a/unmerged/debian/libnet1-dev.install b/unmerged/debian/libnet1-dev.install new file mode 100644 index 0000000..8507350 --- /dev/null +++ b/unmerged/debian/libnet1-dev.install @@ -0,0 +1,5 @@ +usr/bin/libnet-config +usr/lib/libnet.a +usr/lib/libnet.la +usr/lib/libnet.so +usr/include diff --git a/unmerged/debian/libnet1-dev.manpages b/unmerged/debian/libnet1-dev.manpages new file mode 100644 index 0000000..a6f808a --- /dev/null +++ b/unmerged/debian/libnet1-dev.manpages @@ -0,0 +1,4 @@ +debian/libnet-config.1 +doc/man/man3/libnet-macros.h.3 +doc/man/man3/libnet.h.3 +doc/man/man3/libnet-functions.h.3 diff --git a/unmerged/debian/libnet1-dev/DEBIAN/control b/unmerged/debian/libnet1-dev/DEBIAN/control new file mode 100644 index 0000000..233a4bd --- /dev/null +++ b/unmerged/debian/libnet1-dev/DEBIAN/control @@ -0,0 +1,25 @@ +Package: libnet1-dev +Source: libnet +Version: 1.1.2.1-4. +Architecture: amd64 +Maintainer: David Paleino <d.paleino@gmail.com> +Installed-Size: 532 +Depends: libc6-dev, libnet1 (= 1.1.2.1-4.) +Conflicts: libnet-dev +Provides: libnet-dev +Section: libdevel +Priority: optional +Description: development files for libnet + libnet provides a portable framework for low-level network packet + writing and handling. + . + libnet features portable packet creation interfaces at the IP layer + and link layer, as well as a host of supplementary functionality. + . + Using libnet, quick and simple packet assembly applications can be + whipped up with little effort. With a bit more time, more complex + programs can be written (Traceroute and ping were easily rewritten + using libnet and libpcap). + . + This package contains the files needed to compile and link programs + that use libnet. diff --git a/unmerged/debian/libnet1-dev/DEBIAN/md5sums b/unmerged/debian/libnet1-dev/DEBIAN/md5sums new file mode 100644 index 0000000..7e01d45 --- /dev/null +++ b/unmerged/debian/libnet1-dev/DEBIAN/md5sums @@ -0,0 +1,18 @@ +2bb1a3c48e190c9e8b877b00729b0b66 usr/share/doc/libnet1-dev/copyright +00f3675766028e429750a39dd8a8b981 usr/share/doc/libnet1-dev/README.Debian +a65eb69d689ab766481cd36089be4a01 usr/share/doc/libnet1-dev/changelog.Debian.gz +bb5f0c20d189bb0184e0dbb892768d32 usr/share/doc/libnet1-dev/changelog.gz +2a1ab1608d140abf93f8886fa9a7dc96 usr/share/man/man3/libnet-macros.h.3.gz +8481ff2c776021bdfdea917d99468315 usr/share/man/man3/libnet-functions.h.3.gz +e2e472fed704f31561d9704d719fce66 usr/share/man/man3/libnet.h.3.gz +9d87f346ef84b037f8c156eae25ea79e usr/share/man/man1/libnet-config.1.gz +13fb4a04ca051b87d16a640ac771bd8b usr/include/libnet.h +9dba71f2b1e1563c175a8cdb024ef1f2 usr/include/libnet/libnet-macros.h +d39e78c8530a728981736e85e36b1968 usr/include/libnet/libnet-asn1.h +610bdd8a0a76158cbf3c29245c3c98f5 usr/include/libnet/libnet-headers.h +958376462512bfcf2dd739eb22345276 usr/include/libnet/libnet-types.h +9fea0a95834ab3d2ced801328b97eb37 usr/include/libnet/libnet-structures.h +e01c7cf8203771646d9757af8b924332 usr/include/libnet/libnet-functions.h +cde7cc80b81bc23bfbc2bc8c42db1595 usr/lib/libnet.a +28bb19ac693412d1521fca129c0f5dfd usr/lib/libnet.la +a96f38f2f5924ce3b1b362a5ced15e09 usr/bin/libnet-config diff --git a/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-asn1.h b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-asn1.h new file mode 100644 index 0000000..ea27356 --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-asn1.h @@ -0,0 +1,255 @@ +/* + * $Id: libnet-asn1.h,v 1.3 2004/01/17 07:51:19 mike Exp $ + * + * libnet-asn1.h - Network routine library ASN.1 header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Definitions for Abstract Syntax Notation One, ASN.1 + * As defined in ISO/IS 8824 and ISO/IS 8825 + * + * Copyright 1988, 1989 by Carnegie Mellon University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Copyright (c) 1998 - 2001 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __LIBNET_ASN1_H +#define __LIBNET_ASN1_H + +#ifndef EIGHTBIT_SUBIDS +typedef u_int32_t oid; +#define MAX_SUBID 0xFFFFFFFF +#else +typedef u_int8_t oid; +#define MAX_SUBID 0xFF +#endif + +#define MAX_OID_LEN 64 /* max subid's in an oid */ + +#define ASN_BOOLEAN (0x01) +#define ASN_INTEGER (0x02) +#define ASN_BIT_STR (0x03) +#define ASN_OCTET_STR (0x04) +#define ASN_NULL (0x05) +#define ASN_OBJECT_ID (0x06) +#define ASN_SEQUENCE (0x10) +#define ASN_SET (0x11) + +#define ASN_UNIVERSAL (0x00) +#define ASN_APPLICATION (0x40) +#define ASN_CONTEXT (0x80) +#define ASN_PRIVATE (0xC0) + +#define ASN_PRIMITIVE (0x00) +#define ASN_CONSTRUCTOR (0x20) + +#define ASN_LONG_LEN (0x80) +#define ASN_EXTENSION_ID (0x1F) +#define ASN_BIT8 (0x80) + +#define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR) +#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) = ASN_EXTENSION_ID) + +/* + * All of the build_asn1_* (build_asn1_length being an exception) functions + * take the same first 3 arguments: + * + * u_int8_t *data: This is a pointer to the start of the data object to be + * manipulated. + * int *datalen: This is a pointer to the number of valid bytes following + * "data". This should be not be exceeded in any function. + * Upon exiting a function, this value will reflect the + * changed "data" and then refer to the new number of valid + * bytes until the end of "data". + * u_int8_t type: The ASN.1 object type. + */ + + +/* + * Builds an ASN object containing an integer. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_int( + u_int8_t *, /* Pointer to the output buffer */ + int *, /* Number of valid bytes left in the buffer */ + u_int8_t, /* ASN object type */ + int32_t *, /* Pointer to a int32_t integer */ + int /* Size of a int32_t integer */ + ); + + +/* + * Builds an ASN object containing an unsigned integer. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_uint( + u_int8_t *, /* Pointer to the output buffer */ + int *, /* Number of valid bytes left in the buffer */ + u_int8_t, /* ASN object type */ + u_int32_t *, /* Pointer to an unsigned int32_t integer */ + int /* Size of a int32_t integer */ + ); + + +/* + * Builds an ASN object containing an octect string. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_string( + u_int8_t *, /* Pointer to the output buffer */ + int *, /* Number of valid bytes left in the buffer */ + u_int8_t, /* ASN object type */ + u_int8_t *, /* Pointer to a string to be built into an object */ + int /* Size of the string */ + ); + + +/* + * Builds an ASN header for an object with the ID and length specified. This + * only works on data types < 30, i.e. no extension octets. The maximum + * length is 0xFFFF; + * + * Returns a pointer to the first byte of the contents of this object or + * NULL upon error + */ + +u_int8_t * +libnet_build_asn1_header( + u_int8_t *, /* Pointer to the start of the object */ + int *, /* Number of valid bytes left in buffer */ + u_int8_t, /* ASN object type */ + int /* ASN object length */ + ); + + +u_int8_t * +libnet_build_asn1_length( + u_int8_t *, /* Pointer to start of object */ + int *, /* Number of valid bytes in buffer */ + int /* Length of object */ + ); + + +/* + * Builds an ASN header for a sequence with the ID and length specified. + * + * This only works on data types < 30, i.e. no extension octets. + * The maximum length is 0xFFFF; + * + * Returns a pointer to the first byte of the contents of this object. + * Returns NULL on any error. + */ + +u_int8_t * +libnet_build_asn1_sequence( + u_int8_t *, + int *, + u_int8_t, + int + ); + + +/* + * Builds an ASN object identifier object containing the input string. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_objid( + u_int8_t *, + int *, + u_int8_t, + oid *, + int + ); + + +/* + * Builds an ASN null object. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_null( + u_int8_t *, + int *, + u_int8_t + ); + + +/* + * Builds an ASN bitstring. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_bitstring( + u_int8_t *, + int *, + u_int8_t, + u_int8_t *, /* Pointer to the input buffer */ + int /* Length of the input buffer */ + ); + + +#endif /* __LIBNET_ASN1_H */ + +/* EOF */ diff --git a/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-functions.h b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-functions.h new file mode 100644 index 0000000..a9e18bb --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-functions.h @@ -0,0 +1,2287 @@ +/* + * $Id: libnet-functions.h,v 1.43 2004/11/09 07:05:07 mike Exp $ + * + * libnet-functions.h - function prototypes + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_FUNCTIONS_H +#define __LIBNET_FUNCTIONS_H +/** + * @file libnet-functions.h + * @brief libnet exported function prototypes + */ + +/** + * 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. + * @param injection_type packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV) + * @param device the interface to use (NULL and libnet will choose one) + * @param err_buf will contain an error message on failure + * @return libnet context ready for use or NULL on error. + */ +libnet_t * +libnet_init(int injection_type, char *device, char *err_buf); + +/** + * Shuts down the libnet session referenced by l. It closes the network + * interface and frees all internal memory structures associated with l. + * @param l pointer to a libnet context + */ +void +libnet_destroy(libnet_t *l); + +/** + * 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. + * @param l pointer to a libnet context + */ +void +libnet_clear_packet(libnet_t *l); + +/** + * Fills in a libnet_stats structure with packet injection statistics + * (packets written, bytes written, packet sending errors). + * @param l pointer to a libnet context + * @param ls pointer to a libnet statistics structure + */ +void +libnet_stats(libnet_t *l, struct libnet_stats *ls); + +/** + * Returns the FILENO of the file descriptor used for packet injection. + * @param l pointer to a libnet context + * @return the file number of the file descriptor used for packet injection + */ +int +libnet_getfd(libnet_t *l); + +/** + * Returns the canonical name of the device used for packet injection. + * @param l pointer to a libnet context + * @return the canonical name of the device used for packet injection. Note + * it can be NULL without being an error. + */ +const char * +libnet_getdevice(libnet_t *l); + +/** + * Returns the pblock buffer contents for the specified ptag; a + * subsequent call to libnet_getpbuf_size() should be made to determine the + * size of the buffer. + * @param l pointer to a libnet context + * @param ptag the ptag reference number + * @return a pointer to the pblock buffer or NULL on error + */ +u_int8_t * +libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag); + +/** + * Returns the pblock buffer size for the specified ptag; a + * previous call to libnet_getpbuf() should be made to pull the actual buffer + * contents. + * @param l pointer to a libnet context + * @param ptag the ptag reference number + * @return the size of the pblock buffer + */ +u_int32_t +libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param l pointer to a libnet context + * @return an error string or NULL if no error has occured + */ +char * +libnet_geterror(libnet_t *l); + +/** + * Returns the sum of the size of all of the pblocks inside of l (this should + * be the resuling packet size). + * @param l pointer to a libnet context + * @return the size of the packet in l + */ +u_int32_t +libnet_getpacket_size(libnet_t *l); + +/** + * Seeds the psuedo-random number generator. + * @param l pointer to a libnet context + * @return 1 on success, -1 on failure + */ +int +libnet_seed_prand(libnet_t *l); + +/** + * 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 + * + * @param mod one the of LIBNET_PR* constants + * @return 1 on success, -1 on failure + */ +u_int32_t +libnet_get_prand(int mod); + +/** + * 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 libnet_toggle_checksum(). + * 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. + * @param l pointer to a libnet context + * @param ptag the ptag reference number + * @param mode LIBNET_ON or LIBNET_OFF + * @return 1 on success, -1 on failure + */ +int +libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode); + +/** + * 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. + * @param in network byte ordered IPv4 address + * @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE + * @return a pointer to presentation format string + */ +char * +libnet_addr2name4(u_int32_t in, u_int8_t use_name); + +/** + * 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. + * @param l pointer to a libnet context + * @param host_name pointer to a string containing a presentation format host + * name + * @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE + * @return network byte ordered IPv4 address or -1 (2^32 - 1) on error + */ +u_int32_t +libnet_name2addr4(libnet_t *l, char *host_name, u_int8_t use_name); + +extern const struct libnet_in6_addr in6addr_error; + +/** + * 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. + * @param l pointer to a libnet context + * @param host_name pointer to a string containing a presentation format host + * name + * @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE + * @return network byte ordered IPv6 address structure + */ +struct libnet_in6_addr +libnet_name2addr6(libnet_t *l, char *host_name, u_int8_t use_name); + +/** + * Should document this baby right here. + */ +void +libnet_addr2name6_r(struct libnet_in6_addr addr, u_int8_t use_name, +char *host_name, int host_name_len); + +/** + * 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 libnet_geterror() can tell you + * why. + * @param l pointer to a libnet context + * @param plist if successful, will refer to the portlist, if not, NULL + * @param token_list string containing the port list primitive + * @return 1 on success, -1 on failure + */ +int +libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list); + +/** + * 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. + * @param plist previously created portlist + * @param bport will contain the beginning port number or 0 + * @param eport will contain the ending port number or 0 + * @return 1 on success, 0 if empty, -1 on failure + */ +int +libnet_plist_chain_next_pair(libnet_plist_t *plist, u_int16_t *bport, +u_int16_t *eport); + +/** + * Runs through the port list and prints the contents of the port list chain + * list to stdout. + * @param plist previously created portlist + * @return 1 on success, -1 on failure + */ +int +libnet_plist_chain_dump(libnet_plist_t *plist); + +/** + * 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. + * @param plist previously created portlist + * @return a printable string containing the port list contents on success + * NULL on error + */ +char * +libnet_plist_chain_dump_string(libnet_plist_t *plist); + +/** + * Frees all memory associated with port list chain. + * @param plist previously created portlist + * @return 1 on success, -1 on failure + */ +int +libnet_plist_chain_free(libnet_plist_t *plist); + +/** + * @section PBF Packet Builder Functions + * + * The core of libnet is the platform-independent packet-building + * functionality. These functions enable an application programmer to build + * protocol headers (and data) in a simple and consistent manner without having + * to worry (too much) about low-level network odds and ends. Each + * libnet_build() function builds a piece of a packet (generally a protocol + * header). While it is perfectly possible to build an entire, + * ready-to-transmit packet with a single call to a libnet_build() function, + * generally more than one builder-class function call is required to construct + * a full packet. A complete wire-ready packet generally consists of more than + * one piece. + * Every function that builds a protocol header takes a series of arguments + * roughly corresponding to the header values as they appear on the wire. This + * process is intuitive but often makes for functions with huge prototypes and + * large stack frames. + * One important thing to note is that you must call these functions in order, + * corresponding to how they should appear on the wire (from the highest + * protocol layer on down). This building process is intuitive; it approximates + * what happens in an operating system kernel. In other words, to build a + * Network Time Protocol (NTP) packet by using the link-layer interface, the + * application programmer would call the libnet_build() functions in the + * following order: + * 1. libnet_build_ntp() + * 2. libnet_build_udp() + * 3. libnet_build_ipv4() + * 4. libnet_build_ethernet() + * This ordering is essential for libnet 1.1.x to properly link together the + * packet internally (previous libnet versions did not have the requirement). + * + * @subsection TPI The Payload Interface + * + * The payload interface specifies an optional way to include data directly + * after the protocol header in question. You can use this function for a + * variety of purposes, including the following: + * - Including additional or arbitrary protocol header information that is not + * available from a libnet interface + * - Including a packet payload (data segment) + * - Building another protocol header that is not available from a libnet + * interface + * To employ the interface, the application programmer should construct the i + * payload data and pass a u_int8_t * to this data and its size to the desired + * libnet_build() function. Libnet handles the rest. + * + * It is important to note that some functions (notably the IPv6 builders) do + * use the payload interface to specify variable length but ostensibly + * non-optional data. See the individual libnet_build_ipv6*() functions for + * more information. + * + * @subsection PT Protocol Tags and Packet Builder Return Values + * + * Libnet uses the protocol tag (ptag) to identify individual pieces of a + * packet after being created. A new ptag results every time a libnet_build() + * function with an empty (0) ptag argument completes successfully. This new + * ptag now refers to the packet piece just created. The application + * programmer's responsibility is to save this value if he or she plans to + * modify this particular portion later on in the program. If the application + * programmer needs to modify some portion of that particular packet piece + * again, he or she calls the same libnet_build() function specifying the + * saved ptag argument. Libnet then searches for that packet piece and modifies + * it rather than creating a new one. Upon failure for any reason, + * libnet_build() functions return -1; libnet_geterror() tells you why. + */ + +/** + * Builds an IEEE 802.1q VLAN tagging header. Depending on the value of + * len_proto, the function wraps the 802.1q header inside either an IEEE 802.3 + * header or an RFC 894 Ethernet II (DIX) header (both resulting in an 18-byte + * frame). If len is 1500 or less, most receiving protocol stacks parse the + * frame as an IEEE 802.3 encapsulated frame. If len is one of the Ethernet type + * values, most protocol stacks parse the frame as an RFC 894 Ethernet II + * encapsulated frame. Note the length value is calculated without the 802.1q + * header of 18 bytes. + * @param dst pointer to a six byte source ethernet address + * @param src pointer to a six byte destination ethernet address + * @param tpi tag protocol identifier + * @param priority priority + * @param cfi canonical format indicator + * @param vlan_id vlan identifier + * @param len_proto length (802.3) protocol (Ethernet II) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_1q(u_int8_t *dst, u_int8_t *src, u_int16_t tpi, +u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IEEE 802.1x extended authentication protocol header. + * @param eap_ver the EAP version + * @param eap_type the EAP type + * @param length frame length + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_1x(u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IEEE 802.2 LLC header. + * @param dsap destination service access point + * @param ssap source service access point + * @param control control field + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_2(u_int8_t dsap, u_int8_t ssap, u_int8_t control, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IEEE 802.2 LLC SNAP header. + * @param dsap destination service access point + * @param ssap source service access point + * @param control control field + * @param oui Organizationally Unique Identifier + * @param type upper layer protocol + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_2snap(u_int8_t dsap, u_int8_t ssap, u_int8_t control, +u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst destination ethernet address + * @param src source ethernet address + * @param len frame length sans header + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_3(u_int8_t *dst, u_int8_t *src, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst destination ethernet address + * @param src source ethernet address + * @param type upper layer protocol type + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ethernet(u_int8_t *dst, u_int8_t *src, u_int16_t type, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst destination ethernet address + * @param type upper layer protocol type + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_ethernet(u_int8_t *dst, u_int16_t type, libnet_t *l); + +/** + * Builds a Fiber Distributed Data Interface (FDDI) header. + * @param fc class format and priority + * @param dst destination fddi address + * @param src source fddi address + * @param dsap destination service access point + * @param ssap source service access point + * @param cf cf + * @param oui 3 byte IEEE organizational code + * @param type upper layer protocol + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_fddi(u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, +u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Autobuilds a Fiber Distributed Data Interface (FDDI) header. + * @param fc class format and priority + * @param dst destination fddi address + * @param dsap destination service access point + * @param ssap source service access point + * @param cf cf + * @param oui IEEE organizational code + * @param type upper layer protocol + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_fddi(u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, +u_int8_t cf, u_int8_t *oui, u_int16_t type, libnet_t *l); + +/** + * 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. + * @param hrd hardware address format + * @param pro protocol address format + * @param hln hardware address length + * @param pln protocol address length + * @param op ARP operation type + * @param sha sender's hardware address + * @param spa sender's protocol address + * @param tha target hardware address + * @param tpa targer protocol address + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_arp(u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, +u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param op ARP operation type + * @param sha sender's hardware address + * @param spa sender's protocol address + * @param tha target hardware address + * @param tpa targer protocol address + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_arp(u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, +u_int8_t *tpa, libnet_t *l); + +/** + * Builds an RFC 793 Transmission Control Protocol (TCP) header. + * @param sp source port + * @param dp destination port + * @param seq sequence number + * @param ack acknowledgement number + * @param control control flags + * @param win window size + * @param sum checksum (0 for libnet to autofill) + * @param urg urgent pointer + * @param len total length of the TCP packet (for checksum calculation) + * @param payload + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_tcp(u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, +u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param options byte string of TCP options + * @param options_s length of options string + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_tcp_options(u_int8_t *options, u_int32_t options_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * Builds an RFC 768 User Datagram Protocol (UDP) header. + * @param sp source port + * @param dp destination port + * @param len total length of the UDP packet + * @param sum checksum (0 for libnet to autofill) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_udp(u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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 libnet_build_data() to construct them. + * @param version CDP version + * @param ttl time to live (time information should be cached by recipient) + * @param sum checksum (0 for libnet to autofill) + * @param type type of data contained in value + * @param len length of value arugment + * @param value the CDP information string + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_cdp(u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, +u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) + * echo request/reply header + * @param type type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO) + * @param code code of ICMP packet (should be 0) + * @param sum checksum (0 for libnet to autofill) + * @param id identification number + * @param seq packet sequence number + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_echo(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int16_t id, u_int16_t seq, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) + * IP netmask request/reply header. + * @param type type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY) + * @param code code of ICMP packet (should be 0) + * @param sum checksum (0 for libnet to autofill) + * @param id identification number + * @param seq packet sequence number + * @param mask subnet mask + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_mask(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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 libnet_build_ipv4(). + * @param type type of ICMP packet (should be ICMP_UNREACH) + * @param code code of ICMP packet (should be one of the 16 unreachable codes) + * @param sum checksum (0 for libnet to autofill) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_unreach(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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 libnet_build_ipv4(). + * @param type type of ICMP packet (should be ICMP_REDIRECT) + * @param code code of ICMP packet (should be one of the four redirect codes) + * @param sum checksum (0 for libnet to autofill) + * @param gateway + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_redirect(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int32_t gateway, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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 libnet_build_ipv4(). + * @param type type of ICMP packet (should be ICMP_TIMXCEED) + * @param code code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS) + * @param sum checksum (0 for libnet to autofill) + * @param payload optional payload or NULL + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_timeexceed(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) + * timestamp request/reply header. + * @param type type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY) + * @param code code of ICMP packet (should be 0) + * @param sum checksum (0 for libnet to autofill) + * @param id identification number + * @param seq sequence number + * @param otime originate timestamp + * @param rtime receive timestamp + * @param ttime transmit timestamp + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_timestamp(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header. + * @param type packet type + * @param code packet code (should be 0) + * @param sum checksum (0 for libnet to autofill) + * @param ip IPv4 address + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_igmp(u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a version 4 RFC 791 Internet Protocol (IP) header. + * + * @param ip_len total length of the IP packet including all subsequent data (subsequent + * data includes any IP options and IP options padding) + * @param tos type of service bits + * @param id IP identification number + * @param frag fragmentation bits and offset + * @param ttl time to live in the network + * @param prot upper layer protocol + * @param sum checksum (0 for libnet to autofill) + * @param src source IPv4 address (little endian) + * @param dst destination IPv4 address (little endian) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv4(u_int16_t ip_len, u_int8_t tos, u_int16_t id, u_int16_t frag, +u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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). + * + * When building a chain, the options must be built, then the IPv4 header. + * + * When updating a chain, if the block following the options is an IPv4 header, + * it's total length and header length will be updated if the options block + * size changes. + * + * @param options byte string of IP options (it will be padded up to be an integral + * multiple of 32-bit words). + * @param options_s length of options string + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv4_options(u_int8_t *options, u_int32_t options_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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 + * libnet_build_ipv4(). 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. + * @param len total length of the IP packet including all subsequent data + * @param prot upper layer protocol + * @param dst destination IPv4 address (little endian) + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_ipv4(u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t *l); + +/** + * Builds a version 6 RFC 2460 Internet Protocol (IP) header. + * @param tc traffic class + * @param fl flow label + * @param len total length of the IP packet + * @param nh next header + * @param hl hop limit + * @param src source IPv6 address + * @param dst destination IPv6 address + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6(u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, +u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header. + * @param nh next header + * @param reserved unused value... OR IS IT! + * @param frag fragmentation bits (ala ipv4) + * @param id packet identification + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6_frag(u_int8_t nh, u_int8_t reserved, u_int16_t frag, +u_int32_t id, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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. + * @param nh next header + * @param len length of the header in 8-byte octets not including the first 8 octets + * @param rtype routing header type + * @param segments number of routing segments that follow + * @param payload optional payload of routing information + * @param payload_s payload length + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6_routing(u_int8_t nh, u_int8_t len, u_int8_t rtype, +u_int8_t segments, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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. + * @param nh next header + * @param len length of the header in 8-byte octets not including the first 8 octets + * @param payload options payload + * @param payload_s payload length + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6_destopts(u_int8_t nh, u_int8_t len, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param nh next header + * @param len length of the header in 8-byte octets not including the first 8 octets + * @param payload options payload + * @param payload_s payload length + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6_hbhopts(u_int8_t nh, u_int8_t len, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * This function is not yet implement and is a NOOP. + * @param len length + * @param nh next header + * @param dst destination IPv6 address + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_ipv6(u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, +libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a Cisco Inter-Switch Link (ISL) header. + * @param dhost destination address (should be 01:00:0c:00:00) + * @param type type of frame + * @param user user defined data + * @param shost source mac address + * @param len total length of the encapuslated packet less 18 bytes + * @param snap SNAP information (0xaaaa03 + vendor code) + * @param vid 15 bit VLAN ID, 1 bit BPDU or CDP indicator + * @param portindex port index + * @param reserved used for FDDI and token ring + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_isl(u_int8_t *dhost, u_int8_t type, u_int8_t user, +u_int8_t *shost, u_int16_t len, u_int8_t *snap, u_int16_t vid, +u_int16_t portindex, u_int16_t reserved, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an Internet Protocol Security Encapsulating Security Payload header. + * @param spi security parameter index + * @param seq ESP sequence number + * @param iv initialization vector + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipsec_esp_hdr(u_int32_t spi, u_int32_t seq, u_int32_t iv, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an Internet Protocol Security Encapsulating Security Payload footer. + * @param len padding length + * @param nh next header + * @param auth authentication data + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipsec_esp_ftr(u_int8_t len, u_int8_t nh, int8_t *auth, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an Internet Protocol Security Authentication header. + * @param nh next header + * @param len payload length + * @param res reserved + * @param spi security parameter index + * @param seq sequence number + * @param auth authentication data + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipsec_ah(u_int8_t nh, u_int8_t len, u_int16_t res, +u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an RFC 1035 version 4 DNS header. Additional DNS payload information + * should be specified using the payload interface. + * @param h_len + * @param id DNS packet id + * @param flags control flags + * @param num_q number of questions + * @param num_anws_rr number of answer resource records + * @param num_auth_rr number of authority resource records + * @param num_addi_rr number of additional resource records + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_dnsv4(u_int16_t h_len, u_int16_t id, u_int16_t flags, +u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, +u_int16_t num_addi_rr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * Builds a Routing Information Protocol header (RFCs 1058 and 2453). + * @param cmd command + * @param version protocol version + * @param rd version one: 0, version two: routing domain + * @param af address family + * @param rt version one: 0, version two: route tag + * @param addr IPv4 address + * @param mask version one: 0, version two: subnet mask + * @param next_hop version one: 0, version two: next hop address + * @param metric routing metric + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_rip(u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, +u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, +u_int32_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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). + * @param rm record marking indicating the position in a stream, 0 otherwise + * @param xid transaction identifier used to link calls and replies + * @param prog_num remote program specification typically between 0 - 1fffffff + * @param prog_vers remote program version specification + * @param procedure procedure to be performed by remote program + * @param cflavor authentication credential type + * @param clength credential length (should be 0) + * @param cdata opaque credential data (currently unused) + * @param vflavor authentication verifier type + * @param vlength verifier length (should be 0) + * @param vdata opaque verifier data (currently unused) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_rpc_call(u_int32_t rm, u_int32_t xid, u_int32_t prog_num, +u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, +u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param id protocol id + * @param version protocol version + * @param bpdu_type bridge protocol data unit type + * @param flags flags + * @param root_id root id + * @param root_pc root path cost + * @param bridge_id bridge id + * @param port_id port id + * @param message_age message age + * @param max_age max age + * @param hello_time hello time + * @param f_delay forward delay + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_stp_conf(u_int16_t id, u_int8_t version, u_int8_t bpdu_type, +u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id, +u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, +u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param id protocol id + * @param version protocol version + * @param bpdu_type bridge protocol data unit type + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_stp_tcn(u_int16_t id, u_int8_t version, u_int8_t bpdu_type, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a token ring header. + * @param ac access control + * @param fc frame control + * @param dst destination address + * @param src source address + * @param dsap destination service access point + * @param ssap source service access point + * @param cf control field + * @param oui Organizationally Unique Identifier + * @param type upper layer protocol type + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_token_ring(u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, +u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Auto-builds a token ring header. + * @param ac access control + * @param fc frame control + * @param dst destination address + * @param dsap destination service access point + * @param ssap source service access point + * @param cf control field + * @param oui Organizationally Unique Identifier + * @param type upper layer protocol type + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_token_ring(u_int8_t ac, u_int8_t fc, u_int8_t *dst, +u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, +libnet_t *l); + +/** + * 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. + * @param version VRRP version (should be 2) + * @param type VRRP packet type (should be 1 -- ADVERTISEMENT) + * @param vrouter_id virtual router identification + * @param priority priority (higher numbers indicate higher priority) + * @param ip_count number of IPv4 addresses contained in this advertisement + * @param auth_type type of authentication (0, 1, 2 -- see RFC) + * @param advert_int interval between advertisements + * @param sum checksum (0 for libnet to autofill) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_vrrp(u_int8_t version, u_int8_t type, u_int8_t vrouter_id, +u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, +u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header. + * @param label 20-bit label value + * @param experimental 3-bit reserved field + * @param bos 1-bit bottom of stack identifier + * @param ttl time to live + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_mpls(u_int32_t label, u_int8_t experimental, u_int8_t bos, +u_int8_t ttl, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * Builds an RFC 958 Network Time Protocol (NTP) header. + * @param leap_indicator the leap indicator + * @param version NTP protocol version + * @param mode NTP mode + * @param stratum stratum + * @param poll polling interval + * @param precision precision + * @param delay_int delay interval + * @param delay_frac delay fraction + * @param dispersion_int dispersion interval + * @param dispersion_frac dispersion fraction + * @param reference_id reference id + * @param ref_ts_int reference timestamp integer + * @param ref_ts_frac reference timestamp fraction + * @param orig_ts_int original timestamp integer + * @param orig_ts_frac original timestamp fraction + * @param rec_ts_int receiver timestamp integer + * @param rec_ts_frac reciever timestamp fraction + * @param xmt_ts_int transmit timestamp integer + * @param xmt_ts_frac transmit timestamp integer + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ntp(u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, +u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, +u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, +u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, +u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, +u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param len + * @param type + * @param rtr_id + * @param area_id + * @param sum + * @param autype + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2(u_int16_t len, u_int8_t type, u_int32_t rtr_id, +u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param netmask + * @param interval + * @param opts + * @param priority + * @param dead_int + * @param des_rtr + * @param bkup_rtr + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_hello(u_int32_t netmask, u_int16_t interval, u_int8_t opts, +u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param dgram_len + * @param opts + * @param type + * @param seqnum + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_dbd(u_int16_t dgram_len, u_int8_t opts, u_int8_t type, +u_int seqnum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * @param type + * @param lsid + * @param advrtr + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsr(u_int type, u_int lsid, u_int32_t advrtr, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param num + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsu(u_int num, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * @param age + * @param opts + * @param type + * @param lsid + * @param advrtr + * @param seqnum + * @param sum + * @param len + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa(u_int16_t age, u_int8_t opts, u_int8_t type, +u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param flags + * @param num + * @param id + * @param data + * @param type + * @param tos + * @param metric + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa_rtr(u_int16_t flags, u_int16_t num, u_int id, +u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param nmask + * @param rtrid + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa_net(u_int32_t nmask, u_int rtrid, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param nmask + * @param metric + * @param tos + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa_sum(u_int32_t nmask, u_int metric, u_int tos, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param nmask + * @param metric + * @param fwdaddr + * @param tag + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa_as(u_int32_t nmask, u_int metric, u_int32_t fwdaddr, +u_int tag, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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. + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_data(u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * @param opcode + * @param htype + * @param hlen + * @param hopcount + * @param xid + * @param secs + * @param flags + * @param cip + * @param yip + * @param sip + * @param gip + * @param chaddr + * @param sname + * @param file + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_dhcpv4(u_int8_t opcode, u_int8_t htype, u_int8_t hlen, +u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, +u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, +u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * @param opcode + * @param htype + * @param hlen + * @param hopcount + * @param xid + * @param secs + * @param flags + * @param cip + * @param yip + * @param sip + * @param gip + * @param chaddr + * @param sname + * @param file + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bootpv4(u_int8_t opcode, u_int8_t htype, u_int8_t hlen, +u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, +u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, +u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * @param fv see libnet_build_gre(). + * @return size, see libnet_build_gre(). + */ +u_int32_t +libnet_getgre_length(u_int16_t fv); + +/** + * 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. + * @param fv the 16 0 to 7: which fields are included in the header (checksum, + * seq. number, key, ...), bits 8 to 12: flag, bits 13 to 15: version. + * @param type which protocol is encapsulated (PPP, IP, ...) + * @param sum checksum (0 for libnet to autofill). + * @param offset byte offset from the start of the routing field to the first byte of the SRE + * @param key inserted by the encapsulator to authenticate the source + * @param seq sequence number used by the receiver to sort the packets + * @param len size of the GRE packet + * @param payload + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_gre(u_int16_t fv, u_int16_t type, u_int16_t sum, +u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param fv the 16 0 to 7: which fields are included in the header (checksum, seq. number, key, ...), bits 8 to 12: flag, bits 13 to 15: version. + * @param type which protocol is encapsulated (PPP, IP, ...) + * @param sum checksum (0 for libnet to autofill). + * @param offset byte offset from the start of the routing field to the first byte of the SRE + * @param key inserted by the encapsulator to authenticate the source + * @param seq sequence number used by the receiver to sort the packets + * @param len size of the GRE packet + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_egre(u_int16_t fv, u_int16_t type, u_int16_t sum, +u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param af + * @param offset + * @param length + * @param routing + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_gre_sre(u_int16_t af, u_int8_t offset, u_int8_t length, +u_int8_t *routing, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param marker a value the receiver can predict (if the message type is not BGP OPEN, or no authentication is used, these 16 bytes are normally set as all ones) + * @param len total length of the BGP message, including the header + * @param type type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bgp4_header(u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], +u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * 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). + * @param version protocol version (should be set to 4) + * @param src_as Autonomous System of the sender + * @param hold_time used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender + * @param bgp_id BGP identifier of the sender + * @param opt_len total length of the optional parameters field in bytes + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bgp4_open(u_int8_t version, u_int16_t src_as, u_int16_t hold_time, +u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header. Update + * messages are used to transfer routing information between BGP peers. + * @param unfeasible_rt_len indicates the length of the (next) "withdrawn routes" field in bytes + * @param withdrawn_rt list of IP addresses prefixes for the routes that are being withdrawn; each IP address prefix is built as a 2-tuple <length (1 byte), prefix (variable)> + * @param total_path_attr_len indicates the length of the (next) "path attributes" field in bytes + * @param path_attributes each attribute is a 3-tuple <type (2 bytes), length, value> + * @param info_len indicates the length of the (next) "network layer reachability information" field in bytes (needed for internal memory size calculation) + * @param reachability_info 2-tuples <length (1 byte), prefix (variable)>. + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bgp4_update(u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt, +u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len, +u_int8_t *reachability_info, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param err_code type of notification + * @param err_subcode more specific information about the reported error. + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bgp4_notification(u_int8_t err_code, u_int8_t err_subcode, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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: http://www.honeynet.org/papers/sebek.pdf. + * @param magic identify packets that should be hidden + * @param version protocol version, currently 1 + * @param type type of record (read data is type 0, write data is type 1) + * @param counter PDU counter used to identify when packet are lost + * @param time_sec seconds since EPOCH according to the honeypot + * @param time_usec residual microseconds + * @param pid PID + * @param uid UID + * @param fd FD + * @param cmd 12 first characters of the command + * @param length length in bytes of the PDU's body + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_sebek(u_int32_t magic, u_int16_t version, u_int16_t type, +u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, +u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a HSRP header. HSRP is a Cisco propietary protocol defined in + * RFC 2281 + * @param version version of the HSRP messages + * @param opcode type of message + * @param state current state of the router + * @param hello_time period in seconds between hello messages + * @param hold_time seconds that the current hello message is valid + * @param priority priority for the election proccess + * @param group standby group + * @param reserved reserved field + * @param authdata password + * @param virtual_ip virtual ip address + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_hsrp(u_int8_t version, u_int8_t opcode, u_int8_t state, +u_int8_t hello_time, u_int8_t hold_time, u_int8_t priority, u_int8_t group, +u_int8_t reserved, u_int8_t authdata[HSRP_AUTHDATA_LENGTH], u_int32_t virtual_ip, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst the destination MAC address + * @param src the source MAC address + * @param oui Organizationally Unique Identifier (unused for Ethernet) + * @param type the upper layer protocol type + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_link(u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst the destination MAC address + * @param oui Organizationally Unique Identifier (unused for Ethernet) + * @param type the upper layer protocol type + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_link(u_int8_t *dst, u_int8_t *oui, u_int16_t type, +libnet_t *l); + +/** + * Writes a prebuilt packet to the network. The function assumes that l was + * previously initialized (via a call to libnet_init()) 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 + * libnet_stats(). + * @param l pointer to a libnet context + * @return the number of bytes written, -1 on error + */ +int +libnet_write(libnet_t *l); + +/** + * 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. + * @param l pointer to a libnet context + * @return a big endian IP address suitable for use in a libnet_build function or -1 + */ + +u_int32_t +libnet_get_ipaddr4(libnet_t *l); + +/** + * This function is not yet implemented under IPv6. + * @param l pointer to a libnet context + * @return well, nothing yet + */ +struct libnet_in6_addr +libnet_get_ipaddr6(libnet_t *l); + +/** + * 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 libnet_geterror() will + * tell you why. + * @param l pointer to a libnet context + * @return a pointer to the MAC address or NULL + */ +struct libnet_ether_addr * +libnet_get_hwaddr(libnet_t *l); + +/** + * 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. + * @param s the string to be parsed + * @param len the resulting size of the returned byte string + * @return a byte string or NULL on failure + */ +u_int8_t * +libnet_hex_aton(const char *s, int *len); + +/** + * Returns the version of libnet. + * @return the libnet version + */ +const char * +libnet_version(void); + +/** + * [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 libnet_adv_free_packet() should be made to free the + * memory packet occupies. If the function fails libnet_geterror() can tell you + * why. + * @param l pointer to a libnet context + * @param packet will contain the wire-ready packet + * @param packet_s will contain the packet size + * @return 1 on success, -1 on failure + */ +int +libnet_adv_cull_packet(libnet_t *l, u_int8_t **packet, u_int32_t *packet_s); + +/** + * [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 libnet_geterror() can + * tell you why. + * @param l pointer to a libnet context + * @param ptag the ptag referencing the header to pull + * @param header will contain the header + * @param header_s will contain the header size + * @return 1 on success, -1 on failure + */ +int +libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, +u_int32_t *header_s); + +/** + * [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 libnet_adv_cull_packet(). This function is part of the advanced + * interface and is only available when libnet is initialized in advanced mode. + * If the function fails libnet_geterror() can tell you why. + * @param l pointer to a libnet context + * @param packet a pointer to the packet to inject + * @param packet_s the size of the packet + * @return the number of bytes written, or -1 on failure + */ +int +libnet_adv_write_link(libnet_t *l, u_int8_t *packet, u_int32_t packet_s); + +/** + * [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 libnet_adv_cull_packet(). This function is part of the advanced + * interface and is only available when libnet is initialized in advanced mode. + * If the function fails libnet_geterror() can tell you why. + * @param l pointer to a libnet context + * @param packet a pointer to the packet to inject + * @param packet_s the size of the packet + * @return the number of bytes written, or -1 on failure + */ +int +libnet_adv_write_raw_ipv4(libnet_t *l, u_int8_t *packet, u_int32_t packet_s); + +/** + * [Advanced Interface] + * Frees the memory allocated when libnet_adv_cull_packet() is called. + * @param l pointer to a libnet context + * @param packet a pointer to the packet to free + */ +void +libnet_adv_free_packet(libnet_t *l, u_int8_t *packet); + +/** + * [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 libnet_init(). If the context queue in write + * locked, this function will fail. + * @param l pointer to a libnet context + * @param label a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE + * @return 1 on success, -1 on failure +*/ +int +libnet_cq_add(libnet_t *l, char *label); + +/** + * [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 libnet_destroy(). 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 libnet_cq_remove_by_label(). If the + * context queue is write locked, this function will fail. + * @param l pointer to a libnet context + * @return the pointer to the removed libnet context, NULL on failure + */ +libnet_t * +libnet_cq_remove(libnet_t *l); + +/** + * [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 libnet_destroy(). If the context queue is write locked, this function + * will fail. + * @param label canonical name of the context to remove + * @return the pointer to the removed libnet context, NULL on failure + */ +libnet_t * +libnet_cq_remove_by_label(char *label); + +/** + * [Context Queue] + * Returns the canonical label associated with the context. + * @param l pointer to a libnet context + * @return pointer to the libnet context's label + */ +const char * +libnet_cq_getlabel(libnet_t *l); + +/** + * [Context Queue] + * Locates a libnet context from the queue, indexed by a canonical label. + * @param label canonical label of the libnet context to retrieve + * @return the expected libnet context, NULL on failure + */ +libnet_t * +libnet_cq_find_by_label(char *label); + +/** + * [Context Queue] + * Destroys the entire context queue, calling libnet_destroy() on each + * member context. + */ +void +libnet_cq_destroy(void); + +/** + * [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: + * + * for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next()) + * { + * ... + * } + * + * Much of the time, the application programmer will use the iterator as it is + * written above; as such, libnet provides a macro to do exactly that, + * for_each_context_in_cq(l). Warning: do not call the iterator more than once + * in a single loop. + * @return the head of the context queue + */ +libnet_t * +libnet_cq_head(void); + +/** + * [Context Queue] + * Check whether the iterator is at the last context in the queue. + * @return 1 if at the end of the context queue, 0 otherwise + */ +int +libnet_cq_last(void); + +/** + * [Context Queue] + * Get next context from the context queue. + * @return the next context from the context queue + */ +libnet_t * +libnet_cq_next(void); + +/** + * [Context Queue] + * Function returns the number of libnet contexts that are in the queue. + * @return the number of libnet contexts currently in the queue + */ +u_int32_t +libnet_cq_size(void); + +/** + * [Context Queue] + */ +u_int32_t +libnet_cq_end_loop(void); + +/** + * [Diagnostic] + * Prints the contents of the given context. + * @param l pointer to a libnet context + */ +void +libnet_diag_dump_context(libnet_t *l); + +/** + * [Diagnostic] + * Prints the contents of every pblock. + * @param l pointer to a libnet context + */ +void +libnet_diag_dump_pblock(libnet_t *l); + +/** + * [Diagnostic] + * Returns the canonical name of the pblock type. + * @param type pblock type + * @return a string representing the pblock type type or "unknown" for an unknown value + */ +char * +libnet_diag_dump_pblock_type(u_int8_t type); + +/** + * [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. + * @param packet the packet to print + * @param len length of the packet in bytes + * @param swap 1 to swap byte order, 0 to not. + * Counter-intuitively, it is necessary to swap in order to see the byte + * order as it is on the wire (this may be a bug). + * @param stream a stream pointer to print to + */ +void +libnet_diag_dump_hex(u_int8_t *packet, u_int32_t len, int swap, FILE *stream); + +/* + * [Internal] + */ +int +libnet_write_raw_ipv4(libnet_t *l, u_int8_t *packet, u_int32_t size); + +/* + * [Internal] + */ +int +libnet_write_raw_ipv6(libnet_t *l, u_int8_t *packet, u_int32_t size); + +/* + * [Internal] + */ +int +libnet_write_link(libnet_t *l, u_int8_t *packet, u_int32_t size); + +#if ((__WIN32__) && !(__CYGWIN__)) +/* + * [Internal] + */ +SOCKET +libnet_open_raw4(libnet_t *l); +#else +/* + * [Internal] + */ +int +libnet_open_raw4(libnet_t *l); +#endif + +/* + * [Internal] + */ +int +libnet_close_raw4(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_open_raw6(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_close_raw6(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_select_device(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_open_link(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_close_link(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_do_checksum(libnet_t *l, u_int8_t *packet, int protocol, int len); + +/* + * [Internal] + */ +u_int32_t +libnet_compute_crc(u_int8_t *buf, u_int32_t len); + +/* + * [Internal] + */ +u_int16_t +libnet_ip_check(u_int16_t *addr, int len); + +/* + * [Internal] + */ +int +libnet_in_cksum(u_int16_t *addr, int len); + +/* + * [Internal] + * If ptag is 0, function will create a pblock for the protocol unit type, + * append it to the list and return a pointer to it. If ptag is not 0, + * function will search the pblock list for the specified protocol block + * and return a pointer to it. + */ +libnet_pblock_t * +libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, u_int32_t n, +u_int8_t type); + +/* + * [Internal] + * Function creates the pblock list if l->protocol_blocks == NULL or appends + * an entry to the doubly linked list. + */ +libnet_pblock_t * +libnet_pblock_new(libnet_t *l, u_int32_t size); + +/* + * [Internal] + * Function swaps two pblocks in memory. + */ +int +libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2); + +/* + * [Internal] + * Function inserts a pblock into the doubly linked list. + */ +int +libnet_pblock_insert_before(libnet_t *l, libnet_ptag_t ptag1, +libnet_ptag_t ptag2); + +/* + * [Internal] + * Function removes a pblock from context + */ +void +libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p); + +/* + * [Internal] + * Function updates the pblock meta-inforation. Internally it updates the + * ptag with a monotonically increasing variable kept in l. This way each + * pblock has a succesively increasing ptag identifier. + */ +libnet_ptag_t +libnet_pblock_update(libnet_t *l, libnet_pblock_t *p, u_int32_t h, +u_int8_t type); + + + /* + * [Internal] + * Checksums are a real pain in the <beep>!!! + * Function updates referer used to compute the checksum. All + * pblock need to know where is their referer (ie IP header). + * So, this function is called each time a new IP header is inserted. + * It updates the ip_offset field (referer) of each previous pblock. + */ +void +libnet_pblock_record_ip_offset(libnet_t *l, libnet_pblock_t *p); + +/* + * [Internal] + * Function locates a given block by it's ptag. + */ +libnet_pblock_t * +libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag); + +/* + * [Internal] + * Function copies protocol block data over. + */ +int +libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, +u_int32_t len); + +/* + * [Internal] + * Function sets pblock flags. + */ +void +libnet_pblock_setflags(libnet_pblock_t *p, u_int8_t flags); + +/* + * [Internal] + * Function returns the protocol number for the protocol block type. If + * the type is unknown, the function defaults to returning IPPROTO_IP. + */ +int +libnet_pblock_p2p(u_int8_t type); + +/* + * [Internal] + * Function assembles the packet for subsequent writing. Function makes two + * passes through the pblock list: + */ +int +libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size); + +#if !(__WIN32__) +/* + * [Internal] + * By testing if we can retrieve the FLAGS of an iface + * we can know if it exists or not and if it is up. + */ +int +libnet_check_iface(libnet_t *l); +#endif + +#if defined(__WIN32__) +/* + * [Internal] + */ +BYTE * +libnet_win32_get_remote_mac(libnet_t *l, DWORD IP); + +/* + * [Internal] + */ +int +libnet_close_link_interface(libnet_t *l); + +/* + * [Internal] + */ +BYTE * +libnet_win32_read_arp_table(DWORD IP); +#endif +#endif /* __LIBNET_FUNCTIONS_H */ + +/* EOF */ diff --git a/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-headers.h b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-headers.h new file mode 100644 index 0000000..92c17bb --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-headers.h @@ -0,0 +1,1708 @@ +/* + * $Id: libnet-headers.h,v 1.15 2004/11/09 07:05:07 mike Exp $ + * + * libnet-headers.h - Network routine library headers header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_HEADERS_H +#define __LIBNET_HEADERS_H +/* + * @file libnet-headers.h + * @brief libnet header information + */ + +/* + * Libnet defines header sizes for every builder function exported. + */ +#define LIBNET_802_1Q_H 0x12 /**< 802.1Q header: 18 bytes */ +#define LIBNET_802_1X_H 0x04 /**< 802.1X header: 4 bytes */ +#define LIBNET_802_2_H 0x03 /**< 802.2 LLC header: 3 bytes */ +#define LIBNET_802_2SNAP_H 0x08 /**< 802.2 LLC/SNAP header:8 bytes */ +#define LIBNET_802_3_H 0x0e /**< 802.3 header: 14 bytes */ +#define LIBNET_ARP_H 0x08 /**< ARP header w/o addrs: 8 bytes */ +#define LIBNET_ARP_ETH_IP_H 0x1c /**< ARP w/ ETH and IP: 28 bytes */ +#define LIBNET_BGP4_HEADER_H 0x13 /**< BGP header: 19 bytes */ +#define LIBNET_BGP4_OPEN_H 0x0a /**< BGP open header: 10 bytes */ +#define LIBNET_BGP4_UPDATE_H 0x04 /**< BGP open header: 4 bytes */ +#define LIBNET_BGP4_NOTIFICATION_H 0x02 /**< BGP notif. header: 2 bytes */ +#define LIBNET_CDP_H 0x08 /**< CDP header base: 8 bytes */ +#define LIBNET_DHCPV4_H 0xf0 /**< DHCP v4 header: 240 bytes */ +#define LIBNET_UDP_DNSV4_H 0x0c /**< UDP DNS v4 header: 12 bytes */ +#define LIBNET_TCP_DNSV4_H 0x0e /**< TCP DNS v4 header: 14 bytes */ +#define LIBNET_ETH_H 0x0e /**< Ethernet header: 14 bytes */ +#define LIBNET_FDDI_H 0x15 /**< FDDI header: 21 bytes */ +#define LIBNET_ICMPV4_H 0x04 /**< ICMP header base: 4 bytes */ +#define LIBNET_ICMPV4_ECHO_H 0x08 /**< ICMP_ECHO header: 8 bytes */ +#define LIBNET_ICMPV4_MASK_H 0x0c /**< ICMP_MASK header: 12 bytes */ +#define LIBNET_ICMPV4_UNREACH_H 0x08 /**< ICMP_UNREACH header: 8 bytes */ +#define LIBNET_ICMPV4_TIMXCEED_H 0x08 /**< ICMP_TIMXCEED header: 8 bytes */ +#define LIBNET_ICMPV4_REDIRECT_H 0x08 /**< ICMP_REDIRECT header: 8 bytes */ +#define LIBNET_ICMPV4_TS_H 0x14 /**< ICMP_TIMESTAMP headr:20 bytes */ +#define LIBNET_ICMPV6_H 0x08 /**< ICMP6 header base: 8 bytes */ +#define LIBNET_IGMP_H 0x08 /**< IGMP header: 8 bytes */ +#define LIBNET_IPV4_H 0x14 /**< IPv4 header: 20 bytes */ +#define LIBNET_IPV6_H 0x28 /**< IPv6 header: 40 bytes */ +#define LIBNET_IPV6_FRAG_H 0x08 /**< IPv6 frag header: 8 bytes */ +#define LIBNET_IPV6_ROUTING_H 0x04 /**< IPv6 frag header base:4 bytes */ +#define LIBNET_IPV6_DESTOPTS_H 0x02 /**< IPv6 dest opts base: 2 bytes */ +#define LIBNET_IPV6_HBHOPTS_H 0x02 /**< IPv6 hop/hop opt base:2 bytes */ +#define LIBNET_IPSEC_ESP_HDR_H 0x0c /**< IPSEC ESP header: 12 bytes */ +#define LIBNET_IPSEC_ESP_FTR_H 0x02 /**< IPSEC ESP footer: 2 bytes */ +#define LIBNET_IPSEC_AH_H 0x10 /**< IPSEC AH header: 16 bytes */ +#define LIBNET_ISL_H 0x1a /**< ISL header: 26 bytes */ +#define LIBNET_GRE_H 0x04 /**< GRE header: 4 bytes */ +#define LIBNET_GRE_SRE_H 0x04 /**< GRE SRE header: 4 bytes */ +#define LIBNET_MPLS_H 0x04 /**< MPLS header: 4 bytes */ +#define LIBNET_OSPF_H 0x10 /**< OSPF header: 16 bytes */ +#define LIBNET_OSPF_HELLO_H 0x18 /**< OSPF hello header: 24 bytes */ +#define LIBNET_OSPF_DBD_H 0x08 /**< OSPF DBD header: 8 bytes */ +#define LIBNET_OSPF_LSR_H 0x0c /**< OSPF LSR header: 12 bytes */ +#define LIBNET_OSPF_LSU_H 0x04 /**< OSPF LSU header: 4 bytes */ +#define LIBNET_OSPF_LSA_H 0x14 /**< OSPF LSA header: 20 bytes */ +#define LIBNET_OSPF_AUTH_H 0x08 /**< OSPF AUTH header: 8 bytes */ +#define LIBNET_OSPF_CKSUM 0x10 /**< OSPF CKSUM header: 16 bytes */ +#define LIBNET_OSPF_LS_RTR_H 0x10 /**< OSPF LS RTR header: 16 bytes */ +#define LIBNET_OSPF_LS_NET_H 0x08 /**< OSPF LS NET header: 8 bytes */ +#define LIBNET_OSPF_LS_SUM_H 0x0c /**< OSPF LS SUM header: 12 bytes */ +#define LIBNET_OSPF_LS_AS_EXT_H 0x10 /**< OSPF LS AS header: 16 bytes */ +#define LIBNET_NTP_H 0x30 /**< NTP header: 48 bytes */ +#define LIBNET_RIP_H 0x18 /**< RIP header base: 24 bytes */ +#define LIBNET_RPC_CALL_H 0x28 /**< RPC header: 40 bytes + * (assuming 8 byte auth header) + */ +#define LIBNET_RPC_CALL_TCP_H 0x2c /**< RPC header: 44 bytes + * (with record marking) + */ +#define LIBNET_SEBEK_H 0x30 /* sebek header: 48 bytes */ +#define LIBNET_STP_CONF_H 0x23 /**< STP conf header: 35 bytes */ +#define LIBNET_STP_TCN_H 0x04 /**< STP tcn header: 4 bytes */ +#define LIBNET_TOKEN_RING_H 0x16 /**< Token Ring header: 22 bytes */ +#define LIBNET_TCP_H 0x14 /**< TCP header: 20 bytes */ +#define LIBNET_UDP_H 0x08 /**< UDP header: 8 bytes */ +#define LIBNET_VRRP_H 0x08 /**< VRRP header: 8 bytes */ +#define LIBNET_HSRP_H 0x14 /**< HSRP header: 8 bytes */ + +/* + * IEEE 802.1Q (Virtual Local Area Network) VLAN header, static header + * size: 18 bytes + */ +struct libnet_802_1q_hdr +{ + u_int8_t vlan_dhost[ETHER_ADDR_LEN]; /**< destination ethernet address */ + u_int8_t vlan_shost[ETHER_ADDR_LEN]; /**< source ethernet address */ + u_int16_t vlan_tpi; /**< tag protocol ID */ + u_int16_t vlan_priority_c_vid; /**< priority | VLAN ID */ +#define LIBNET_802_1Q_PRIMASK 0x0007 /**< priority mask */ +#define LIBNET_802_1Q_CFIMASK 0x0001 /**< CFI mask */ +#define LIBNET_802_1Q_VIDMASK 0x0fff /**< vid mask */ + u_int16_t vlan_len; /**< length or type (802.3 / Eth 2) */ +}; + +/* + * IEEE 802.1X EAP (Extensible Authentication Protocol) header, static header + * size: 4 bytes + */ +struct libnet_802_1x_hdr +{ + u_int8_t dot1x_version; /**< protocol version */ + u_int8_t dot1x_type; /**< frame type */ +#define LIBNET_802_1X_PACKET 0x00 /**< 802.1x packet */ +#define LIBNET_802_1X_START 0x01 /**< 802.1x start */ +#define LIBNET_802_1X_LOGOFF 0x02 /**< 802.1x logoff */ +#define LIBNET_802_1X_KEY 0x03 /**< 802.1x key */ +#define LIBNET_802_1X_ENCASFAL 0x04 /**< 802.1x encasfal */ + u_int16_t dot1x_length; /**< total frame length */ +}; + +/* + * IEEE 802.2 LLC header + * Link Layer Control + * static header size: 3 bytes + */ +struct libnet_802_2_hdr +{ + u_int8_t llc_dsap; /* destination service access point */ + u_int8_t llc_ssap; /* source service access point */ +#define LIBNET_SAP_STP 0x42 +#define LIBNET_SAP_SNAP 0xaa + u_int8_t llc_control; /* control field */ +}; + + +/* + * IEEE 802.2 LLC/SNAP header + * SubNetwork Attachment Point + * static header size: 8 bytes + */ +struct libnet_802_2snap_hdr +{ + u_int8_t snap_dsap; /* destination service access point */ + u_int8_t snap_ssap; /* destination service access point */ + u_int8_t snap_control; /* control field */ + u_int8_t snap_oui[3]; /* OUI */ + u_int16_t snap_type; /* type */ +}; + + +/* + * 802.3 header + * IEEE Ethernet + * Static header size: 14 bytes + */ +struct libnet_802_3_hdr +{ + u_int8_t _802_3_dhost[ETHER_ADDR_LEN];/* destination ethernet address */ + u_int8_t _802_3_shost[ETHER_ADDR_LEN];/* source ethernet address */ + u_int16_t _802_3_len; /* packet type ID */ +}; + + +/* + * ARP header + * Address Resolution Protocol + * Base header size: 8 bytes + */ +struct libnet_arp_hdr +{ + u_int16_t ar_hrd; /* format of hardware address */ +#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ +#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ +#define ARPHRD_EETHER 2 /* Experimental Ethernet */ +#define ARPHRD_AX25 3 /* AX.25 Level 2 */ +#define ARPHRD_PRONET 4 /* PROnet token ring */ +#define ARPHRD_CHAOS 5 /* Chaosnet */ +#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ +#define ARPHRD_ARCNET 7 /* ARCnet */ +#define ARPHRD_APPLETLK 8 /* APPLEtalk */ +#define ARPHRD_LANSTAR 9 /* Lanstar */ +#define ARPHRD_DLCI 15 /* Frame Relay DLCI */ +#define ARPHRD_ATM 19 /* ATM */ +#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ +#define ARPHRD_IPSEC 31 /* IPsec tunnel */ + u_int16_t ar_pro; /* format of protocol address */ + u_int8_t ar_hln; /* length of hardware address */ + u_int8_t ar_pln; /* length of protocol addres */ + u_int16_t ar_op; /* operation type */ +#define ARPOP_REQUEST 1 /* req to resolve address */ +#define ARPOP_REPLY 2 /* resp to previous request */ +#define ARPOP_REVREQUEST 3 /* req protocol address given hardware */ +#define ARPOP_REVREPLY 4 /* resp giving protocol address */ +#define ARPOP_INVREQUEST 8 /* req to identify peer */ +#define ARPOP_INVREPLY 9 /* resp identifying peer */ + /* address information allocated dynamically */ +}; + +/* + * BGP4 header + * Border Gateway Protocol 4 + * Base header size : 19 bytes + */ +struct libnet_bgp4_header_hdr +{ +#define LIBNET_BGP4_MARKER_SIZE 16 + u_int8_t marker[LIBNET_BGP4_MARKER_SIZE]; + u_int16_t len; + u_int8_t type; +#define LIBNET_BGP4_OPEN 1 +#define LIBNET_BGP4_UPDATE 2 +#define LIBNET_BGP4_NOTIFICATION 3 +#define LIBNET_BGP4_KEEPALIVE 4 +}; + +/* + * BGP4 open header + * Border Gateway Protocol 4 + * Base header size : 10 bytes + */ +struct libnet_bgp4_open_hdr +{ + u_int8_t version; + u_int16_t src_as; + u_int16_t hold_time; + u_int32_t bgp_id; + u_int8_t opt_len; +}; + +/* + * BGP4 notification message + * + * Border Gateway Protocol 4 + * Base header size : 2 bytes + * + * Use payload if you need data + */ +struct libnet_bgp4_notification_hdr +{ +#define LIBNET_BGP4_MESSAGE_HEADER_ERROR 1 +#define LIBNET_BGP4_OPEN_MESSAGE_ERROR 2 +#define LIBNET_BGP4_UPDATE_MESSAGE_ERROR 3 +#define LIBNET_BGP4_HOLD_TIMER_EXPIRED 4 +#define LIBNET_BGP4_FINITE_STATE__ERROR 5 +#define LIBNET_BGP4_CEASE 6 + u_int8_t err_code; + +/* Message Header Error subcodes */ +#define LIBNET_BGP4_CONNECTION_NOT_SYNCHRONIZED 1 +#define LIBNET_BGP4_BAD_MESSAGE_LENGTH 2 +#define LIBNET_BGP4_BAD_MESSAGE_TYPE 3 +/* OPEN Message Error subcodes */ +#define LIBNET_BGP4_UNSUPPORTED_VERSION_NUMBER 1 +#define LIBNET_BGP4_BAD_PEER_AS 2 +#define LIBNET_BGP4_BAD_BGP_IDENTIFIER 3 +#define LIBNET_BGP4_UNSUPPORTED_OPTIONAL_PARAMETER 4 +#define LIBNET_BGP4_AUTHENTICATION_FAILURE 5 +#define LIBNET_BGP4_UNACCEPTABLE_HOLD_TIME 6 +/* UPDATE Message Error subcodes */ +#define LIBNET_BGP4_MALFORMED_ATTRIBUTE_LIST +#define LIBNET_BGP4_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE +#define LIBNET_BGP4_MISSING_WELL_KNOWN_ATTRIBUTE +#define LIBNET_BGP4_ATTRIBUTE_FLAGS_ERROR +#define LIBNET_BGP4_ATTRIBUTE_LENGTH_ERROR +#define LIBNET_BGP4_INVALID_ORIGIN_ATTRIBUTE +#define LIBNET_BGP4_AS_ROUTING_LOOP +#define LIBNET_BGP4_INVALID_NEXT_HOP_ATTRIBUTE +#define LIBNET_BGP4_OPTIONAL_ATTRIBUTE_ERROR +#define LIBNET_BGP4_INVALID_NETWORK_FIELD +#define LIBNET_BGP4_MALFORMED_AS_PATH + u_int8_t err_subcode; +}; + + + +/* + * For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001. + * Let's hope this one stays that way for a while! + */ +#define LIBNET_PROTO_CDP 200 + +/* + * CDP header + * Cisco Discovery Protocol + * Base header size: 8 bytes + */ +struct libnet_cdp_hdr +{ + u_int8_t cdp_version; /* version (should always be 0x01) */ + u_int8_t cdp_ttl; /* time reciever should hold info in this packet */ + u_int16_t cdp_sum; /* checksum */ + u_int16_t cdp_type; /* type */ +#define LIBNET_CDP_DEVID 0x1 /* device id */ +#define LIBNET_CDP_ADDRESS 0x2 /* address */ +#define LIBNET_CDP_PORTID 0x3 /* port id */ +#define LIBNET_CDP_CAPABIL 0x4 /* capabilities */ +#define LIBNET_CDP_VERSION 0x5 /* version */ +#define LIBNET_CDP_PLATFORM 0x6 /* platform */ +#define LIBNET_CDP_IPPREFIX 0x7 /* ip prefix */ + u_int16_t cdp_len; /* type + length + value */ + /* value information done dynamically */ + +/* CDP capabilities */ +#define LIBNET_CDP_CAP_L3R 0x01/* performs level 3 routing */ +#define LIBNET_CDP_CAP_L2B 0x02/* performs level 2 transparent bridging */ +#define LIBNET_CDP_CAP_L2SRB 0x04/* performs level 2 sourceroute bridging */ +#define LIBNET_CDP_CAP_L2S 0x08/* performs level 2 switching */ +#define LIBNET_CDP_CAP_SR 0x10/* sends and recieves packets on a network */ +#define LIBNET_CDP_CAP_NOI 0x20/* does not forward IGMP on non-router ports */ +#define LIBNET_CDP_CAP_L1F 0x40/* provides level 1 functionality */ +}; + + +/* + * Used as an overlay for type/len/values + */ +struct libnet_cdp_value_hdr +{ + u_int16_t cdp_type; + u_int16_t cdp_len; +}; + + +/* + * DHCP header + * Dynamic Host Configuration Protocol + * Static header size: f0 bytes + */ +struct libnet_dhcpv4_hdr +{ + u_int8_t dhcp_opcode; /* opcode */ +#define LIBNET_DHCP_REQUEST 0x1 +#define LIBNET_DHCP_REPLY 0x2 + u_int8_t dhcp_htype; /* hardware address type */ + u_int8_t dhcp_hlen; /* hardware address length */ + u_int8_t dhcp_hopcount; /* used by proxy servers */ + u_int32_t dhcp_xid; /* transaction ID */ + u_int16_t dhcp_secs; /* number of seconds since trying to bootstrap */ + u_int16_t dhcp_flags; /* flags for DHCP, unused for BOOTP */ + u_int32_t dhcp_cip; /* client's IP */ + u_int32_t dhcp_yip; /* your IP */ + u_int32_t dhcp_sip; /* server's IP */ + u_int32_t dhcp_gip; /* gateway IP */ + u_int8_t dhcp_chaddr[16]; /* client hardware address */ + u_int8_t dhcp_sname[64]; /* server host name */ + u_int8_t dhcp_file[128]; /* boot file name */ + u_int32_t dhcp_magic; /* BOOTP magic header */ +#define DHCP_MAGIC 0x63825363 +#define LIBNET_BOOTP_MIN_LEN 0x12c +#define LIBNET_DHCP_PAD 0x00 +#define LIBNET_DHCP_SUBNETMASK 0x01 +#define LIBNET_DHCP_TIMEOFFSET 0x02 +#define LIBNET_DHCP_ROUTER 0x03 +#define LIBNET_DHCP_TIMESERVER 0x04 +#define LIBNET_DHCP_NAMESERVER 0x05 +#define LIBNET_DHCP_DNS 0x06 +#define LIBNET_DHCP_LOGSERV 0x07 +#define LIBNET_DHCP_COOKIESERV 0x08 +#define LIBNET_DHCP_LPRSERV 0x09 +#define LIBNET_DHCP_IMPSERV 0x0a +#define LIBNET_DHCP_RESSERV 0x0b +#define LIBNET_DHCP_HOSTNAME 0x0c +#define LIBNET_DHCP_BOOTFILESIZE 0x0d +#define LIBNET_DHCP_DUMPFILE 0x0e +#define LIBNET_DHCP_DOMAINNAME 0x0f +#define LIBNET_DHCP_SWAPSERV 0x10 +#define LIBNET_DHCP_ROOTPATH 0x11 +#define LIBNET_DHCP_EXTENPATH 0x12 +#define LIBNET_DHCP_IPFORWARD 0x13 +#define LIBNET_DHCP_SRCROUTE 0x14 +#define LIBNET_DHCP_POLICYFILTER 0x15 +#define LIBNET_DHCP_MAXASMSIZE 0x16 +#define LIBNET_DHCP_IPTTL 0x17 +#define LIBNET_DHCP_MTUTIMEOUT 0x18 +#define LIBNET_DHCP_MTUTABLE 0x19 +#define LIBNET_DHCP_MTUSIZE 0x1a +#define LIBNET_DHCP_LOCALSUBNETS 0x1b +#define LIBNET_DHCP_BROADCASTADDR 0x1c +#define LIBNET_DHCP_DOMASKDISCOV 0x1d +#define LIBNET_DHCP_MASKSUPPLY 0x1e +#define LIBNET_DHCP_DOROUTEDISC 0x1f +#define LIBNET_DHCP_ROUTERSOLICIT 0x20 +#define LIBNET_DHCP_STATICROUTE 0x21 +#define LIBNET_DHCP_TRAILERENCAP 0x22 +#define LIBNET_DHCP_ARPTIMEOUT 0x23 +#define LIBNET_DHCP_ETHERENCAP 0x24 +#define LIBNET_DHCP_TCPTTL 0x25 +#define LIBNET_DHCP_TCPKEEPALIVE 0x26 +#define LIBNET_DHCP_TCPALIVEGARBAGE 0x27 +#define LIBNET_DHCP_NISDOMAIN 0x28 +#define LIBNET_DHCP_NISSERVERS 0x29 +#define LIBNET_DHCP_NISTIMESERV 0x2a +#define LIBNET_DHCP_VENDSPECIFIC 0x2b +#define LIBNET_DHCP_NBNS 0x2c +#define LIBNET_DHCP_NBDD 0x2d +#define LIBNET_DHCP_NBTCPIP 0x2e +#define LIBNET_DHCP_NBTCPSCOPE 0x2f +#define LIBNET_DHCP_XFONT 0x30 +#define LIBNET_DHCP_XDISPLAYMGR 0x31 +#define LIBNET_DHCP_DISCOVERADDR 0x32 +#define LIBNET_DHCP_LEASETIME 0x33 +#define LIBNET_DHCP_OPTIONOVERLOAD 0x34 +#define LIBNET_DHCP_MESSAGETYPE 0x35 +#define LIBNET_DHCP_SERVIDENT 0x36 +#define LIBNET_DHCP_PARAMREQUEST 0x37 +#define LIBNET_DHCP_MESSAGE 0x38 +#define LIBNET_DHCP_MAXMSGSIZE 0x39 +#define LIBNET_DHCP_RENEWTIME 0x3a +#define LIBNET_DHCP_REBINDTIME 0x3b +#define LIBNET_DHCP_CLASSSID 0x3c +#define LIBNET_DHCP_CLIENTID 0x3d +#define LIBNET_DHCP_NISPLUSDOMAIN 0x40 +#define LIBNET_DHCP_NISPLUSSERVERS 0x41 +#define LIBNET_DHCP_MOBILEIPAGENT 0x44 +#define LIBNET_DHCP_SMTPSERVER 0x45 +#define LIBNET_DHCP_POP3SERVER 0x46 +#define LIBNET_DHCP_NNTPSERVER 0x47 +#define LIBNET_DHCP_WWWSERVER 0x48 +#define LIBNET_DHCP_FINGERSERVER 0x49 +#define LIBNET_DHCP_IRCSERVER 0x4a +#define LIBNET_DHCP_STSERVER 0x4b +#define LIBNET_DHCP_STDASERVER 0x4c +#define LIBNET_DHCP_END 0xff + +#define LIBNET_DHCP_MSGDISCOVER 0x01 +#define LIBNET_DHCP_MSGOFFER 0x02 +#define LIBNET_DHCP_MSGREQUEST 0x03 +#define LIBNET_DHCP_MSGDECLINE 0x04 +#define LIBNET_DHCP_MSGACK 0x05 +#define LIBNET_DHCP_MSGNACK 0x06 +#define LIBNET_DHCP_MSGRELEASE 0x07 +#define LIBNET_DHCP_MSGINFORM 0x08 +}; + + +/* this little guy got left out in the cold */ +#define LIBNET_DNS_H LIBNET_UDP_DNSV4_H +/* + * Base DNSv4 header + * Domain Name System + * Base header size: 12/14 bytes + */ +struct libnet_dnsv4_hdr +{ + u_int16_t h_len; /* length of the packet - only used with TCP */ + u_int16_t id; /* DNS packet ID */ + u_int16_t flags; /* DNS flags */ + u_int16_t num_q; /* Number of questions */ + u_int16_t num_answ_rr; /* Number of answer resource records */ + u_int16_t num_auth_rr; /* Number of authority resource records */ + u_int16_t num_addi_rr; /* Number of additional resource records */ +}; + +#define LIBNET_DNS_H LIBNET_UDP_DNSV4_H +struct libnet_dnsv4udp_hdr +{ + u_int16_t id; /* DNS packet ID */ + u_int16_t flags; /* DNS flags */ + u_int16_t num_q; /* Number of questions */ + u_int16_t num_answ_rr; /* Number of answer resource records */ + u_int16_t num_auth_rr; /* Number of authority resource records */ + u_int16_t num_addi_rr; /* Number of additional resource records */ +}; + +/* + * Ethernet II header + * Static header size: 14 bytes + */ +struct libnet_ethernet_hdr +{ + u_int8_t ether_dhost[ETHER_ADDR_LEN];/* destination ethernet address */ + u_int8_t ether_shost[ETHER_ADDR_LEN];/* source ethernet address */ + u_int16_t ether_type; /* protocol */ +}; + +#ifndef ETHERTYPE_PUP +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#endif +#ifndef ETHERTYPE_IP +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#endif +#ifndef ETHERTYPE_ARP +#define ETHERTYPE_ARP 0x0806 /* addr. resolution protocol */ +#endif +#ifndef ETHERTYPE_REVARP +#define ETHERTYPE_REVARP 0x8035 /* reverse addr. resolution protocol */ +#endif +#ifndef ETHERTYPE_VLAN +#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ +#endif +#ifndef ETHERTYPE_EAP +#define ETHERTYPE_EAP 0x888e /* IEEE 802.1X EAP authentication */ +#endif +#ifndef ETHERTYPE_MPLS +#define ETHERTYPE_MPLS 0x8847 /* MPLS */ +#endif +#ifndef ETHERTYPE_LOOPBACK +#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ +#endif + +struct libnet_ether_addr +{ + u_int8_t ether_addr_octet[6]; /* Ethernet address */ +}; + +/* + * Fiber Distributed Data Interface header + * + * Static header size: 21 bytes (LLC and 48-bit address addr only) + * + * Note: Organization field is 3 bytes which throws off the + * alignment of type. Therefore fddi_type (19 bytes in) + * is specified as two u_int8_ts. + */ +struct libnet_fddi_hdr +{ + u_int8_t fddi_frame_control; /* Class/Format/Priority */ +#define LIBNET_FDDI_LLC_FRAME 0x10 +#define LIBNET_FDDI_48BIT_ADDR 0x40 +#define LIBNET_FDDI_FC_REQD LIBNET_FDDI_LLC_FRAME | LIBNET_FDDI_48BIT_ADDR + u_int8_t fddi_dhost[FDDI_ADDR_LEN]; /* destination fddi address */ + u_int8_t fddi_shost[FDDI_ADDR_LEN]; /* source fddi address */ + u_int8_t fddi_llc_dsap; /* DSAP */ + u_int8_t fddi_llc_ssap; /* SSAP */ + u_int8_t fddi_llc_control_field; /* Class/Format/Priority */ + u_int8_t fddi_llc_org_code[LIBNET_ORG_CODE_SIZE]; /* Organization Code 3-bytes */ + u_int8_t fddi_type; /* Protocol Type */ + u_int8_t fddi_type1; /* see note above. */ +#define FDDI_TYPE_IP 0x0800 /* IP protocol */ +#define FDDI_TYPE_ARP 0x0806 /* addr. resolution protocol */ +#define FDDI_TYPE_REVARP 0x8035 /* reverse addr. resolution protocol */ +}; + + +struct libnet_fddi_addr +{ + u_int8_t fddi_addr_octet[6]; /* FDDI address */ +}; + + +/* + * GRE header - RFC 1701 & 2637 + * Generic Routing Encapsulation (GRE) + * Base header size: 4 bytes + */ +struct libnet_gre_hdr +{ + u_int16_t flags_ver; +#define GRE_CSUM 0x8000 +#define GRE_ROUTING 0x4000 +#define GRE_KEY 0x2000 +#define GRE_SEQ 0x1000 +#define GRE_STRICT 0x0800 +#define GRE_REC 0x0700 +#define GRE_ACK 0x0080 + +#define GRE_FLAGS_MASK 0x00F8 +#define GRE_VERSION_MASK 0x0007 + +#define GRE_VERSION_0 0x0000 +#define GRE_VERSION_1 0x0001 + + u_int16_t type; +#define GRE_SNA 0x0004 +#define GRE_OSI_NETWORK_LAYER 0x00FE +#define GRE_PUP 0x0200 +#define GRE_XNS 0x0600 +#define GRE_IP 0x0800 +#define GRE_CHAOS 0x0804 +#define GRE_RFC_826_ARP 0x0806 +#define GRE_FRAME_RELAY_ARP 0x0808 +#define GRE_VINES 0x0BAD +#define GRE_VINES_ECHO 0x0BAE +#define GRE_VINES_LOOPBACK 0x0BAF +#define GRE_DECNET 0x6003 +#define GRE_TRANSPARENT_ETHERNET_BRIDGING 0x6558 +#define GRE_RAW_FRAME_RELAY 0x6559 +#define GRE_APOLLO_DOMAIN 0x8019 +#define GRE_ETHERTALK 0x809B +#define GRE_NOVELL_IPX 0x8137 +#define GRE_RFC_1144_TCP_IP_COMPRESSION 0x876B +#define GRE_IP_AUTONOMOUS_SYSTEMS 0x876C +#define GRE_SECURE_DATA 0x876D +#define GRE_PPP 0x880b /* taken from RFC 2637 */ + + union { + struct { + u_int16_t sum; /* optional */ + u_int16_t offset; /* optional */ + u_int32_t key; /* optional */ + u_int32_t seq; /* optional */ + } _gre; + + struct { + u_int16_t payload_s; /* optional */ + u_int16_t callID; /* optional */ + u_int32_t seq; /* optional */ + u_int32_t ack; /* optional */ + } _egre; + }_data; + +#define gre_sum _data._gre.sum +#define gre_offset _data._gre.offset +#define gre_key _data._gre.key +#define gre_seq _data._gre.seq + +#define egre_payload_s _data._egre.payload_s +#define egre_callID _data._egre.callID +#define egre_seq _data._egre.seq +#define egre_ack _data._egre.ack +}; + + +#ifndef IPPROTO_GRE +#define IPPROTO_GRE 47 +#endif + +/* + * Source Route Entries (SRE) + * This is used for GRE as the Routing field is a list of SREs - RFC 1701 + * Base header size: 4 bytes + */ +struct libnet_gre_sre_hdr +{ + u_int16_t af; /* address familly */ + u_int8_t sre_offset; + u_int8_t sre_length; + u_int8_t *routing; +}; + + +/* + * IPv4 header + * Internet Protocol, version 4 + * Static header size: 20 bytes + */ +struct libnet_ipv4_hdr +{ +#if (LIBNET_LIL_ENDIAN) + u_int8_t ip_hl:4, /* header length */ + ip_v:4; /* version */ +#endif +#if (LIBNET_BIG_ENDIAN) + u_int8_t ip_v:4, /* version */ + ip_hl:4; /* header length */ +#endif + u_int8_t ip_tos; /* type of service */ +#ifndef IPTOS_LOWDELAY +#define IPTOS_LOWDELAY 0x10 +#endif +#ifndef IPTOS_THROUGHPUT +#define IPTOS_THROUGHPUT 0x08 +#endif +#ifndef IPTOS_RELIABILITY +#define IPTOS_RELIABILITY 0x04 +#endif +#ifndef IPTOS_LOWCOST +#define IPTOS_LOWCOST 0x02 +#endif + u_int16_t ip_len; /* total length */ + u_int16_t ip_id; /* identification */ + u_int16_t ip_off; +#ifndef IP_RF +#define IP_RF 0x8000 /* reserved fragment flag */ +#endif +#ifndef IP_DF +#define IP_DF 0x4000 /* dont fragment flag */ +#endif +#ifndef IP_MF +#define IP_MF 0x2000 /* more fragments flag */ +#endif +#ifndef IP_OFFMASK +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ +#endif + u_int8_t ip_ttl; /* time to live */ + u_int8_t ip_p; /* protocol */ + u_int16_t ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ +}; + +/* + * IP options + */ +#ifndef IPOPT_EOL +#define IPOPT_EOL 0 /* end of option list */ +#endif +#ifndef IPOPT_NOP +#define IPOPT_NOP 1 /* no operation */ +#endif +#ifndef IPOPT_RR +#define IPOPT_RR 7 /* record packet route */ +#endif +#ifndef IPOPT_TS +#define IPOPT_TS 68 /* timestamp */ +#endif +#ifndef IPOPT_SECURITY +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#endif +#ifndef IPOPT_LSRR +#define IPOPT_LSRR 131 /* loose source route */ +#endif +#ifndef IPOPT_SATID +#define IPOPT_SATID 136 /* satnet id */ +#endif +#ifndef IPOPT_SSRR +#define IPOPT_SSRR 137 /* strict source route */ +#endif + +/* + * IPv6 address + */ +struct libnet_in6_addr +{ + union + { + u_int8_t __u6_addr8[16]; + u_int16_t __u6_addr16[8]; + u_int32_t __u6_addr32[4]; + } __u6_addr; /* 128-bit IP6 address */ +}; +#define libnet_s6_addr __u6_addr.__u6_addr8 + +/* + * IPv6 header + * Internet Protocol, version 6 + * Static header size: 40 bytes + */ +struct libnet_ipv6_hdr +{ + u_int8_t ip_flags[4]; /* version, traffic class, flow label */ + u_int16_t ip_len; /* total length */ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_hl; /* hop limit */ + struct libnet_in6_addr ip_src, ip_dst; /* source and dest address */ + +}; + +/* + * IPv6 frag header + * Internet Protocol, version 6 + * Static header size: 8 bytes + */ +#define LIBNET_IPV6_NH_FRAGMENT 44 +struct libnet_ipv6_frag_hdr +{ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_reserved; /* reserved */ + u_int16_t ip_frag; /* fragmentation stuff */ + u_int32_t ip_id; /* id */ +}; + +/* + * IPv6 routing header + * Internet Protocol, version 6 + * Base header size: 4 bytes + */ +#define LIBNET_IPV6_NH_ROUTING 43 +struct libnet_ipv6_routing_hdr +{ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_len; /* length of header in 8 octet units (sans 1st) */ + u_int8_t ip_rtype; /* routing type */ + u_int8_t ip_segments; /* segments left */ + /* routing information allocated dynamically */ +}; + +/* + * IPv6 destination options header + * Internet Protocol, version 6 + * Base header size: 2 bytes + */ +#define LIBNET_IPV6_NH_DESTOPTS 60 +struct libnet_ipv6_destopts_hdr +{ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_len; /* length of header in 8 octet units (sans 1st) */ + /* destination options information allocated dynamically */ +}; + +/* + * IPv6 hop by hop options header + * Internet Protocol, version 6 + * Base header size: 2 bytes + */ +#define LIBNET_IPV6_NH_HBH 0 +struct libnet_ipv6_hbhopts_hdr +{ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_len; /* length of header in 8 octet units (sans 1st) */ + /* destination options information allocated dynamically */ +}; + +/* + * ICMP6 header + * Internet Control Message Protocol v6 + * Base header size: 8 bytes + */ +#ifndef IPPROTO_ICMP6 +#define IPPROTO_ICMP6 0x3a +#endif +struct libnet_icmpv6_hdr +{ + u_int8_t icmp_type; /* ICMP type */ +#ifndef ICMP6_ECHO +#define ICMP6_ECHO 128 +#endif +#ifndef ICMP6_ECHOREPLY +#define ICMP6_ECHOREPLY 129 +#endif +#ifndef ICMP6_UNREACH +#define ICMP6_UNREACH 1 +#endif +#ifndef ICMP6_PKTTOOBIG +#define ICMP6_PKTTOOBIG 2 +#endif +#ifndef ICMP6_TIMXCEED +#define ICMP6_TIMXCEED 3 +#endif +#ifndef ICMP6_PARAMPROB +#define ICMP6_PARAMPROB 4 +#endif + u_int8_t icmp_code; /* ICMP code */ + u_int16_t icmp_sum; /* ICMP Checksum */ + u_int16_t id; /* ICMP id */ + u_int16_t seq; /* ICMP sequence number */ +}; + + + +/* + * ICMP header + * Internet Control Message Protocol + * Base header size: 4 bytes + */ +struct libnet_icmpv4_hdr +{ + u_int8_t icmp_type; /* ICMP type */ +#ifndef ICMP_ECHOREPLY +#define ICMP_ECHOREPLY 0 +#endif +#ifndef ICMP_UNREACH +#define ICMP_UNREACH 3 +#endif +#ifndef ICMP_SOURCEQUENCH +#define ICMP_SOURCEQUENCH 4 +#endif +#ifndef ICMP_REDIRECT +#define ICMP_REDIRECT 5 +#endif +#ifndef ICMP_ECHO +#define ICMP_ECHO 8 +#endif +#ifndef ICMP_ROUTERADVERT +#define ICMP_ROUTERADVERT 9 +#endif +#ifndef ICMP_ROUTERSOLICIT +#define ICMP_ROUTERSOLICIT 10 +#endif +#ifndef ICMP_TIMXCEED +#define ICMP_TIMXCEED 11 +#endif +#ifndef ICMP_PARAMPROB +#define ICMP_PARAMPROB 12 +#endif +#ifndef ICMP_TSTAMP +#define ICMP_TSTAMP 13 +#endif +#ifndef ICMP_TSTAMPREPLY +#define ICMP_TSTAMPREPLY 14 +#endif +#ifndef ICMP_IREQ +#define ICMP_IREQ 15 +#endif +#ifndef ICMP_IREQREPLY +#define ICMP_IREQREPLY 16 +#endif +#ifndef ICMP_MASKREQ +#define ICMP_MASKREQ 17 +#endif +#ifndef ICMP_MASKREPLY +#define ICMP_MASKREPLY 18 +#endif + u_int8_t icmp_code; /* ICMP code */ +#ifndef ICMP_UNREACH_NET +#define ICMP_UNREACH_NET 0 +#endif +#ifndef ICMP_UNREACH_HOST +#define ICMP_UNREACH_HOST 1 +#endif +#ifndef ICMP_UNREACH_PROTOCOL +#define ICMP_UNREACH_PROTOCOL 2 +#endif +#ifndef ICMP_UNREACH_PORT +#define ICMP_UNREACH_PORT 3 +#endif +#ifndef ICMP_UNREACH_NEEDFRAG +#define ICMP_UNREACH_NEEDFRAG 4 +#endif +#ifndef ICMP_UNREACH_SRCFAIL +#define ICMP_UNREACH_SRCFAIL 5 +#endif +#ifndef ICMP_UNREACH_NET_UNKNOWN +#define ICMP_UNREACH_NET_UNKNOWN 6 +#endif +#ifndef ICMP_UNREACH_HOST_UNKNOWN +#define ICMP_UNREACH_HOST_UNKNOWN 7 +#endif +#ifndef ICMP_UNREACH_ISOLATED +#define ICMP_UNREACH_ISOLATED 8 +#endif +#ifndef ICMP_UNREACH_NET_PROHIB +#define ICMP_UNREACH_NET_PROHIB 9 +#endif +#ifndef ICMP_UNREACH_HOST_PROHIB +#define ICMP_UNREACH_HOST_PROHIB 10 +#endif +#ifndef ICMP_UNREACH_TOSNET +#define ICMP_UNREACH_TOSNET 11 +#endif +#ifndef ICMP_UNREACH_TOSHOST +#define ICMP_UNREACH_TOSHOST 12 +#endif +#ifndef ICMP_UNREACH_FILTER_PROHIB +#define ICMP_UNREACH_FILTER_PROHIB 13 +#endif +#ifndef ICMP_UNREACH_HOST_PRECEDENCE +#define ICMP_UNREACH_HOST_PRECEDENCE 14 +#endif +#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 +#endif +#ifndef ICMP_REDIRECT_NET +#define ICMP_REDIRECT_NET 0 +#endif +#ifndef ICMP_REDIRECT_HOST +#define ICMP_REDIRECT_HOST 1 +#endif +#ifndef ICMP_REDIRECT_TOSNET +#define ICMP_REDIRECT_TOSNET 2 +#endif +#ifndef ICMP_REDIRECT_TOSHOST +#define ICMP_REDIRECT_TOSHOST 3 +#endif +#ifndef ICMP_TIMXCEED_INTRANS +#define ICMP_TIMXCEED_INTRANS 0 +#endif +#ifndef ICMP_TIMXCEED_REASS +#define ICMP_TIMXCEED_REASS 1 +#endif +#ifndef ICMP_PARAMPROB_OPTABSENT +#define ICMP_PARAMPROB_OPTABSENT 1 +#endif + + u_int16_t icmp_sum; /* ICMP Checksum */ + + union + { + struct + { + u_int16_t id; /* ICMP id */ + u_int16_t seq;/* ICMP sequence number */ + } echo; + +#undef icmp_id +#undef icmp_seq +#define icmp_id hun.echo.id +#define icmp_seq hun.echo.seq + + u_int32_t gateway; /* gateway host */ + struct + { + u_int16_t pad;/* padding */ + u_int16_t mtu;/* MTU size */ + } frag; + } hun; + union + { + struct + { + n_time its_otime; + n_time its_rtime; + n_time its_ttime; + } ts; + struct + { + struct libnet_ipv4_hdr idi_ip; + /* options and then 64 bits of data */ + } ip; + u_int32_t mask; + int8_t data[1]; + +#undef icmp_mask +#define icmp_mask dun.mask +#undef icmp_data +#define icmp_data dun.data + +#undef icmp_otime +#define icmp_otime dun.ts.its_otime +#undef icmp_rtime +#define icmp_rtime dun.ts.its_rtime +#undef icmp_ttime +#define icmp_ttime dun.ts.its_ttime + }dun; +}; + + +/* + * IGMP header + * Internet Group Message Protocol + * Static header size: 8 bytes + */ +struct libnet_igmp_hdr +{ + u_int8_t igmp_type; /* IGMP type */ +#ifndef IGMP_MEMBERSHIP_QUERY +#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ +#endif +#ifndef IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ +#endif +#ifndef IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#endif +#ifndef IGMP_LEAVE_GROUP +#define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */ +#endif + u_int8_t igmp_code; /* IGMP code */ + u_int16_t igmp_sum; /* IGMP checksum */ + struct in_addr igmp_group;/* IGMP host IP */ +}; + + +/* + * IPSEC header + * Internet Protocol Security Protocol + * Encapsulating Security Payload Header Static header size: 12 bytes + * Encapsulating Security Payload Footer Base header size: 2 bytes + * Authentication Header Static Size: 16 bytes + */ +#ifndef IPPROTO_ESP +#define IPPROTO_ESP 50 /* not everyone's got this */ +#endif +struct libnet_esp_hdr +{ + u_int32_t esp_spi; /* security parameter index */ + u_int32_t esp_seq; /* ESP sequence number */ + u_int32_t esp_iv; /* initialization vector */ +}; + +struct libnet_esp_ftr +{ + u_int8_t esp_pad_len; /* padding length */ + u_int8_t esp_nh; /* next header pointer */ + int8_t *esp_auth; /* authentication data */ +}; + +#ifndef IPPROTO_AH +#define IPPROTO_AH 51 /* not everyone's got this */ +#endif +struct libnet_ah_hdr +{ + u_int8_t ah_nh; /* next header */ + u_int8_t ah_len; /* payload length */ + u_int16_t ah_res; /* reserved */ + u_int32_t ah_spi; /* security parameter index */ + u_int32_t ah_seq; /* AH sequence number */ + u_int32_t ah_auth; /* authentication data */ +}; + + +/* + * For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001. + * Let's hope this one stays that way for a while! + */ +#define LIBNET_PROTO_ISL 201 +/* + * ISL header + * Cisco Inter-Switch Link + * Static header size: 26 bytes + */ +struct libnet_isl_hdr +{ + u_int8_t isl_dhost[5]; /* destination address "01:00:0c:00:00" */ +#if (LIBNET_LIL_ENDIAN) + u_int8_t isl_type:4, /* type of frame */ + isl_user:4; /* user defined bits */ +#endif +#if (LIBNET_BIG_ENDIAN) + u_int8_t isl_user:4, /* user defined bits */ + isl_type:4; /* type of frame */ +#endif + u_int8_t isl_shost[6]; /* source address */ + u_int16_t isl_len; /* total length of packet - 18 bytes */ + u_int8_t isl_snap[6]; /* 0xaaaa03 + vendor code */ + u_int16_t isl_vid; /* 15 bit VLAN ID, 1 bit BPDU / CDP indicator */ + u_int16_t isl_index; /* port index */ + u_int16_t isl_reserved; /* used for FDDI and token ring */ + /* ethernet frame and 4 byte isl crc */ +}; + +#ifndef IPPROTO_OSPF +#define IPPROTO_OSPF 89 /* not everyone's got this */ +#endif +#define IPPROTO_OSPF_LSA 890 /* made this up. Hope it's unused */ +#define LIBNET_MODX 4102 /* used in LSA checksum */ + +/* + * Options used in multiple OSPF packets + * More info can be found in section A.2 of RFC 2328. + */ +#define LIBNET_OPT_EBIT 0x02 /* describes the way AS-external-LSAs are flooded */ +#define LIBNET_OPT_MCBIT 0x04 /* whether or not IP multicast dgrams are fwdd */ +#define LIBNET_OPT_NPBIT 0x08 /* describes handling of type-7 LSAs */ +#define LIBNET_OPT_EABIT 0x10 /* rtr's willingness to send/recv EA-LSAs */ +#define LIBNET_OPT_DCBIT 0x20 /* describes handling of demand circuits */ + + +/* + * MPLS header + * Multi-Protocol Label Switching + * Static header size: 4 bytes + */ +struct libnet_mpls_hdr +{ + u_int32_t mpls_les; /* 20 bits label, 3 bits exp, 1 bit bos, ttl */ +#define LIBNET_MPLS_BOS_ON 1 +#define LIBNET_MPLS_BOS_OFF 0 +}; + +/* + * NTP header + * Network Time Protocol + * Static header size: 48 bytes + */ +struct libnet_ntp_hdr_l_fp /* int32_t floating point (64-bit) */ +{ + u_int32_t integer; /* integer */ + u_int32_t fraction; /* fraction */ +}; + +struct libnet_ntp_hdr_s_fp /* int16_t floating point (32-bit) */ +{ + u_int16_t integer; /* integer */ + u_int16_t fraction; /* fraction */ +}; + + +struct libnet_ntp_hdr +{ + u_int8_t ntp_li_vn_mode; /* leap indicator, version, mode */ +#define LIBNET_NTP_LI_NW 0x0 /* no warning */ +#define LIBNET_NTP_LI_AS 0x1 /* last minute has 61 seconds */ +#define LIBNET_NTP_LI_DS 0x2 /* last minute has 59 seconds */ +#define LIBNET_NTP_LI_AC 0x3 /* alarm condition */ + +#define LIBNET_NTP_VN_2 0x2 /* version 2 */ +#define LIBNET_NTP_VN_3 0x3 /* version 3 */ +#define LIBNET_NTP_VN_4 0x4 /* version 4 */ + +#define LIBNET_NTP_MODE_R 0x0 /* reserved */ +#define LIBNET_NTP_MODE_A 0x1 /* symmetric active */ +#define LIBNET_NTP_MODE_P 0x2 /* symmetric passive */ +#define LIBNET_NTP_MODE_C 0x3 /* client */ +#define LIBNET_NTP_MODE_S 0x4 /* server */ +#define LIBNET_NTP_MODE_B 0x5 /* broadcast */ +#define LIBNET_NTP_MODE_RC 0x6 /* reserved for NTP control message */ +#define LIBNET_NTP_MODE_RP 0x7 /* reserved for private use */ + u_int8_t ntp_stratum; /* stratum */ +#define LIBNET_NTP_STRATUM_UNAVAIL 0x0 /* unspecified or unavailable */ +#define LIBNET_NTP_STRATUM_PRIMARY 0x1 /* primary reference (radio clock) */ + /* 2 - 15 is secondary */ + /* 16 - 255 is reserved */ + u_int8_t ntp_poll; /* poll interval (should be 4 - 12) */ + u_int8_t ntp_precision; /* local clock precision */ + struct libnet_ntp_hdr_s_fp ntp_delay; /* roundtrip delay */ + struct libnet_ntp_hdr_s_fp ntp_dispersion; /* nominal error */ + u_int32_t ntp_reference_id; /* reference source id */ +#define LIBNET_NTP_REF_LOCAL 0x4c4f434c /* uncalibrated local clock */ +#define LIBNET_NTP_REF_PPS 0x50505300 /* atomic / pulse-per-second clock */ +#define LIBNET_NTP_REF_ACTS 0x41435453 /* NIST dialup modem */ +#define LIBNET_NTP_REF_USNO 0x55534e4f /* USNO modem service */ +#define LIBNET_NTP_REF_PTB 0x50544200 /* PTB (German) modem service */ +#define LIBNET_NTP_REF_TDF 0x54444600 /* Allouis (French) radio */ +#define LIBNET_NTP_REF_DCF 0x44434600 /* Mainflingen (German) radio */ +#define LIBNET_NTP_REF_MSF 0x4d534600 /* Rugby (UK) radio */ +#define LIBNET_NTP_REF_WWV 0x57575600 /* Ft Collins (US) radio */ +#define LIBNET_NTP_REF_WWVB 0x57575642 /* Boulder (US) radio */ +#define LIBNET_NTP_REF_WWVH 0x57575648 /* Kaui Hawaii (US) radio */ +#define LIBNET_NTP_REF_CHU 0x43485500 /* Ottaha (Canada) radio */ +#define LIBNET_NTP_REF_LORC 0x4c4f5243 /* LORAN-C radionavigation */ +#define LIBNET_NTP_REF_OMEG 0x4f4d4547 /* OMEGA radionavigation */ +#define LIBNET_NTP_REF_GPS 0x47505300 /* global positioning system */ +#define LIBNET_NTP_REF_GOES 0x474f4553 /* geostationary orbit env satellite */ + struct libnet_ntp_hdr_l_fp ntp_ref_ts; /* reference timestamp */ + struct libnet_ntp_hdr_l_fp ntp_orig_ts; /* originate timestamp */ + struct libnet_ntp_hdr_l_fp ntp_rec_ts; /* receive timestamp */ + struct libnet_ntp_hdr_l_fp ntp_xmt_ts; /* transmit timestamp */ +}; + + +/* + * OSPFv2 header + * Open Shortest Path First + * Static header size: 16 bytes + */ +struct libnet_ospf_hdr +{ + u_int8_t ospf_v; /* version */ +#define OSPFVERSION 2 + u_int8_t ospf_type; /* type */ +#define LIBNET_OSPF_UMD 0 /* UMd monitoring packet */ +#define LIBNET_OSPF_HELLO 1 /* HELLO packet */ +#define LIBNET_OSPF_DBD 2 /* dataBase description packet */ +#define LIBNET_OSPF_LSR 3 /* link state request packet */ +#define LIBNET_OSPF_LSU 4 /* link state Update Packet */ +#define LIBNET_OSPF_LSA 5 /* link state acknowledgement packet */ + u_int16_t ospf_len; /* length */ + struct in_addr ospf_rtr_id; /* source router ID */ + struct in_addr ospf_area_id;/* roam ID */ + u_int16_t ospf_sum; /* checksum */ + u_int16_t ospf_auth_type; /* authentication type */ +#define LIBNET_OSPF_AUTH_NULL 0 /* null password */ +#define LIBNET_OSPF_AUTH_SIMPLE 1 /* simple, plaintext, 8 int8_t password */ +#define LIBNET_OSPF_AUTH_MD5 2 /* MD5 */ +}; + + +/* + * OSPF authentication header + * Open Shortest Path First + * Static header size: 8 bytes + */ +struct libnet_auth_hdr +{ + u_int16_t ospf_auth_null; /* NULL */ + u_int8_t ospf_auth_keyid; /* authentication key ID */ + u_int8_t ospf_auth_len; /* auth data length */ + u_int ospf_auth_seq; /* cryptographic sequence number */ +}; + + +/* + * OSPF hello header + * Open Shortest Path First + * Static header size: 28 bytes + */ +struct libnet_ospf_hello_hdr +{ + struct in_addr hello_nmask; /* netmask associated with the interface */ + u_int16_t hello_intrvl; /* num of seconds between routers last packet */ + u_int8_t hello_opts; /* Options for HELLO packets (look above) */ + u_int8_t hello_rtr_pri; /* router's priority (if 0, can't be backup) */ + u_int hello_dead_intvl; /* # of secs a router is silent till deemed down */ + struct in_addr hello_des_rtr; /* Designated router on the network */ + struct in_addr hello_bkup_rtr; /* Backup router */ + struct in_addr hello_nbr; /* neighbor router, memcpy more as needed */ +}; + + +/* + * Database Description header. + */ +struct libnet_dbd_hdr +{ + u_int16_t dbd_mtu_len; /* max length of IP dgram that this 'if' can use */ + u_int8_t dbd_opts; /* DBD packet options (from above) */ + u_int8_t dbd_type; /* type of exchange occurring */ +#define LIBNET_DBD_IBI 0x01 /* init */ +#define LIBNET_DBD_MBIT 0x02 /* more DBD packets are to come */ +#define LIBNET_DBD_MSBIT 0x04 /* If 1, sender is the master in the exchange */ + u_int dbd_seq; /* DBD sequence number */ +}; + + +/* + * used for the LS type field in all LS* headers + */ +#define LIBNET_LS_TYPE_RTR 1 /* router-LSA */ +#define LIBNET_LS_TYPE_NET 2 /* network-LSA */ +#define LIBNET_LS_TYPE_IP 3 /* summary-LSA (IP Network) */ +#define LIBNET_LS_TYPE_ASBR 4 /* summary-LSA (ASBR) */ +#define LIBNET_LS_TYPE_ASEXT 5 /* AS-external-LSA */ + + +/* + * Link State Request header + */ +struct libnet_lsr_hdr +{ + u_int lsr_type; /* type of LS being requested */ + u_int lsr_lsid; /* link state ID */ + struct in_addr lsr_adrtr; /* advertising router (memcpy more as needed) */ +}; + + +/* + * Link State Update header + */ +struct libnet_lsu_hdr +{ + u_int lsu_num; /* number of LSAs that will be broadcasted */ +}; + + +/* + * Link State Acknowledgement header. + */ +struct libnet_lsa_hdr +{ + u_int16_t lsa_age; /* time in seconds since the LSA was originated */ + u_int8_t lsa_opts; /* look above for OPTS_* */ + u_int8_t lsa_type; /* look below for LS_TYPE_* */ + u_int lsa_id; /* link State ID */ + struct in_addr lsa_adv; /* router ID of Advertising router */ + u_int lsa_seq; /* LSA sequence number to detect old/bad ones */ + u_int16_t lsa_sum; /* "Fletcher Checksum" of all fields minus age */ + u_int16_t lsa_len; /* length in bytes including the 20 byte header */ +}; + + +/* + * Router LSA data format + * + * Other stuff for TOS can be added for backward compatability, for this + * version, only OSPFv2 is being FULLY supported. + */ +struct libnet_rtr_lsa_hdr +{ + u_int16_t rtr_flags; /* set to help describe packet */ +#define LIBNET_RTR_FLAGS_W 0x0100 /* W bit */ +#define LIBNET_RTR_FLAGS_E 0x0200 /* E bit */ +#define LIBNET_RTR_FLAGS_B 0x0400 /* B bit */ + u_int16_t rtr_num; /* number of links within that packet */ + u_int rtr_link_id; /* describes link_data (look below) */ +#define LIBNET_LINK_ID_NBR_ID 1 /* Neighbors router ID, also can be 4 */ +#define LIBNET_LINK_ID_IP_DES 2 /* IP address of designated router */ +#define LIBNET_LINK_ID_SUB 3 /* IP subnet number */ + u_int rtr_link_data; /* Depending on link_id, info is here */ + u_int8_t rtr_type; /* Description of router link */ +#define LIBNET_RTR_TYPE_PTP 1 /* Point-To-Point */ +#define LIBNET_RTR_TYPE_TRANS 2 /* Connection to a "transit network" */ +#define LIBNET_RTR_TYPE_STUB 3 /* Connectin to a "stub network" */ +#define RTR_TYPE_VRTL 4 /* connects to a "virtual link" */ + u_int8_t rtr_tos_num; /* number of different TOS metrics for this link */ + u_int16_t rtr_metric; /* the "cost" of using this link */ +}; + + +/* + * Network LSA data format. + */ +struct libnet_net_lsa_hdr +{ + struct in_addr net_nmask; /* Netmask for that network */ + u_int net_rtr_id; /* ID of router attached to that network */ +}; + + +/* + * Summary LSA data format. + */ +struct libnet_sum_lsa_hdr +{ + struct in_addr sum_nmask; /* Netmask of destination IP address */ + u_int sum_metric; /* Same as in rtr_lsa (&0xfff to use last 24bit */ + u_int sum_tos_metric; /* first 8bits are TOS, 24bits are TOS Metric */ +}; + + +/* + * AS External LSA data format. + * & 0xfff logic operator for as_metric to get last 24bits. + */ +struct libnet_as_lsa_hdr +{ + struct in_addr as_nmask; /* Netmask for advertised destination */ + u_int as_metric; /* May have to set E bit in first 8bits */ +#define LIBNET_AS_E_BIT_ON 0x80000000 /* as_metric */ + struct in_addr as_fwd_addr; /* Forwarding address */ + u_int as_rte_tag; /* External route tag */ +}; + + +/* + * Base RIP header + * Routing Information Protocol + * Base header size: 24 bytes + */ +struct libnet_rip_hdr +{ + u_int8_t rip_cmd; /* RIP command */ +#define RIPCMD_REQUEST 1 /* want info */ +#define RIPCMD_RESPONSE 2 /* responding to request */ +#define RIPCMD_TRACEON 3 /* turn tracing on */ +#define RIPCMD_TRACEOFF 4 /* turn it off */ +#define RIPCMD_POLL 5 /* like request, but anyone answers */ +#define RIPCMD_POLLENTRY 6 /* like poll, but for entire entry */ +#define RIPCMD_MAX 7 /* ? command */ + u_int8_t rip_ver; /* RIP version */ +#define RIPVER_0 0 +#define RIPVER_1 1 +#define RIPVER_2 2 + u_int16_t rip_rd; /* Zero (v1) or Routing Domain (v2) */ + u_int16_t rip_af; /* Address family */ + u_int16_t rip_rt; /* Zero (v1) or Route Tag (v2) */ + u_int32_t rip_addr; /* IP address */ + u_int32_t rip_mask; /* Zero (v1) or Subnet Mask (v2) */ + u_int32_t rip_next_hop; /* Zero (v1) or Next hop IP address (v2) */ + u_int32_t rip_metric; /* Metric */ +}; + +/* + * RPC headers + * Remote Procedure Call + */ +#define LIBNET_RPC_CALL 0 +#define LIBNET_RPC_REPLY 1 +#define LIBNET_RPC_VERS 2 +#define LIBNET_RPC_LAST_FRAG 0x80000000 + +/* + * Portmap defines + */ +#define LIBNET_PMAP_PROGRAM 100000 +#define LIBNET_PMAP_PROC_NULL 0 +#define LIBNET_PMAP_PROC_SET 1 +#define LIBNET_PMAP_PROC_UNSET 2 +#define LIBNET_PMAP_PROC_GETADDR 3 +#define LIBNET_PMAP_PROC_DUMP 4 +#define LIBNET_PMAP_PROC_CALLIT 5 +#define LIBNET_PMAP_PROC_BCAST 5 /* Not a typo */ +#define LIBNET_PMAP_PROC_GETTIME 6 +#define LIBNET_PMAP_PROC_UADDR2TADDR 7 +#define LIBNET_PMAP_PROC_TADDR2UADDR 8 +#define LIBNET_PMAP_PROC_GETVERSADDR 9 +#define LIBNET_PMAP_PROC_INDIRECT 10 +#define LIBNET_PMAP_PROC_GETADDRLIST 11 +#define LIBNET_PMAP_PROC_GETSTAT 12 + +/* There will be more to add... */ + +struct libnet_rpc_opaque_auth +{ + u_int32_t rpc_auth_flavor; + u_int32_t rpc_auth_length; +#if 0 + u_int8_t *rpc_auth_data; +#endif +}; + +struct libnet_rpc_call +{ + u_int32_t rpc_rpcvers; /* RPC version - must be 2 */ + u_int32_t rpc_prognum; /* Program Number */ + u_int32_t rpc_vers; /* Program Version */ + u_int32_t rpc_procedure; /* RPC procedure */ + struct libnet_rpc_opaque_auth rpc_credentials; + struct libnet_rpc_opaque_auth rpc_verifier; +}; + +struct libnet_rpc_call_hdr +{ + u_int32_t rpc_xid; /* xid (transaction identifier) */ + u_int32_t rpc_type; + struct libnet_rpc_call rpc_call; +}; + +struct libnet_rpc_call_tcp_hdr +{ + u_int32_t rpc_record_marking; /* used with byte stream protocols */ + struct libnet_rpc_call_hdr rpc_common; +}; + +/* + * STP configuration header + * Spanning Tree Protocol + * Static header size: 35 bytes + */ +struct libnet_stp_conf_hdr +{ + u_int16_t stp_id; /* protocol id */ + u_int8_t stp_version; /* protocol version */ + u_int8_t stp_bpdu_type; /* bridge protocol data unit type */ + u_int8_t stp_flags; /* control flags */ + u_int8_t stp_rootid[8]; /* root id */ + u_int32_t stp_rootpc; /* root path cost */ + u_int8_t stp_bridgeid[8]; /* bridge id */ + u_int16_t stp_portid; /* port id */ + u_int16_t stp_mage; /* message age */ + u_int16_t stp_maxage; /* max age */ + u_int16_t stp_hellot; /* hello time */ + u_int16_t stp_fdelay; /* forward delay */ +}; + + +/* + * STP topology change notification header + * Spanning Tree Protocol + * Static header size: 4 bytes + */ +struct libnet_stp_tcn_hdr +{ + u_int16_t stp_id; /* protocol id */ + u_int8_t stp_version; /* protocol version */ + u_int8_t stp_bpdu_type; /* bridge protocol data unit type */ +}; + + +/* + * TCP header + * Transmission Control Protocol + * Static header size: 20 bytes + */ +struct libnet_tcp_hdr +{ + u_int16_t th_sport; /* source port */ + u_int16_t th_dport; /* destination port */ + u_int32_t th_seq; /* sequence number */ + u_int32_t th_ack; /* acknowledgement number */ +#if (LIBNET_LIL_ENDIAN) + u_int8_t th_x2:4, /* (unused) */ + th_off:4; /* data offset */ +#endif +#if (LIBNET_BIG_ENDIAN) + u_int8_t th_off:4, /* data offset */ + th_x2:4; /* (unused) */ +#endif + u_int8_t th_flags; /* control flags */ +#ifndef TH_FIN +#define TH_FIN 0x01 /* finished send data */ +#endif +#ifndef TH_SYN +#define TH_SYN 0x02 /* synchronize sequence numbers */ +#endif +#ifndef TH_RST +#define TH_RST 0x04 /* reset the connection */ +#endif +#ifndef TH_PUSH +#define TH_PUSH 0x08 /* push data to the app layer */ +#endif +#ifndef TH_ACK +#define TH_ACK 0x10 /* acknowledge */ +#endif +#ifndef TH_URG +#define TH_URG 0x20 /* urgent! */ +#endif +#ifndef TH_ECE +#define TH_ECE 0x40 +#endif +#ifndef TH_CWR +#define TH_CWR 0x80 +#endif + u_int16_t th_win; /* window */ + u_int16_t th_sum; /* checksum */ + u_int16_t th_urp; /* urgent pointer */ +}; + +/* + * Token Ring Header + */ +struct libnet_token_ring_hdr +{ + u_int8_t token_ring_access_control; +#define LIBNET_TOKEN_RING_FRAME 0x10 + u_int8_t token_ring_frame_control; +#define LIBNET_TOKEN_RING_LLC_FRAME 0x40 + u_int8_t token_ring_dhost[TOKEN_RING_ADDR_LEN]; + u_int8_t token_ring_shost[TOKEN_RING_ADDR_LEN]; + u_int8_t token_ring_llc_dsap; + u_int8_t token_ring_llc_ssap; + u_int8_t token_ring_llc_control_field; + u_int8_t token_ring_llc_org_code[LIBNET_ORG_CODE_SIZE]; + u_int16_t token_ring_type; +#define TOKEN_RING_TYPE_IP 0x0800 /* IP protocol */ +#define TOKEN_RING_TYPE_ARP 0x0806 /* addr. resolution protocol */ +#define TOKEN_RING_TYPE_REVARP 0x8035 /* reverse addr. resolution protocol */ +}; + +struct libnet_token_ring_addr +{ + u_int8_t token_ring_addr_octet[6]; /* Token Ring address */ +}; + +/* + * UDP header + * User Data Protocol + * Static header size: 8 bytes + */ +struct libnet_udp_hdr +{ + u_int16_t uh_sport; /* soure port */ + u_int16_t uh_dport; /* destination port */ + u_int16_t uh_ulen; /* length */ + u_int16_t uh_sum; /* checksum */ +}; + +/* + * Sebek header + * Static header size: 48 bytes + */ +struct libnet_sebek_hdr +{ + u_int32_t magic; /* identify packets that should be hidden */ + u_int16_t version; /* protocol version, currently 1 */ +#define SEBEK_PROTO_VERSION 1 + u_int16_t type; /* type of record (read data is type 0, write data is type 1) */ +#define SEBEK_TYPE_READ 0 /* Currently, only read is supported */ +#define SEBEK_TYPE_WRITE 1 + u_int32_t counter; /* PDU counter used to identify when packet are lost */ + u_int32_t time_sec; /* seconds since EPOCH according to the honeypot */ + u_int32_t time_usec; /* residual microseconds */ + u_int32_t pid; /* PID */ + u_int32_t uid; /* UID */ + u_int32_t fd; /* FD */ +#define SEBEK_CMD_LENGTH 12 + u_int8_t cmd[SEBEK_CMD_LENGTH]; /* 12 first characters of the command */ + u_int32_t length; /* length in bytes of the PDU's body */ +}; + + +/* + * VRRP header + * Virtual Router Redundancy Protocol + * Static header size: 8 bytes + */ +#ifndef IPPROTO_VRRP +#define IPPROTO_VRRP 112 /* not everyone's got this */ +#endif +struct libnet_vrrp_hdr +{ +#if (LIBNET_LIL_ENDIAN) + u_int8_t vrrp_v:4, /* protocol version */ + vrrp_t:4; /* packet type */ +#endif +#if (LIBNET_BIG_ENDIAN) + u_int8_t vrrp_t:4, /* packet type */ + vrrp_v:4; /* protocol version */ +#endif +#define LIBNET_VRRP_VERSION_01 0x1 +#define LIBNET_VRRP_VERSION_02 0x2 +#define LIBNET_VRRP_TYPE_ADVERT 0x1 + u_int8_t vrrp_vrouter_id; /* virtual router id */ + u_int8_t vrrp_priority; /* priority */ + u_int8_t vrrp_ip_count; /* number of IP addresses */ + u_int8_t vrrp_auth_type; /* authorization type */ +#define LIBNET_VRRP_AUTH_NONE 0x1 +#define LIBNET_VRRP_AUTH_PASSWD 0x2 +#define LIBNET_VRRP_AUTH_IPAH 0x3 + u_int8_t vrrp_advert_int; /* advertisement interval */ + u_int16_t vrrp_sum; /* checksum */ + /* additional addresses */ + /* authentication info */ +}; + + +/* + * HSRP header + * Static header size: 20 bytes + */ +struct libnet_hsrp_hdr +{ +#define LIBNET_HSRP_VERSION 0x0 + u_int8_t version; /* Version of the HSRP messages */ +#define LIBNET_HSRP_TYPE_HELLO 0x0 +#define LIBNET_HSRP_TYPE_COUP 0x1 +#define LIBNET_HSRP_TYPE_RESIGN 0x2 + u_int8_t opcode; /* Type of message */ +#define LIBNET_HSRP_STATE_INITIAL 0x0 +#define LIBNET_HSRP_STATE_LEARN 0x1 +#define LIBNET_HSRP_STATE_LISTEN 0x2 +#define LIBNET_HSRP_STATE_SPEAK 0x4 +#define LIBNET_HSRP_STATE_STANDBY 0x8 +#define LIBNET_HSRP_STATE_ACTIVE 0x10 + u_int8_t state; /* Current state of the router */ + u_int8_t hello_time; /* Period in seconds between hello messages */ + u_int8_t hold_time; /* Seconds that the current hello message is valid */ + u_int8_t priority; /* Priority for the election proccess */ + u_int8_t group; /* Standby group */ + u_int8_t reserved; /* Reserved field */ +#define HSRP_AUTHDATA_LENGTH 8 + u_int8_t authdata[HSRP_AUTHDATA_LENGTH]; /* Password */ + u_int32_t virtual_ip; /* Virtual IP address */ +}; + +#endif /* __LIBNET_HEADERS_H */ + +/* EOF */ diff --git a/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-macros.h b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-macros.h new file mode 100644 index 0000000..c4695f3 --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-macros.h @@ -0,0 +1,204 @@ +/* + * $Id: libnet-macros.h,v 1.7 2004/04/13 17:32:28 mike Exp $ + * + * libnet-macros.h - Network routine library macro header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_MACROS_H +#define __LIBNET_MACROS_H +/** + * @file libnet-macros.h + * @brief libnet macros and symbolic constants + */ + +/* for systems without snprintf */ +#if defined(NO_SNPRINTF) +#define snprintf(buf, len, args...) sprintf(buf, ##args) +#endif + + +/** + * Used for libnet's name resolution functions, specifies that no DNS lookups + * should be performed and the IP address should be kept in numeric form. + */ +#define LIBNET_DONT_RESOLVE 0 + +/** + * Used for libnet's name resolution functions, specifies that a DNS lookup + * can be performed if needed to resolve the IP address to a canonical form. + */ +#define LIBNET_RESOLVE 1 + +/** + * Used several places, to specify "on" or "one" + */ +#define LIBNET_ON 0 + +/** + * Used several places, to specify "on" or "one" + */ +#define LIBNET_OFF 1 + +/** + * IPv6 error code + */ +#ifndef IN6ADDR_ERROR_INIT +#define IN6ADDR_ERROR_INIT { { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff } } } +#endif + +/** + * Used for libnet_get_prand() to specify function disposition + */ +#define LIBNET_PR2 0 +#define LIBNET_PR8 1 +#define LIBNET_PR16 2 +#define LIBNET_PRu16 3 +#define LIBNET_PR32 4 +#define LIBNET_PRu32 5 +#define LIBNET_PRAND_MAX 0xffffffff + +/** + * The biggest an IP packet can be -- 65,535 bytes. + */ +#define LIBNET_MAX_PACKET 0xffff +#ifndef IP_MAXPACKET +#define IP_MAXPACKET 0xffff +#endif + + +/* ethernet addresses are 6 octets long */ +#ifndef ETHER_ADDR_LEN +#define ETHER_ADDR_LEN 0x6 +#endif + +/* FDDI addresses are 6 octets long */ +#ifndef FDDI_ADDR_LEN +#define FDDI_ADDR_LEN 0x6 +#endif + +/* token ring addresses are 6 octets long */ +#ifndef TOKEN_RING_ADDR_LEN +#define TOKEN_RING_ADDR_LEN 0x6 +#endif + +/* LLC Organization Code is 3 bytes long */ +#define LIBNET_ORG_CODE_SIZE 0x3 + +/** + * The libnet error buffer is 256 bytes long. + */ +#define LIBNET_ERRBUF_SIZE 0x100 + +/** + * IP and TCP options can be up to 40 bytes long. + */ +#define LIBNET_MAXOPTION_SIZE 0x28 + +/* some BSD variants have this endianess problem */ +#if (LIBNET_BSD_BYTE_SWAP) +#define FIX(n) ntohs(n) +#define UNFIX(n) htons(n) +#else +#define FIX(n) (n) +#define UNFIX(n) (n) +#endif + +/* used internally for packet builders */ +#define LIBNET_DO_PAYLOAD(l, p) \ +if ((payload && !payload_s) || (!payload && payload_s)) \ +{ \ + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, \ + "%s(): payload inconsistency\n", __func__); \ + goto bad; \ +} \ +if (payload && payload_s) \ +{ \ + n = libnet_pblock_append(l, p, payload, payload_s); \ + if (n == (u_int32_t) - 1) \ + { \ + goto bad; \ + } \ +} \ + + +/* used internally for checksum stuff */ +#define LIBNET_CKSUM_CARRY(x) \ + (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff)) + +/* used interally for OSPF stuff */ +#define LIBNET_OSPF_AUTHCPY(x, y) \ + memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y)) +#define LIBNET_OSPF_CKSUMBUF(x, y) \ + memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y)) + +/* used internally for NTP leap indicator, version, and mode */ +#define LIBNET_NTP_DO_LI_VN_MODE(li, vn, md) \ + ((u_int8_t)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7))) + +/* Not all systems have IFF_LOOPBACK */ +#ifdef IFF_LOOPBACK +#define LIBNET_ISLOOPBACK(p) ((p)->ifr_flags & IFF_LOOPBACK) +#else +#define LIBNET_ISLOOPBACK(p) (strcmp((p)->ifr_name, "lo0") == 0) +#endif + +/* advanced mode check */ +#define LIBNET_ISADVMODE(x) (x & 0x08) + +/* context queue macros and constants */ +#define LIBNET_LABEL_SIZE 64 +#define LIBNET_LABEL_DEFAULT "cardshark" +#define CQ_LOCK_UNLOCKED (u_int)0x00000000 +#define CQ_LOCK_READ (u_int)0x00000001 +#define CQ_LOCK_WRITE (u_int)0x00000002 + +/** + * Provides an interface to iterate through the context queue of libnet + * contexts. Before calling this macro, be sure to set the queue using + * libnet_cq_head(). + */ +#define for_each_context_in_cq(l) \ + for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next()) + +/* return 1 if write lock is set on cq */ +#define cq_is_wlocked() (l_cqd.cq_lock & CQ_LOCK_WRITE) + +/* return 1 if read lock is set on cq */ +#define cq_is_rlocked() (l_cqd.cq_lock & CQ_LOCK_READ) + +/* return 1 if any lock is set on cq */ +#define cq_is_locked() (l_cqd.cq_lock & (CQ_LOCK_READ | CQ_LOCK_WRITE)) + +/* check if a context queue is locked */ +#define check_cq_lock(x) (l_cqd.cq_lock & x) + +#endif /* __LIBNET_MACROS_H */ + +/* EOF */ diff --git a/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-structures.h b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-structures.h new file mode 100644 index 0000000..477190e --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-structures.h @@ -0,0 +1,234 @@ +/* + * $Id: libnet-structures.h,v 1.19 2004/11/09 07:05:07 mike Exp $ + * + * libnet-structures.h - Network routine library structures header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_STRUCTURES_H +#define __LIBNET_STRUCTURES_H + +#if ((__WIN32__) && !(__CYGWIN__)) +#include "Packet32.h" +#endif + +/* port list chain structure */ +typedef struct libnet_port_list_chain libnet_plist_t; +struct libnet_port_list_chain +{ + u_int16_t node; /* node number */ + u_int16_t bport; /* beggining port */ + u_int16_t eport; /* terminating port */ + u_int8_t id; /* global array offset */ + libnet_plist_t *next; /* next node in the list */ +}; + + +/* libnet statistics structure */ +struct libnet_stats +{ +#if (!defined(__WIN32__) || (__CYGWIN__)) + u_int64_t packets_sent; /* packets sent */ + u_int64_t packet_errors; /* packets errors */ + u_int64_t bytes_written; /* bytes written */ +#else + __int64 packets_sent; /* packets sent */ + __int64 packet_errors; /* packets errors */ + __int64 bytes_written; /* bytes written */ +#endif +}; + + +/* + * Libnet ptags are how we identify specific protocol blocks inside the + * list. + */ +typedef int32_t libnet_ptag_t; +#define LIBNET_PTAG_INITIALIZER 0 + + +/* + * Libnet generic protocol block memory object. Sort of a poor man's mbuf. + */ +struct libnet_protocol_block +{ + u_int8_t *buf; /* protocol buffer */ + u_int32_t b_len; /* length of buf */ + u_int16_t h_len; /* header length (for checksumming) */ + /* Unused for IPV4_H block types. + * For protocols that sit on top of IP, it should be the the amount of + * buf that is the header, and will be included in the checksum. + */ + u_int32_t ip_offset; /* offset from end of pkt to beginning of IP header for csums */ + /* Unused for IPV4_H block types. + * For protocols that sit on top of IP (UDP, ICMP, ...), they often + * include some information from the IP header (in the form of a "pseudo + * header") in their own checksum calculation. To build that + * pseudo-header, thet need to find the real header. + */ + u_int32_t copied; /* bytes copied - the amount of data copied into buf */ + /* Used and updated by libnet_pblock_append(). */ + u_int8_t type; /* type of pblock */ +/* this needs to be updated every time a new packet builder is added */ +#define LIBNET_PBLOCK_ARP_H 0x01 /* ARP header */ +#define LIBNET_PBLOCK_DHCPV4_H 0x02 /* DHCP v4 header */ +#define LIBNET_PBLOCK_DNSV4_H 0x03 /* DNS v4 header */ +#define LIBNET_PBLOCK_ETH_H 0x04 /* Ethernet header */ +#define LIBNET_PBLOCK_ICMPV4_H 0x05 /* ICMP v4 base header */ +#define LIBNET_PBLOCK_ICMPV4_ECHO_H 0x06 /* ICMP v4 echo header */ +#define LIBNET_PBLOCK_ICMPV4_MASK_H 0x07 /* ICMP v4 mask header */ +#define LIBNET_PBLOCK_ICMPV4_UNREACH_H 0x08 /* ICMP v4 unreach header */ +#define LIBNET_PBLOCK_ICMPV4_TIMXCEED_H 0x09 /* ICMP v4 exceed header */ +#define LIBNET_PBLOCK_ICMPV4_REDIRECT_H 0x0a /* ICMP v4 redirect header */ +#define LIBNET_PBLOCK_ICMPV4_TS_H 0x0b /* ICMP v4 timestamp header */ +#define LIBNET_PBLOCK_IGMP_H 0x0c /* IGMP header */ +#define LIBNET_PBLOCK_IPV4_H 0x0d /* IP v4 header */ +#define LIBNET_PBLOCK_IPO_H 0x0e /* IP v4 options */ +#define LIBNET_PBLOCK_IPDATA 0x0f /* IP data */ +#define LIBNET_PBLOCK_OSPF_H 0x10 /* OSPF base header */ +#define LIBNET_PBLOCK_OSPF_HELLO_H 0x11 /* OSPF hello header */ +#define LIBNET_PBLOCK_OSPF_DBD_H 0x12 /* OSPF dbd header */ +#define LIBNET_PBLOCK_OSPF_LSR_H 0x13 /* OSPF lsr header */ +#define LIBNET_PBLOCK_OSPF_LSU_H 0x14 /* OSPF lsu header */ +#define LIBNET_PBLOCK_OSPF_LSA_H 0x15 /* OSPF lsa header */ +#define LIBNET_PBLOCK_OSPF_AUTH_H 0x16 /* OSPF auth header */ +#define LIBNET_PBLOCK_OSPF_CKSUM 0x17 /* OSPF checksum header */ +#define LIBNET_PBLOCK_LS_RTR_H 0x18 /* linkstate rtr header */ +#define LIBNET_PBLOCK_LS_NET_H 0x19 /* linkstate net header */ +#define LIBNET_PBLOCK_LS_SUM_H 0x1a /* linkstate as sum header */ +#define LIBNET_PBLOCK_LS_AS_EXT_H 0x1b /* linkstate as ext header */ +#define LIBNET_PBLOCK_NTP_H 0x1c /* NTP header */ +#define LIBNET_PBLOCK_RIP_H 0x1d /* RIP header */ +#define LIBNET_PBLOCK_TCP_H 0x1e /* TCP header */ +#define LIBNET_PBLOCK_TCPO_H 0x1f /* TCP options */ +#define LIBNET_PBLOCK_TCPDATA 0x20 /* TCP data */ +#define LIBNET_PBLOCK_UDP_H 0x21 /* UDP header */ +#define LIBNET_PBLOCK_VRRP_H 0x22 /* VRRP header */ +#define LIBNET_PBLOCK_DATA_H 0x23 /* generic data */ +#define LIBNET_PBLOCK_CDP_H 0x24 /* CDP header */ +#define LIBNET_PBLOCK_IPSEC_ESP_HDR_H 0x25 /* IPSEC ESP header */ +#define LIBNET_PBLOCK_IPSEC_ESP_FTR_H 0x26 /* IPSEC ESP footer */ +#define LIBNET_PBLOCK_IPSEC_AH_H 0x27 /* IPSEC AH header */ +#define LIBNET_PBLOCK_802_1Q_H 0x28 /* 802.1q header */ +#define LIBNET_PBLOCK_802_2_H 0x29 /* 802.2 header */ +#define LIBNET_PBLOCK_802_2SNAP_H 0x2a /* 802.2 SNAP header */ +#define LIBNET_PBLOCK_802_3_H 0x2b /* 802.3 header */ +#define LIBNET_PBLOCK_STP_CONF_H 0x2c /* STP configuration header */ +#define LIBNET_PBLOCK_STP_TCN_H 0x2d /* STP TCN header */ +#define LIBNET_PBLOCK_ISL_H 0x2e /* ISL header */ +#define LIBNET_PBLOCK_IPV6_H 0x2f /* IP v6 header */ +#define LIBNET_PBLOCK_802_1X_H 0x30 /* 802.1x header */ +#define LIBNET_PBLOCK_RPC_CALL_H 0x31 /* RPC Call header */ +#define LIBNET_PBLOCK_MPLS_H 0x32 /* MPLS header */ +#define LIBNET_PBLOCK_FDDI_H 0x33 /* FDDI header */ +#define LIBNET_PBLOCK_TOKEN_RING_H 0x34 /* TOKEN RING header */ +#define LIBNET_PBLOCK_BGP4_HEADER_H 0x35 /* BGP4 header */ +#define LIBNET_PBLOCK_BGP4_OPEN_H 0x36 /* BGP4 open header */ +#define LIBNET_PBLOCK_BGP4_UPDATE_H 0x37 /* BGP4 update header */ +#define LIBNET_PBLOCK_BGP4_NOTIFICATION_H 0x38 /* BGP4 notification header */ +#define LIBNET_PBLOCK_GRE_H 0x39 /* GRE header */ +#define LIBNET_PBLOCK_GRE_SRE_H 0x3a /* GRE SRE header */ +#define LIBNET_PBLOCK_IPV6_FRAG_H 0x3b /* IPv6 frag header */ +#define LIBNET_PBLOCK_IPV6_ROUTING_H 0x3c /* IPv6 routing header */ +#define LIBNET_PBLOCK_IPV6_DESTOPTS_H 0x3d /* IPv6 dest opts header */ +#define LIBNET_PBLOCK_IPV6_HBHOPTS_H 0x3e /* IPv6 hop/hop opts header */ +#define LIBNET_PBLOCK_SEBEK_H 0x3f /* Sebek header */ +#define LIBNET_PBLOCK_HSRP_H 0x40 /* HSRP header */ + u_int8_t flags; /* control flags */ +#define LIBNET_PBLOCK_DO_CHECKSUM 0x01 /* needs a checksum */ + libnet_ptag_t ptag; /* protocol block tag */ + struct libnet_protocol_block *next; /* next pblock */ + struct libnet_protocol_block *prev; /* prev pblock */ +}; +typedef struct libnet_protocol_block libnet_pblock_t; + + +/* + * Libnet context + * Opaque structure. Nothing in here should ever been touched first hand by + * the applications programmer. + */ +struct libnet_context +{ +#if ((__WIN32__) && !(__CYGWIN__)) + SOCKET fd; + LPADAPTER lpAdapter; +#else + int fd; /* file descriptor of packet device */ +#endif + int injection_type; /* raw (ipv4 or ipv6) or link */ +#define LIBNET_LINK 0x00 /* link-layer interface */ +#define LIBNET_RAW4 0x01 /* raw socket interface (ipv4) */ +#define LIBNET_RAW6 0x02 /* raw socket interface (ipv6) */ +/* the following should actually set a flag in the flags variable above */ +#define LIBNET_LINK_ADV 0x08 /* advanced mode link-layer */ +#define LIBNET_RAW4_ADV 0x09 /* advanced mode raw socket (ipv4) */ +#define LIBNET_RAW6_ADV 0x0a /* advanced mode raw socket (ipv6) */ +#define LIBNET_ADV_MASK 0x08 /* mask to determine adv mode */ + + libnet_pblock_t *protocol_blocks; /* protocol headers / data */ + libnet_pblock_t *pblock_end; /* last node in list */ + u_int32_t n_pblocks; /* number of pblocks */ + + int link_type; /* link-layer type */ + int link_offset; /* link-layer header size */ + int aligner; /* used to align packets */ + char *device; /* device name */ + + struct libnet_stats stats; /* statistics */ + libnet_ptag_t ptag_state; /* state holder for pblock tag */ + char label[LIBNET_LABEL_SIZE]; /* textual label for cq interface */ + + char err_buf[LIBNET_ERRBUF_SIZE]; /* error buffer */ + u_int32_t total_size; /* total size */ +}; +typedef struct libnet_context libnet_t; + +/* + * Libnet context queue structure + * Opaque structure. Nothing in here should ever been touched first hand by + * the applications programmer. + */ +typedef struct _libnet_context_queue libnet_cq_t; +struct _libnet_context_queue +{ + libnet_t *context; /* pointer to libnet context */ + libnet_cq_t *next; /* next node in the list */ + libnet_cq_t *prev; /* previous node in the list */ +}; + +struct _libnet_context_queue_descriptor +{ + u_int32_t node; /* number of nodes in the list */ + u_int32_t cq_lock; /* lock status */ + libnet_cq_t *current; /* current context */ +}; +typedef struct _libnet_context_queue_descriptor libnet_cqd_t; + +#endif /* __LIBNET_STRUCTURES_H */ + +/* EOF */ diff --git a/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-types.h b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-types.h new file mode 100644 index 0000000..cc5897e --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/include/libnet/libnet-types.h @@ -0,0 +1,48 @@ +/* + * $Id: libnet-types.h,v 1.3 2004/01/03 20:31:00 mike Exp $ + * + * libnet-types.h - Network routine library macro header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_TYPES_H +#define __LIBNET_TYPES_H + +#if (__sun__ && __svr4__) +/* libnet should be using the standard type names, but in the short term + * define our non-standard type names in terms of the standard names. + */ +#include <inttypes.h> +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; +#endif + +#endif /* __LIBNET_TYPES_H */ + +/* EOF */ diff --git a/unmerged/debian/libnet1-dev/usr/lib/libnet.so b/unmerged/debian/libnet1-dev/usr/lib/libnet.so new file mode 120000 index 0000000..501e384 --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/lib/libnet.so @@ -0,0 +1 @@ +libnet.so.1.5.0
\ No newline at end of file diff --git a/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/README.Debian b/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/README.Debian new file mode 100644 index 0000000..a51106f --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/README.Debian @@ -0,0 +1,31 @@ +Message received at 224674@bugs.debian.org: + +Date: Tue, 6 Jan 2004 17:13:04 +0100 +From: Enrico Zini <zinie@cs.unibo.it> + +... + + From what I've seen in the libnet mailing list, the current libnet +package still has documentation and function export issues: + + - if that function is only used internally, it should not be exported + in the header file + - the HTML documentation seems to refer to the old API of libnet + - I've later found out that the manpage suggests to create many libnet + contexts if one wants to create many packets at a time; although I + don't really like that idea, there is a documented way of doing it + and many packets can be created without using libnet_pblock_coalesce + - In the mailing list, sandr8 suggests to use libnet_adv_cull_packet(), + however that function is not documented in the manpage, but only as a + short comment in the header file, which doesn't tell how and if the + resulting packet should be deallocated + - In the mailing list, sandr8 and Mike Schiffman suggest using the + context queue interface, for which I haven't found any documented + overview on what its concepts are, but only the single functions + briefly documented in the header file + - Mike Schiffman also talks about initializing libnet with the ADVANCED + interface, but again I only found the LIBNET_????_ADV constants + briefly documented, with no overview on what the advanced mode is and + does + +... diff --git a/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/changelog.Debian.gz b/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/changelog.Debian.gz Binary files differnew file mode 100644 index 0000000..92759cd --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/changelog.Debian.gz diff --git a/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/changelog.gz b/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/changelog.gz Binary files differnew file mode 100644 index 0000000..0f0c0f8 --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/changelog.gz diff --git a/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/copyright b/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/copyright new file mode 100644 index 0000000..b776c81 --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/share/doc/libnet1-dev/copyright @@ -0,0 +1,234 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Upstream-Author: Mike D. Schiffman <mike@infonexus.com> +Packaged-By: Domenico Andreoli <cavok@debian.org> +Packaged-Date: Mon, 18 Nov 2002 23:53:40 +0100 +Original-Source-Location: http://www.packetfactory.net/libnet/ + +Files: debian/* +Copyright: © 2008, David Paleino <d.paleino@gmail.com> + © 2002-2008, Domenico Andreoli <cavok@debian.org> +License: BSD-2 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED.IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: include/bpf.h + include/win32/getopt.h + include/win32/in_systm.h + sample/win32/getopt.c +Copyright: © 1982-1997, The Regents of the University of California +License: BSD-4 + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +Files: include/ifaddrlist.h +Copyright: © 1997, The Regents of the University of California +License: BSD-3 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +Files: include/libnet/libnet-asn1.h +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1989, Carnegie Mellon University +License: BSD-2 | other + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: sample/bgp4* + sample/dns.c + sample/gre.c + sample/ip_link.c + sample/ip_raw.c + sample/sebek.c + sample/tftp.c + src/libnet_build_bgp.c + src/libnet_build_gre.c +Copyright: © 2003-2004 Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/icmp_redirect.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Alberto Ornaghi <alor@antifork.org> +License: BSD-2 + +Files: sample/icmp_timeexceed.c + src/libnet_build_sebek.c + src/libnet_cq.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/ospf* + src/libnet_build_ospf.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2000, Andrew Reiter <areiter@bindview.com> +License: BSD-2 + +Files: sample/ping_of_death.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2001, Dug Song <dugsong@monkey.org> +License: BSD-2 + +Files: srct/libnet_asn1.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1992, Carnegie Mellon University + © 1993-1996, 1998, The Regents of the University of California +License: BSD-3 | other +==> BSD-3 <== + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +==> other <== + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: src/libnet_build_fddi.c + src/libnet_build_rpc.c + src/libnet_build_token_ring.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © Jason Damron <jsdamron@hushmail.com> <jdamron@stackheap.org> +License: BSD-2 + +Files: src/libnet_build_ipsec.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2002, Jose Nazario <jose@crimelabs.net> +License: BSD-2 + +Files: src/libnet_build_link.c + src/libnet_write.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_dll.c +Copyright: © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_link_dlpi.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1993-1997, The Regents of the University of California + © Atanu Ghosh <atanu@cs.ucl.ac.uk>, University College London +License: BSD-3 + +Files: src/libnet_link_nit.c + src/libnet_link_none.c + src/libnet_link_pf.c + src/libnet_link_snoop.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. +License: BSD-3 + +Files: src/libnet_link_snit.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. + © 1989, Micky Liu <micky@cunixc.cc.columbia.edu>, Columbia University +License: BSD-3 + +Files: src/libnet_link_win32.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2001-2002, Don Bowman <don@sandvine.com> + © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: * +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> +License: BSD-2 diff --git a/unmerged/debian/libnet1-dev/usr/share/man/man1/libnet-config.1.gz b/unmerged/debian/libnet1-dev/usr/share/man/man1/libnet-config.1.gz Binary files differnew file mode 100644 index 0000000..7e5552d --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/share/man/man1/libnet-config.1.gz diff --git a/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet-functions.h.3.gz b/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet-functions.h.3.gz Binary files differnew file mode 100644 index 0000000..f37791b --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet-functions.h.3.gz diff --git a/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet-macros.h.3.gz b/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet-macros.h.3.gz Binary files differnew file mode 100644 index 0000000..229bc10 --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet-macros.h.3.gz diff --git a/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet.h.3.gz b/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet.h.3.gz Binary files differnew file mode 100644 index 0000000..c185031 --- /dev/null +++ b/unmerged/debian/libnet1-dev/usr/share/man/man3/libnet.h.3.gz diff --git a/unmerged/debian/libnet1-doc.doc-base b/unmerged/debian/libnet1-doc.doc-base new file mode 100644 index 0000000..6b9df63 --- /dev/null +++ b/unmerged/debian/libnet1-doc.doc-base @@ -0,0 +1,10 @@ +Document: libnet1-doc +Title: Libnet Packet Assembly Library +Author: Mike D. Schiffman +Abstract: This manual describes to developers + how to use the LibNet library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libnet1-doc/html/index.html +Files: /usr/share/doc/libnet1-doc/html/*.html diff --git a/unmerged/debian/libnet1-doc.docs b/unmerged/debian/libnet1-doc.docs new file mode 100644 index 0000000..d895ec4 --- /dev/null +++ b/unmerged/debian/libnet1-doc.docs @@ -0,0 +1,10 @@ +README +doc/BUGS +doc/CONTRIB +doc/TODO +doc/DESIGN_NOTES +doc/MIGRATION +doc/PACKET_BUILDING +doc/PORTED +doc/RAWSOCKET_NON_SEQUITUR +doc/html/ diff --git a/unmerged/debian/libnet1-doc.examples b/unmerged/debian/libnet1-doc.examples new file mode 100644 index 0000000..a5ced5a --- /dev/null +++ b/unmerged/debian/libnet1-doc.examples @@ -0,0 +1,2 @@ +sample/*.c +sample/*.h diff --git a/unmerged/debian/libnet1-doc.postinst.debhelper b/unmerged/debian/libnet1-doc.postinst.debhelper new file mode 100644 index 0000000..bc031e9 --- /dev/null +++ b/unmerged/debian/libnet1-doc.postinst.debhelper @@ -0,0 +1,5 @@ +# Automatically added by dh_installdocs +if [ "$1" = configure ] && which install-docs >/dev/null 2>&1; then + install-docs -i /usr/share/doc-base/libnet1-doc +fi +# End automatically added section diff --git a/unmerged/debian/libnet1-doc.prerm.debhelper b/unmerged/debian/libnet1-doc.prerm.debhelper new file mode 100644 index 0000000..a9daf4d --- /dev/null +++ b/unmerged/debian/libnet1-doc.prerm.debhelper @@ -0,0 +1,6 @@ +# Automatically added by dh_installdocs +if [ "$1" = remove ] || [ "$1" = upgrade ] && \ + which install-docs >/dev/null 2>&1; then + install-docs -r libnet1-doc +fi +# End automatically added section diff --git a/unmerged/debian/libnet1-doc/DEBIAN/control b/unmerged/debian/libnet1-doc/DEBIAN/control new file mode 100644 index 0000000..2904889 --- /dev/null +++ b/unmerged/debian/libnet1-doc/DEBIAN/control @@ -0,0 +1,22 @@ +Package: libnet1-doc +Source: libnet +Version: 1.1.2.1-4. +Architecture: all +Maintainer: David Paleino <d.paleino@gmail.com> +Installed-Size: 1148 +Suggests: libnet1-dev +Section: doc +Priority: optional +Description: developers documentation files for libnet + libnet provides a portable framework for low-level network packet + writing and handling. + . + libnet features portable packet creation interfaces at the IP layer + and link layer, as well as a host of supplementary functionality. + . + Using libnet, quick and simple packet assembly applications can be + whipped up with little effort. With a bit more time, more complex + programs can be written (Traceroute and ping were easily rewritten + using libnet and libpcap). + . + This package contains the documentation files for developers. diff --git a/unmerged/debian/libnet1-doc/DEBIAN/md5sums b/unmerged/debian/libnet1-doc/DEBIAN/md5sums new file mode 100644 index 0000000..31b886e --- /dev/null +++ b/unmerged/debian/libnet1-doc/DEBIAN/md5sums @@ -0,0 +1,85 @@ +8e8984a3bfe53e6747acc26f815b808d usr/share/doc-base/libnet1-doc +f4d390ec4d978eaf2d0e85cbce91650a usr/share/doc/libnet1-doc/PORTED +72c2b62b481b35b1cfa3dd156b196ba2 usr/share/doc/libnet1-doc/TODO +eacefe1a78fb767b494becc45fe7695b usr/share/doc/libnet1-doc/PACKET_BUILDING.gz +2bb1a3c48e190c9e8b877b00729b0b66 usr/share/doc/libnet1-doc/copyright +0cec275bdc8d80eb33e7bda603809470 usr/share/doc/libnet1-doc/MIGRATION.gz +749f90bcfb2030b4f2c0d274ac3b60ff usr/share/doc/libnet1-doc/html/tab_l.gif +763eb7a5a20eb2c558e4c195acb31a06 usr/share/doc/libnet1-doc/html/libnet_8h.html +862ae54b3af16d5af6774b1c675544ed usr/share/doc/libnet1-doc/html/libnet-functions_8h.html +4c828e0c6f585f60e4ec837121dbc1e4 usr/share/doc/libnet1-doc/html/libnet-headers_8h-source.html +33f874b8cd0ceafd80ccad649e6e7846 usr/share/doc/libnet1-doc/html/doxygen.png +247d747057bc1c05caa52a990fe5ab3a usr/share/doc/libnet1-doc/html/libnet_8h-source.html +bf33755435bf3451d0e401f15ee5e731 usr/share/doc/libnet1-doc/html/libnet-structures_8h-source.html +4ec41a4ecaae15f26c6854b1d900e142 usr/share/doc/libnet1-doc/html/index.html +adc6c90e9c1bbb053c1e720b9bfe9c2d usr/share/doc/libnet1-doc/html/Makefile.am +05cb6114d91e4eb4e224856b8bf5f69d usr/share/doc/libnet1-doc/html/globals_func.html +ae9bd6a9cb2ba6dfe8b2f5625a7d1d55 usr/share/doc/libnet1-doc/html/Makefile.in.gz +22101171e03080e828af4ce25dc171c6 usr/share/doc/libnet1-doc/html/libnet-types_8h-source.html +9802233fa0b185ac2242b8dce096cb90 usr/share/doc/libnet1-doc/html/tab_r.gif +ea9e00231eac70c0bbe5470de375910b usr/share/doc/libnet1-doc/html/libnet-macros_8h-source.html +d740d2a845db334c423d9845985a5f02 usr/share/doc/libnet1-doc/html/libnet-functions_8h-source.html +2b5b74c9525f41f8e98eacc4f5c801d6 usr/share/doc/libnet1-doc/html/doxygen.css +8edc393d73479dc9e0d627e5999cfbec usr/share/doc/libnet1-doc/html/Makefile.gz +ac67afb5f19ffedc2593e91a7be8a90e usr/share/doc/libnet1-doc/html/libnet-asn1_8h-source.html +9652afcfe3be6d1524b8c730c776fe35 usr/share/doc/libnet1-doc/html/files.html +a22ef28753006f7a725a9099ade93548 usr/share/doc/libnet1-doc/html/tab_b.gif +38c424ac4c9516b35bfa09c4c48add7c usr/share/doc/libnet1-doc/html/libnet-macros_8h.html +9656c17d5ded6e918cdeba83cdfc4afc usr/share/doc/libnet1-doc/html/tabs.css +3a73e252f740135a2e48a150abc140c0 usr/share/doc/libnet1-doc/html/globals.html +8bede7802ab2a7d161fa16f44392cd28 usr/share/doc/libnet1-doc/html/globals_defs.html +a65eb69d689ab766481cd36089be4a01 usr/share/doc/libnet1-doc/changelog.Debian.gz +afe126f06b51944c5ac852a4f91f1793 usr/share/doc/libnet1-doc/RAWSOCKET_NON_SEQUITUR +02a2ba42bc5465fab78afe0223a0d4b9 usr/share/doc/libnet1-doc/BUGS +c00d4bcb3c17025a2b826e26f0e62c64 usr/share/doc/libnet1-doc/README +73ee76ba07d703e1f182505bc336f819 usr/share/doc/libnet1-doc/DESIGN_NOTES.gz +9a0e4f5bc33f8129b22b6b2ce9fa809e usr/share/doc/libnet1-doc/examples/tcp2.c.gz +aa9a919d243bbafb04951de414b03e7a usr/share/doc/libnet1-doc/examples/bgp4_notification.c.gz +02505f2d47c39098fefe1b2ef50490a8 usr/share/doc/libnet1-doc/examples/hsrp.c.gz +4187507c37cb6714dfa5c6c52a87a6c6 usr/share/doc/libnet1-doc/examples/test_ipv6_icmpv4.c +44823c8e8e975387bece940571b16f16 usr/share/doc/libnet1-doc/examples/tcp1.c.gz +a7a623b1dea583241b29ad9671a2dfc6 usr/share/doc/libnet1-doc/examples/icmp_timeexceed.c.gz +9d71e4fa53d42eb3213b9a44b2aad229 usr/share/doc/libnet1-doc/examples/icmp_redirect.c.gz +80a35ffd8bd9cb7ceea1d2a3f335c602 usr/share/doc/libnet1-doc/examples/libnet_test.h +dab55c48b173837cb70a48817afefb03 usr/share/doc/libnet1-doc/examples/synflood6_frag.c.gz +85d8a611c508016c19b2a73ceacb213e usr/share/doc/libnet1-doc/examples/udp1.c.gz +e04b666d619145f848ef0abb5dc5abe7 usr/share/doc/libnet1-doc/examples/mpls.c.gz +9dd745d34c6c4f7d428caa4d65a4c6aa usr/share/doc/libnet1-doc/examples/icmp6_echoreq.c.gz +01f64cab44606903ef6cb6a0334a0ffb usr/share/doc/libnet1-doc/examples/tftp.c.gz +09a3c75e2f194a7b1ae54f8e585dae14 usr/share/doc/libnet1-doc/examples/stp.c.gz +712f0f5ffc4e9aca842887f5bc0c4d06 usr/share/doc/libnet1-doc/examples/test_ipv4_options.c.gz +6e75c93b119704b7944624208466415c usr/share/doc/libnet1-doc/examples/fddi_tcp2.c.gz +d2ff586cdb438fee539d7a60443c3aaf usr/share/doc/libnet1-doc/examples/dns.c.gz +1350365d1273b9e1ab02d197a2f45a4d usr/share/doc/libnet1-doc/examples/bgp4_update.c.gz +6b47004aa86149a8350e5c4671701175 usr/share/doc/libnet1-doc/examples/rpc_udp.c.gz +c06226c0b24303259b8492a6a8e67b64 usr/share/doc/libnet1-doc/examples/ospf_hello.c.gz +64cb16a5582c94b9381815e8ffe4053f usr/share/doc/libnet1-doc/examples/icmp_unreach.c.gz +64b58f0cd9464e68a73563cc9a1a47c1 usr/share/doc/libnet1-doc/examples/gre.c.gz +6b6b7774716bb52e706361df601f0b52 usr/share/doc/libnet1-doc/examples/sebek.c.gz +bd37f0a03c6c0a97bc99352da0349f6e usr/share/doc/libnet1-doc/examples/udp2.c.gz +1fd6278c653f279c6884c6d7a4b1011e usr/share/doc/libnet1-doc/examples/tring_tcp1.c.gz +f6f1d919d7a1e98e491fc128c34545e5 usr/share/doc/libnet1-doc/examples/isl.c.gz +705ada524e0d3e3d245d0feb4ac07247 usr/share/doc/libnet1-doc/examples/bgp4_open.c.gz +93c302d95df4f1d387d9fdb2d7bf6c45 usr/share/doc/libnet1-doc/examples/ospf_lsa.c.gz +f6a927053318d6312d72620e3f6a2987 usr/share/doc/libnet1-doc/examples/fddi_tcp1.c.gz +a69a9e784d78484a7ad16ce5585393ef usr/share/doc/libnet1-doc/examples/rpc_tcp.c.gz +28282070f1525fbb5d9358a6636fd9d3 usr/share/doc/libnet1-doc/examples/ping_of_death.c.gz +bb6d5d95fa2c1b15a9d3f6b3252db384 usr/share/doc/libnet1-doc/examples/icmp_echo_cq.c.gz +b7e41eb0d0d94a02c155cf999849e919 usr/share/doc/libnet1-doc/examples/ip_raw.c.gz +188f678530ec174a29de27f3de41a4e2 usr/share/doc/libnet1-doc/examples/cdp.c.gz +b1f7e4c45effc3256ca2a6383e2e6527 usr/share/doc/libnet1-doc/examples/bgp4_hdr.c.gz +7a96ad7ba21c5729f97c49766eb3417d usr/share/doc/libnet1-doc/examples/ip_link.c.gz +3200adbde79452251d42fe5b3ea13227 usr/share/doc/libnet1-doc/examples/ieee.c.gz +19cdd8fadbd7a96282852fc524cc510b usr/share/doc/libnet1-doc/examples/get_addr.c +c0d08d040279c70667174bf07316fd29 usr/share/doc/libnet1-doc/examples/synflood6.c.gz +e69d18f137a03c5ef82ac4dc7ff0d9fe usr/share/doc/libnet1-doc/examples/smurf.c.gz +5bac270b73434bd5a992e82f4dcbed6e usr/share/doc/libnet1-doc/examples/icmp_timestamp.c.gz +5db02d8df53790f9a7aba2bae07257d4 usr/share/doc/libnet1-doc/examples/dhcp_discover.c.gz +73a6c3a1292c99df689f0f17c5edeede usr/share/doc/libnet1-doc/examples/test_ipv4.c.gz +1579023bcef5ab6afe806008adda0c2f usr/share/doc/libnet1-doc/examples/ntp.c.gz +5ba63ec29f27b25f5d82cd55f44b8826 usr/share/doc/libnet1-doc/examples/dot1x.c +4c396e221f1ffd5e9776604fe9b74a30 usr/share/doc/libnet1-doc/examples/tring_tcp2.c.gz +3a4d68cebabc267234537e14e26ef9b3 usr/share/doc/libnet1-doc/examples/arp.c.gz +c7f517faa3feb9c0819e87e8aa17c369 usr/share/doc/libnet1-doc/examples/synflood.c.gz +fc4d1696ee8a90d4f1fbd7355353822b usr/share/doc/libnet1-doc/CONTRIB +bb5f0c20d189bb0184e0dbb892768d32 usr/share/doc/libnet1-doc/changelog.gz diff --git a/unmerged/debian/libnet1-doc/DEBIAN/postinst b/unmerged/debian/libnet1-doc/DEBIAN/postinst new file mode 100755 index 0000000..c4aad0a --- /dev/null +++ b/unmerged/debian/libnet1-doc/DEBIAN/postinst @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +# Automatically added by dh_installdocs +if [ "$1" = configure ] && which install-docs >/dev/null 2>&1; then + install-docs -i /usr/share/doc-base/libnet1-doc +fi +# End automatically added section diff --git a/unmerged/debian/libnet1-doc/DEBIAN/prerm b/unmerged/debian/libnet1-doc/DEBIAN/prerm new file mode 100755 index 0000000..2adc67d --- /dev/null +++ b/unmerged/debian/libnet1-doc/DEBIAN/prerm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +# Automatically added by dh_installdocs +if [ "$1" = remove ] || [ "$1" = upgrade ] && \ + which install-docs >/dev/null 2>&1; then + install-docs -r libnet1-doc +fi +# End automatically added section diff --git a/unmerged/debian/libnet1-doc/usr/share/doc-base/libnet1-doc b/unmerged/debian/libnet1-doc/usr/share/doc-base/libnet1-doc new file mode 100644 index 0000000..6b9df63 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc-base/libnet1-doc @@ -0,0 +1,10 @@ +Document: libnet1-doc +Title: Libnet Packet Assembly Library +Author: Mike D. Schiffman +Abstract: This manual describes to developers + how to use the LibNet library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libnet1-doc/html/index.html +Files: /usr/share/doc/libnet1-doc/html/*.html diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/BUGS b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/BUGS new file mode 100644 index 0000000..2e8c929 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/BUGS @@ -0,0 +1,19 @@ +=============================================================================== + $Id: BUGS,v 1.2 2004/01/03 20:31:00 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + + 1.1.0 KNOWN BUG LIST + + - It appears as though getprotobynumber() is broken in some linux + distributions. The /etc/protocols file should be of the format: + protocol name protocol number proctocol symbolic constant comment + Most of the file (in my redhat 7.1) distro complies with this format + until you get to the end of the file: + # 134-254 # Unassigned + # 255 # Reserved + This will cause getprotobynumber() and presumably getprotobyname() to + segfault. If you get this behavior in your program and you're calling + __libnet_file_dump(), this could be the reason. Caveat Emptor. diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/CONTRIB b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/CONTRIB new file mode 100644 index 0000000..18b3bb5 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/CONTRIB @@ -0,0 +1,62 @@ +=============================================================================== + $Id: CONTRIB,v 1.9 2004/11/09 07:05:06 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + + 1.1.x CONTRIBUTERS + Barbato, Luca + . faster C checksum routine + Beverly, Scott <scottbeverly@xengin.com> + Bowman, Don <don@sandvine.com> + Coulter, Michae l <mjc@bitz.ca> + . arp bugfix + Damron, Jason <jsdamron@hushmail.com> + . bugfixes + . IP/TCP options bugfixes + . RPC builder + . token ring and fddi support + Davis, Michael <mike@datanerds.net> + . bugfixes + Dulai, Danny <ddulai@stake.com> + Harhalakis, Stefanos <v13@v13.gr> + . debian packaging and help with autotools + Keramida, Giorgos <keramida@ceid.upatras.gr> + . various bugfixes + Kuehl, Kirby <kkuehl@cisco.com> + . u_short -> u_long patch + . 1.1.1 Win32 porting + . tons and tons of other stuff + Newsham, Tim <tnewsham@stake.com> + . general elitism + O'Donnell, Adam <javaman@west.philly.ghetto.org> + . Solaris IPv6 address fix + Omella, Alfredo Andres <aandres@s21sec.com> + . Solaris DLPI fix + Paleino, David <d.paleino@gmail.com> + . debian packaging and help with autotools + Raynal, Frederic <frederic.raynal@security-labs.org> + . cq interface + . numerous bugfixes and suggestions + . keeping the project alive during my sabbatical! + Roberto Larcher <roberto.larcher@libero.it> + . 1.1.0 Win32 Porting + Salvatori, Alessandro + . many many patches + Scheck, Robert + . latin-1 to utf-8 conversion from Fedora + Sehgal, Anupma <asehgal@cisco.com> + . pblock sanity check oversight fix + Schlott, Stefan <stefan@ploing.de> + . IPv6 code + Shields, Michael <shieldszero@aol.com> + . configure.in patch + Simons, Terry <Terry.Simons@m.cc.utah.edu> + . OS/X port + Song, Doug <dug@monkey.org> + . inspiration + Su, Joe <cysu@csie.nctu.edu.tw> + . IPv6 traffic clas and flow label fix + Yardley, Tim <liquid@dqc.org> +EOF diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/DESIGN_NOTES.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/DESIGN_NOTES.gz Binary files differnew file mode 100644 index 0000000..a7b45ae --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/DESIGN_NOTES.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/MIGRATION.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/MIGRATION.gz Binary files differnew file mode 100644 index 0000000..1587799 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/MIGRATION.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/PACKET_BUILDING.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/PACKET_BUILDING.gz Binary files differnew file mode 100644 index 0000000..b9b0471 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/PACKET_BUILDING.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/PORTED b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/PORTED new file mode 100644 index 0000000..77df971 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/PORTED @@ -0,0 +1,45 @@ +=============================================================================== + $Id: PORTED,v 1.2 2004/01/03 20:31:00 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + + 1.1.0 PORTED OPERATING SYSTEMS + + If you verify libnet building and running successfully (sample code works) + on a platform not listed here please send email to mike@infonexus.com. + + - BSD/OS + 4.x + + - Cygwin + - requires winpcap (http://netgroup-serv.polito.it/winpcap) and pcap + header files copied to /usr/include/pcap/ and the library files to + be copied to /usr/lib/ + + - FreeBSD + version? + + - HPUX + 11.0 + + - Linux + 2.0.x + 2.2.x + 2.4.x + + - OpenBSD + 2.x + 3.x + + - OS/X + version? + + - Solaris + 2.x + 7 + 8 + 9 + +EOF diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/RAWSOCKET_NON_SEQUITUR b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/RAWSOCKET_NON_SEQUITUR new file mode 100644 index 0000000..7f8c758 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/RAWSOCKET_NON_SEQUITUR @@ -0,0 +1,41 @@ +=============================================================================== + $Id: RAWSOCKET_NON_SEQUITUR,v 1.2 2004/01/03 20:31:00 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + Raw sockets are horribly non-standard across implementations. Here is + an incomplete list of some of the differences (corrections welcomed): + + Linux 2.2+: + + IP fragmentation: performed if packet is larger than MTU + IP checksum: always filled in + IP total length: always filled in + IP ID: filled in when zero + IP source address: filled in when zero + IP destination address: filled in when zero + Max packet size before kernel complains: 1500 bytes + + Solaris 2.6+: + + IP fragmentation bits: can't specify + IP fragmentation: performed if packet is larger than MTU + IP DF bit: always set + IP checksum: always filled in + Max packet size before kernel complains: ? + + OpenBSD 2.8+: + + IP fragmentation: performed if packet is larger than MTU + Max packet size before kernel complains: 8192 bytes + + Solaris, + for example, has terrible support for this packet interface. Older OpenBSD + versions and recent FreeBSD versions have the BSD_BYTE_SWAP issue where + the ip_len and ip_frag fields need to be in little endian order. Linux + apparently doesn't allow for the injection of broadcast IP datagrams. + Whenever complete control over the IP header is desired, use the link + layer API. + +EOF diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/README b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/README new file mode 100644 index 0000000..f6336b6 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/README @@ -0,0 +1,34 @@ +=============================================================================== + $Id: README,v 1.4 2004/03/01 20:26:11 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + +libnet has become unmaintained at packetfactory.net, and it's author is unreachable. + +This version was forked from the 1.1.3 release candidate, then bug fixed, +actively maintained, and rereleased. + +Home page and more info is available at: + + http://github.com/sam-github/libnet + +Contact Sam Roberts <vieuxtech@gmail.com> if you have patches or have found bugs. + + + A C library for portable packet creation and injection. + + Libnet is an API to help with the construction and handling of network + packets. It provides a portable framework for low-level network + packet writing and handling (use libnet in conjunction with libpcap and + you can write some really cool stuff). Libnet includes packet creation + at the IP layer and at the link layer as well as a host of supplementary + and complementary functionality. Libnet is very handy with which to + write network tools and network test code. See the manpage and sample + test code for more detailed information. + + Your old code (circa libnet-1.0.x) WILL NOT WORK with libnet-1.1.x. + Read doc/MIGRATION for easy steps on porting your old code. + +EOF diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/TODO b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/TODO new file mode 100644 index 0000000..84464d1 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/TODO @@ -0,0 +1,96 @@ +=============================================================================== + $Id: TODO,v 1.2 2004/01/03 20:31:00 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + + 1.1.x TODO LIST + + * Update the man page! + + - Add a programmer's man page detailing the pblock architecture. + + - Fix plist memory leak. + + - Fix IPv6. According to RFC 2992: + "Another difference from IPv4 raw sockets is that complete packets + (that is, IPv6 packets with extension headers) cannot be read or + written using the IPv6 raw sockets API. Instead, ancillary data + objects are used to transfer the extension headers, as described + later in this document. Should an application need access to the + complete IPv6 packet, some other technique, such as the datalink + interfaces BPF or DLPI, must be used. + + All fields in the IPv6 header that an application might want to + change (i.e., everything other than the version number) can be + modified using ancillary data and/or socket options by the + application for output. All fields in a received IPv6 header (other + than the version number and Next Header fields) and all extension + headers are also made available to the application as ancillary data + on input. Hence there is no need for a socket option similar to the + IPv4 IP_HDRINCL socket option." + + - Add self-throttling logic to libnet_write()/libnet_init()? Advanced + mode thing? + + - Prune the include list in libnet.h.in. Also add conditionals + around the headers we use for building the library, but not when + using it. + + - Data marshalling API for unaligned structures (like STP). + + - Make cisco ISL work. The issue is that we have build our Ethernet + frame first, then encapsulate it inside of an ISL envelope. + - We have to compute CRCs for both Ethernet and ISL. + + - Tune advanced interface functionality that allow the application + programmer to get inside libnet_t. + + - Test HPUX 11 port. + + - Test cywin32 port. + + - Flesh out the advanced mode. + + - Consider making a flag for "strict mode" where libnet will check + things like when you build an IP options list there is an IP + header preceding it (likewise for TCP)... Other "smart" things + could happen in this mode too. When in non-strict mode, libnet + will be less rigid but prone to user-error mode. + + - If we have a problem building a header we might end up freeing it + creating a NULL entry on the list and preventing us from getting to + entries beyond it (to free or whatever). Maybe we should mark it + bad or something and rely on the cleanup at the end to free it up? + + - Fix checksum support for CDP + + - Verify Checksuming: + Currently verified working on OpenBSD/Linux/Solaris: + - raw IP/UDP [with and without data] + - raw IP/TCP [with and without data] + - raw IP/ICMP [with and without data] + - raw IP/OSPF + - hello packet [with no auth data] + - hello packet [with no auth data and LSA sub-header (LSA check = bad)] + - link IP/UDP [with and without data] + - link IP/TCP [with and without data] + + - Update the rest of the libnet_link_* files for the new format, already + ported: + - bpf [works] + - linux packet socket [works] + - linux sock packet [works] + - dlpi [works] + + - Port link stuff to use writev() in libnet_write() (sendto can't hang). + + - Get IPsec code working. + + - Add the following packet builders: + - SNMP + + - Update __libnet_handle_dump to dump everything in l verbosely. + +EOF diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/changelog.Debian.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/changelog.Debian.gz Binary files differnew file mode 100644 index 0000000..92759cd --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/changelog.Debian.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/changelog.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/changelog.gz Binary files differnew file mode 100644 index 0000000..0f0c0f8 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/changelog.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/copyright b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/copyright new file mode 100644 index 0000000..b776c81 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/copyright @@ -0,0 +1,234 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Upstream-Author: Mike D. Schiffman <mike@infonexus.com> +Packaged-By: Domenico Andreoli <cavok@debian.org> +Packaged-Date: Mon, 18 Nov 2002 23:53:40 +0100 +Original-Source-Location: http://www.packetfactory.net/libnet/ + +Files: debian/* +Copyright: © 2008, David Paleino <d.paleino@gmail.com> + © 2002-2008, Domenico Andreoli <cavok@debian.org> +License: BSD-2 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED.IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: include/bpf.h + include/win32/getopt.h + include/win32/in_systm.h + sample/win32/getopt.c +Copyright: © 1982-1997, The Regents of the University of California +License: BSD-4 + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +Files: include/ifaddrlist.h +Copyright: © 1997, The Regents of the University of California +License: BSD-3 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +Files: include/libnet/libnet-asn1.h +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1989, Carnegie Mellon University +License: BSD-2 | other + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: sample/bgp4* + sample/dns.c + sample/gre.c + sample/ip_link.c + sample/ip_raw.c + sample/sebek.c + sample/tftp.c + src/libnet_build_bgp.c + src/libnet_build_gre.c +Copyright: © 2003-2004 Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/icmp_redirect.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Alberto Ornaghi <alor@antifork.org> +License: BSD-2 + +Files: sample/icmp_timeexceed.c + src/libnet_build_sebek.c + src/libnet_cq.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/ospf* + src/libnet_build_ospf.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2000, Andrew Reiter <areiter@bindview.com> +License: BSD-2 + +Files: sample/ping_of_death.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2001, Dug Song <dugsong@monkey.org> +License: BSD-2 + +Files: srct/libnet_asn1.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1992, Carnegie Mellon University + © 1993-1996, 1998, The Regents of the University of California +License: BSD-3 | other +==> BSD-3 <== + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +==> other <== + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: src/libnet_build_fddi.c + src/libnet_build_rpc.c + src/libnet_build_token_ring.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © Jason Damron <jsdamron@hushmail.com> <jdamron@stackheap.org> +License: BSD-2 + +Files: src/libnet_build_ipsec.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2002, Jose Nazario <jose@crimelabs.net> +License: BSD-2 + +Files: src/libnet_build_link.c + src/libnet_write.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_dll.c +Copyright: © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_link_dlpi.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1993-1997, The Regents of the University of California + © Atanu Ghosh <atanu@cs.ucl.ac.uk>, University College London +License: BSD-3 + +Files: src/libnet_link_nit.c + src/libnet_link_none.c + src/libnet_link_pf.c + src/libnet_link_snoop.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. +License: BSD-3 + +Files: src/libnet_link_snit.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. + © 1989, Micky Liu <micky@cunixc.cc.columbia.edu>, Columbia University +License: BSD-3 + +Files: src/libnet_link_win32.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2001-2002, Don Bowman <don@sandvine.com> + © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: * +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> +License: BSD-2 diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/arp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/arp.c.gz Binary files differnew file mode 100644 index 0000000..1a7f9ca --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/arp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_hdr.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_hdr.c.gz Binary files differnew file mode 100644 index 0000000..a20147d --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_hdr.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_notification.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_notification.c.gz Binary files differnew file mode 100644 index 0000000..7fabe3f --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_notification.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_open.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_open.c.gz Binary files differnew file mode 100644 index 0000000..8a499c5 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_open.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_update.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_update.c.gz Binary files differnew file mode 100644 index 0000000..e6848dc --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/bgp4_update.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/cdp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/cdp.c.gz Binary files differnew file mode 100644 index 0000000..152e836 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/cdp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dhcp_discover.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dhcp_discover.c.gz Binary files differnew file mode 100644 index 0000000..4b60a46 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dhcp_discover.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dns.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dns.c.gz Binary files differnew file mode 100644 index 0000000..bfbccf7 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dns.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dot1x.c b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dot1x.c new file mode 100644 index 0000000..92e8edd --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/dot1x.c @@ -0,0 +1,113 @@ +/* + * $Id: dot1x.c,v 1.2 2004/01/03 20:31:01 mike Exp $ + * + * libnet 1.1 + * Build a dot1x packet + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#if (HAVE_CONFIG_H) +#include "../include/config.h" +#endif +#include "./libnet_test.h" + +int +main(int argc, char *argv[]) +{ + int c; + libnet_t *l; + libnet_ptag_t t; + u_char eap_dst[6] = {0x01, 0x80, 0xc2, 0x00, 0x00, 0x03}; + char *device = NULL; + char errbuf[LIBNET_ERRBUF_SIZE]; + /* Code Id Length(2) Type DesiredType */ + char payload[] = {0x01, 0x0a, 0x00, 0x7f, 0x03, 0x05}; + + printf("libnet 1.1 packet shaping: dot1x\n"); + + if (argc > 1) + { + device = argv[1]; + } + l = libnet_init( + LIBNET_LINK_ADV, /* injection type */ + device, /* network interface */ + errbuf); /* errbuf */ + + if (l == NULL) + { + fprintf(stderr, "libnet_init() failed: %s", errbuf); + exit(EXIT_FAILURE); + } + + t = libnet_build_802_1x( + 0, + LIBNET_802_1X_PACKET, + sizeof(payload), + payload, + sizeof(payload), + l, + 0); + if (t == -1) + { + fprintf(stderr, "Can't build dot1x header: %s\n", libnet_geterror(l)); + goto bad; + } + + t = libnet_autobuild_ethernet( + eap_dst, /* ethernet destination */ + ETHERTYPE_EAP, /* protocol type */ + l); /* libnet handle */ + if (t == -1) + { + fprintf(stderr, "Can't build ethernet header: %s\n", libnet_geterror(l)); + goto bad; + } + + /* + * Write it to the wire. + */ + c = libnet_write(l); + + if (c == -1) + { + fprintf(stderr, "Write error: %s\n", libnet_geterror(l)); + goto bad; + } + else + { + fprintf(stderr, "Wrote %d byte dot1x packet from context \"%s\"; " + "check the wire.\n", c, libnet_cq_getlabel(l)); + } + libnet_destroy(l); + return (EXIT_SUCCESS); +bad: + libnet_destroy(l); + return (EXIT_FAILURE); +} + +/* EOF */ diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/fddi_tcp1.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/fddi_tcp1.c.gz Binary files differnew file mode 100644 index 0000000..01441f0 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/fddi_tcp1.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/fddi_tcp2.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/fddi_tcp2.c.gz Binary files differnew file mode 100644 index 0000000..9cec2f5 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/fddi_tcp2.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/get_addr.c b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/get_addr.c new file mode 100644 index 0000000..9832566 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/get_addr.c @@ -0,0 +1,112 @@ +/* + * $Id: get_addr.c,v 1.4 2004/11/09 07:05:07 mike Exp $ + * + * libnet 1.1 + * get_addr.c - Retrieve the MAC and IP address of an interface + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#if (HAVE_CONFIG_H) +#include "../include/config.h" +#endif +#include "./libnet_test.h" +#ifdef __WIN32__ +#include "../include/win32/getopt.h" +#endif + +int +main(int argc, char *argv[]) +{ + int c; + u_long i; + libnet_t *l; + char *device = NULL; + struct libnet_ether_addr *e; + char errbuf[LIBNET_ERRBUF_SIZE]; + + printf("libnet 1.1 address getter\n"); + + while ((c = getopt(argc, argv, "i:")) != EOF) + { + switch (c) + { + case 'i': + device = optarg; + break; + default: + exit(EXIT_FAILURE); + } + } + + /* + * Initialize the library. Root priviledges are required. + */ + l = libnet_init( + LIBNET_LINK, /* injection type */ + device, /* network interface */ + errbuf); /* errbuf */ + + if (l == NULL) + { + fprintf(stderr, "libnet_init() failed: %s", errbuf); + exit(EXIT_FAILURE); + } + + printf("Interface:\t%s\n", libnet_getdevice(l)); + e = libnet_get_hwaddr(l); + if (e == NULL) + { + fprintf(stderr, "Can't get hardware address: %s\n", libnet_geterror(l)); + } + else + { + printf("MAC address:\t"); + for (c = 0; c < 6; c++) + { + printf("%2.2x", e->ether_addr_octet[c]); + if (c != 5) + { + printf(":"); + } + } + printf("\n"); + } + + i = libnet_get_ipaddr4(l); + if (i == -1) + { + fprintf(stderr, "Can't get ip address: %s\n", libnet_geterror(l)); + } + else + { + printf("IP address:\t"); + printf("%s\n", libnet_addr2name4(i, LIBNET_DONT_RESOLVE)); + } + exit(EXIT_SUCCESS); +} + +/* EOF */ diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/gre.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/gre.c.gz Binary files differnew file mode 100644 index 0000000..fb7c003 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/gre.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/hsrp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/hsrp.c.gz Binary files differnew file mode 100644 index 0000000..5a5498b --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/hsrp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp6_echoreq.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp6_echoreq.c.gz Binary files differnew file mode 100644 index 0000000..a10c6d7 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp6_echoreq.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_echo_cq.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_echo_cq.c.gz Binary files differnew file mode 100644 index 0000000..1aff4bc --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_echo_cq.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_redirect.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_redirect.c.gz Binary files differnew file mode 100644 index 0000000..797209b --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_redirect.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_timeexceed.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_timeexceed.c.gz Binary files differnew file mode 100644 index 0000000..c126d83 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_timeexceed.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_timestamp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_timestamp.c.gz Binary files differnew file mode 100644 index 0000000..3ecc767 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_timestamp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_unreach.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_unreach.c.gz Binary files differnew file mode 100644 index 0000000..dc1c15f --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/icmp_unreach.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ieee.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ieee.c.gz Binary files differnew file mode 100644 index 0000000..dcc2088 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ieee.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ip_link.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ip_link.c.gz Binary files differnew file mode 100644 index 0000000..1dd5c5e --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ip_link.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ip_raw.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ip_raw.c.gz Binary files differnew file mode 100644 index 0000000..06c7d6b --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ip_raw.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/isl.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/isl.c.gz Binary files differnew file mode 100644 index 0000000..073b6c0 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/isl.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/libnet_test.h b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/libnet_test.h new file mode 100644 index 0000000..7590e7a --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/libnet_test.h @@ -0,0 +1,60 @@ +/* + * $Id: libnet_test.h,v 1.3 2004/01/29 21:17:16 mike Exp $ + * + * libnet_test.h + * + * Copyright (c) 1998 - 2001 Mike D. Schiffman <mike@infonexus.com> + */ + +#ifndef __LIBNET_TEST_H +#define __LIBNET_TEST_H + +#ifndef _WIN32 +#include "../include/libnet.h" +#else +#include "../include/win32/libnet.h" +#include "../include/win32/getopt.h" +#endif + +#define libnet_timersub(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ + } while (0) + +u_char enet_src[6] = {0x0d, 0x0e, 0x0a, 0x0d, 0x00, 0x00}; +u_char enet_dst[6] = {0x00, 0x10, 0x67, 0x00, 0xb1, 0x86}; +u_char ip_src[4] = {0x0a, 0x00, 0x00, 0x01}; +u_char ip_dst[4] = {0x0a, 0x00, 0x00, 0x02}; +u_char fddi_src[6] = {0x00, 0x0d, 0x0e, 0x0a, 0x0d, 0x00}; +u_char fddi_dst[6] = {0x00, 0x10, 0x67, 0x00, 0xb1, 0x86}; +u_char tr_src[6] = {0x00, 0x0d, 0x0e, 0x0a, 0x0d, 0x00}; +u_char tr_dst[6] = {0x00, 0x10, 0x67, 0x00, 0xb1, 0x86}; + +u_char org_code[3] = {0x00, 0x00, 0x00}; + +void usage(char *); + +#if defined(__WIN32__) +#include <win32/getopt.h> +#include <winsock2.h> +#include <ws2tcpip.h> +#ifndef _WIN32 +#include <sys/time.h> +#endif +#if defined(__GNUC__) /* mingw compiler */ +extern __attribute__((dllimport)) char *optarg; +#else /* assume msvc */ +#ifndef _WIN32 +extern __dllspec(dllimport) char *optarg; +#endif +#endif +#endif /* __WIN32__ */ + +#endif /* __LIBNET_TEST_H */ + +/* EOF */ diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/mpls.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/mpls.c.gz Binary files differnew file mode 100644 index 0000000..3af0359 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/mpls.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ntp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ntp.c.gz Binary files differnew file mode 100644 index 0000000..5922416 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ntp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ospf_hello.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ospf_hello.c.gz Binary files differnew file mode 100644 index 0000000..55b22ad --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ospf_hello.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ospf_lsa.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ospf_lsa.c.gz Binary files differnew file mode 100644 index 0000000..be5c027 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ospf_lsa.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ping_of_death.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ping_of_death.c.gz Binary files differnew file mode 100644 index 0000000..2781a28 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/ping_of_death.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/rpc_tcp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/rpc_tcp.c.gz Binary files differnew file mode 100644 index 0000000..0caf0c0 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/rpc_tcp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/rpc_udp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/rpc_udp.c.gz Binary files differnew file mode 100644 index 0000000..3607588 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/rpc_udp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/sebek.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/sebek.c.gz Binary files differnew file mode 100644 index 0000000..860349d --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/sebek.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/smurf.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/smurf.c.gz Binary files differnew file mode 100644 index 0000000..c7d7a50 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/smurf.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/stp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/stp.c.gz Binary files differnew file mode 100644 index 0000000..0c5132f --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/stp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood.c.gz Binary files differnew file mode 100644 index 0000000..479692d --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood6.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood6.c.gz Binary files differnew file mode 100644 index 0000000..8968036 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood6.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood6_frag.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood6_frag.c.gz Binary files differnew file mode 100644 index 0000000..bc90981 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/synflood6_frag.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tcp1.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tcp1.c.gz Binary files differnew file mode 100644 index 0000000..cadcb89 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tcp1.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tcp2.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tcp2.c.gz Binary files differnew file mode 100644 index 0000000..eacab27 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tcp2.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv4.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv4.c.gz Binary files differnew file mode 100644 index 0000000..2ca15d3 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv4.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv4_options.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv4_options.c.gz Binary files differnew file mode 100644 index 0000000..e72ebad --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv4_options.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv6_icmpv4.c b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv6_icmpv4.c new file mode 100644 index 0000000..b3dcd67 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/test_ipv6_icmpv4.c @@ -0,0 +1,123 @@ +/* + * Regression test for bugs such as reported in: + * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=418975 + * + * Copyright (c) 2009 Sam Roberts <sroberts@wurldtech.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#if (HAVE_CONFIG_H) +#include "../include/config.h" +#endif +#include "./libnet_test.h" + +#include <assert.h> + +#include <netinet/in.h> + +static void print_pblocks(libnet_t* l) +{ + libnet_pblock_t* p = l->protocol_blocks; + + while(p) { + /* h_len is header length for checksumming? "chksum length"? */ + printf(" tag %d flags %d type %20s/%#x buf %p b_len %2u h_len %2u ip_offset %2u, copied %2u\n", + p->ptag, p->flags, + libnet_diag_dump_pblock_type(p->type), p->type, + p->buf, p->b_len, p->h_len, p->ip_offset, p->copied); + p = p->next; + } + printf(" link_offset %d aligner %d total_size %u nblocks %d\n", + l->link_offset, l->aligner, l->total_size, l->n_pblocks); + +} + +int +main(int argc, char *argv[]) +{ + libnet_t *l; + int r; + char *device = "eth0"; + struct libnet_ether_addr *mac_address; + struct in6_addr src_ip; + struct libnet_in6_addr dst_ip; + char errbuf[LIBNET_ERRBUF_SIZE]; + libnet_ptag_t icmp_ptag = 0; + libnet_ptag_t ipv6_ptag = 0; + char payload[24] = { 0 }; + + memset(&src_ip, 0x66, sizeof(src_ip)); + + l = libnet_init( LIBNET_RAW6, device, errbuf); + + assert(l); + + mac_address = libnet_get_hwaddr(l); + assert(mac_address); + + dst_ip = libnet_name2addr6(l, "::1" /* BCAST_ADDR - defined where? */, LIBNET_DONT_RESOLVE); + + memcpy(payload,src_ip.s6_addr,16); + payload[16] = 2; /* 2 for Target Link-layer Address */ + payload[17] = 1; /* The length of the option */ + memcpy(payload+18,mac_address->ether_addr_octet, 6); + + /* 0x2000: RSO */ + icmp_ptag = libnet_build_icmpv4_echo( + 136,0,0,0x2000,0, + (u_int8_t *)payload,sizeof(payload), l, LIBNET_PTAG_INITIALIZER); + assert(icmp_ptag); + + ipv6_ptag = libnet_build_ipv6( + 0, 0, + LIBNET_ICMPV6_H + sizeof(payload), // ICMPV6_H == ICMPV4_H, luckily + IPPROTO_ICMP6, + 255, + *(struct libnet_in6_addr*)&src_ip, + dst_ip, + NULL, 0, + l, 0); + assert(icmp_ptag); + + print_pblocks(l); + + { + u_int8_t* pkt1 = NULL; + u_int32_t pkt1_sz = 0; + r = libnet_pblock_coalesce(l, &pkt1, &pkt1_sz); + assert(r >= 0); + + libnet_diag_dump_hex(pkt1, LIBNET_IPV6_H, 0, stdout); + libnet_diag_dump_hex(pkt1+LIBNET_IPV6_H, pkt1_sz-LIBNET_IPV6_H, 0, stdout); + + free(pkt1); + pkt1 = NULL; + } + + r = libnet_write(l); + assert(r >= 0); + + return (EXIT_SUCCESS); +} + diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tftp.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tftp.c.gz Binary files differnew file mode 100644 index 0000000..03010fc --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tftp.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tring_tcp1.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tring_tcp1.c.gz Binary files differnew file mode 100644 index 0000000..0406c70 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tring_tcp1.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tring_tcp2.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tring_tcp2.c.gz Binary files differnew file mode 100644 index 0000000..3fbc656 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/tring_tcp2.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/udp1.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/udp1.c.gz Binary files differnew file mode 100644 index 0000000..8fb2a6f --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/udp1.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/udp2.c.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/udp2.c.gz Binary files differnew file mode 100644 index 0000000..22c340c --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/examples/udp2.c.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.am b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.am new file mode 100644 index 0000000..38ab66a --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = *.html *.css *.png *.gif + diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.gz Binary files differnew file mode 100644 index 0000000..a17cb98 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.in.gz b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.in.gz Binary files differnew file mode 100644 index 0000000..5f6f1f8 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/Makefile.in.gz diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/doxygen.css b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/doxygen.css new file mode 100644 index 0000000..c7db1a8 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/doxygen.css @@ -0,0 +1,358 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.nav { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} +A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} +A.codeRef:link { font-weight: normal; color: #0000FF} +A.codeRef:visited { font-weight: normal; color: #0000FF} +A:hover { text-decoration: none; background-color: #f2f2ff } +DL.el { margin-left: -1cm } +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { font-size: 75%; +} +a { + color: #1A41A8; +} +a:visited { + color: #2A3798; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #eef3f5; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +.directory { font-size: 9pt; font-weight: bold; } +.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } +.directory > h3 { margin-top: 0; } +.directory p { margin: 0px; white-space: nowrap; } +.directory div { display: none; margin: 0px; } +.directory img { vertical-align: -30%; } diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/doxygen.png b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/doxygen.png Binary files differnew file mode 100644 index 0000000..f0a274b --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/doxygen.png diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/files.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/files.html new file mode 100644 index 0000000..ff11091 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/files.html @@ -0,0 +1,33 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: File Index</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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 class="tabs"> + <ul> + <li class="current"><a href="files.html"><span>File List</span></a></li> + <li><a href="globals.html"><span>Globals</span></a></li> + </ul> +</div> +<h1>libnet File List</h1>Here is a list of all documented files with brief descriptions:<table> + <tr><td class="indexkey"><b>libnet-asn1.h</b> <a href="libnet-asn1_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr> + <tr><td class="indexkey"><a class="el" href="libnet-functions_8h.html">libnet-functions.h</a> <a href="libnet-functions_8h-source.html">[code]</a></td><td class="indexvalue">Libnet exported function prototypes </td></tr> + <tr><td class="indexkey"><b>libnet-headers.h</b> <a href="libnet-headers_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr> + <tr><td class="indexkey"><a class="el" href="libnet-macros_8h.html">libnet-macros.h</a> <a href="libnet-macros_8h-source.html">[code]</a></td><td class="indexvalue">Libnet macros and symbolic constants </td></tr> + <tr><td class="indexkey"><b>libnet-structures.h</b> <a href="libnet-structures_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr> + <tr><td class="indexkey"><b>libnet-types.h</b> <a href="libnet-types_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr> + <tr><td class="indexkey"><a class="el" href="libnet_8h.html">libnet.h</a> <a href="libnet_8h-source.html">[code]</a></td><td class="indexvalue">Toplevel libnet header file </td></tr> +</table> +<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals.html new file mode 100644 index 0000000..cf4191d --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals.html @@ -0,0 +1,306 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: Data Fields</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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 class="tabs"> + <ul> + <li><a href="files.html"><span>File List</span></a></li> + <li class="current"><a href="globals.html"><span>Globals</span></a></li> + </ul> +</div> +<div class="tabs"> + <ul> + <li class="current"><a href="globals.html"><span>All</span></a></li> + <li><a href="globals_func.html"><span>Functions</span></a></li> + <li><a href="globals_defs.html"><span>Defines</span></a></li> + </ul> +</div> +<div class="tabs"> + <ul> + <li><a href="#index_f"><span>f</span></a></li> + <li><a href="#index_i"><span>i</span></a></li> + <li><a href="#index_l"><span>l</span></a></li> + </ul> +</div> + +<p> +Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation: +<p> +<h3><a class="anchor" name="index_f">- f -</a></h3><ul> +<li>for_each_context_in_cq +: <a class="el" href="libnet-macros_8h.html#f36eb84eee10c525720134cfadb50a3e">libnet-macros.h</a> +</ul> +<h3><a class="anchor" name="index_i">- i -</a></h3><ul> +<li>IN6ADDR_ERROR_INIT +: <a class="el" href="libnet-macros_8h.html#9c76fe8da8e411fe1db9f75583dc1b8a">libnet-macros.h</a> +</ul> +<h3><a class="anchor" name="index_l">- l -</a></h3><ul> +<li>libnet_addr2name4() +: <a class="el" href="libnet-functions_8h.html#65cea3a63aac7a17f681ab15fcfd2947">libnet-functions.h</a> +<li>libnet_addr2name6_r() +: <a class="el" href="libnet-functions_8h.html#221ab1d86e36a0b1411eebdbea0cd012">libnet-functions.h</a> +<li>libnet_adv_cull_header() +: <a class="el" href="libnet-functions_8h.html#e804d72696e8e050bd0893b1869b3126">libnet-functions.h</a> +<li>libnet_adv_cull_packet() +: <a class="el" href="libnet-functions_8h.html#9040018e0c1b2c795066941c0ebfc015">libnet-functions.h</a> +<li>libnet_adv_free_packet() +: <a class="el" href="libnet-functions_8h.html#b73eb15623b02971e5a45d8bf82fb9e2">libnet-functions.h</a> +<li>libnet_adv_write_link() +: <a class="el" href="libnet-functions_8h.html#f70276132971083dba940f40b1487434">libnet-functions.h</a> +<li>libnet_adv_write_raw_ipv4() +: <a class="el" href="libnet-functions_8h.html#fa26941a0155d45914003642c6976ff4">libnet-functions.h</a> +<li>libnet_autobuild_arp() +: <a class="el" href="libnet-functions_8h.html#c2ac4909b3657c4ac34c80dbc9f91abe">libnet-functions.h</a> +<li>libnet_autobuild_ethernet() +: <a class="el" href="libnet-functions_8h.html#0ab98b1c67ac61b39b646ecfd93d58e3">libnet-functions.h</a> +<li>libnet_autobuild_fddi() +: <a class="el" href="libnet-functions_8h.html#2a0f9f03a1c43253638ecb07dfc2bb62">libnet-functions.h</a> +<li>libnet_autobuild_ipv4() +: <a class="el" href="libnet-functions_8h.html#bcef75c186b4db27f13a29c38b8f40ec">libnet-functions.h</a> +<li>libnet_autobuild_ipv6() +: <a class="el" href="libnet-functions_8h.html#f21186614be986ab83740275bb984426">libnet-functions.h</a> +<li>libnet_autobuild_link() +: <a class="el" href="libnet-functions_8h.html#3e21b6aaf8a1c690b6dca96c410083ee">libnet-functions.h</a> +<li>libnet_autobuild_token_ring() +: <a class="el" href="libnet-functions_8h.html#e2962f923beabedfe761dcd97cf41e87">libnet-functions.h</a> +<li>libnet_build_802_1q() +: <a class="el" href="libnet-functions_8h.html#60a223766dc718c544ec500b0829d39e">libnet-functions.h</a> +<li>libnet_build_802_1x() +: <a class="el" href="libnet-functions_8h.html#2e2ba82d84c8af087e53c60cb2cf0f16">libnet-functions.h</a> +<li>libnet_build_802_2() +: <a class="el" href="libnet-functions_8h.html#df241a95102fc267d0a20a1a73f0c5f1">libnet-functions.h</a> +<li>libnet_build_802_2snap() +: <a class="el" href="libnet-functions_8h.html#997b6c996b95fbcb09f87a0caf12ffa0">libnet-functions.h</a> +<li>libnet_build_802_3() +: <a class="el" href="libnet-functions_8h.html#55367f2634cf6409bbda8bbf5b834877">libnet-functions.h</a> +<li>libnet_build_arp() +: <a class="el" href="libnet-functions_8h.html#65c81208185c68937ef97c0203d3d924">libnet-functions.h</a> +<li>libnet_build_bgp4_header() +: <a class="el" href="libnet-functions_8h.html#5d7fd09f44af695b543beaff7abd2c1c">libnet-functions.h</a> +<li>libnet_build_bgp4_notification() +: <a class="el" href="libnet-functions_8h.html#1ba1e13d1fc8cc089ddd7931a6890d2b">libnet-functions.h</a> +<li>libnet_build_bgp4_open() +: <a class="el" href="libnet-functions_8h.html#9f5e3e137a1290437eb54ead063821f8">libnet-functions.h</a> +<li>libnet_build_bgp4_update() +: <a class="el" href="libnet-functions_8h.html#213d5a264ea39a17fc0fc9edb3aac30c">libnet-functions.h</a> +<li>libnet_build_bootpv4() +: <a class="el" href="libnet-functions_8h.html#37164c33698bd0c59cd51393a1fdfae6">libnet-functions.h</a> +<li>libnet_build_cdp() +: <a class="el" href="libnet-functions_8h.html#e16743df24525d5ab9b4c1ef13e87423">libnet-functions.h</a> +<li>libnet_build_data() +: <a class="el" href="libnet-functions_8h.html#cb56eccdd9d924cd3a81affdbef4cf30">libnet-functions.h</a> +<li>libnet_build_dhcpv4() +: <a class="el" href="libnet-functions_8h.html#20d397bac4d614e395878f239d26d4dc">libnet-functions.h</a> +<li>libnet_build_dnsv4() +: <a class="el" href="libnet-functions_8h.html#98bc91a6c39910ee6069d789d8dcd3e6">libnet-functions.h</a> +<li>libnet_build_egre() +: <a class="el" href="libnet-functions_8h.html#e8c54127e49779805cedf46506f564d4">libnet-functions.h</a> +<li>libnet_build_ethernet() +: <a class="el" href="libnet-functions_8h.html#b8a60ba5d3c669a1439ace4f91ee52e0">libnet-functions.h</a> +<li>libnet_build_fddi() +: <a class="el" href="libnet-functions_8h.html#2fb726d9841fa180bd79ab0a6362f533">libnet-functions.h</a> +<li>libnet_build_gre() +: <a class="el" href="libnet-functions_8h.html#fff121ac7bc157e3df0eb1bd624263c1">libnet-functions.h</a> +<li>libnet_build_gre_last_sre() +: <a class="el" href="libnet-functions_8h.html#578594ad820ae9d82fe3f9ea470f0b27">libnet-functions.h</a> +<li>libnet_build_gre_sre() +: <a class="el" href="libnet-functions_8h.html#7cca16e4e1b5ca96a1b0a35a2b766710">libnet-functions.h</a> +<li>libnet_build_hsrp() +: <a class="el" href="libnet-functions_8h.html#69bf76db8b62ec812cb734965c31eb46">libnet-functions.h</a> +<li>libnet_build_icmpv4_echo() +: <a class="el" href="libnet-functions_8h.html#b80f86d2cbf32126fe5952cc77d7c512">libnet-functions.h</a> +<li>libnet_build_icmpv4_mask() +: <a class="el" href="libnet-functions_8h.html#58605cfff0090e3cbf26abd5b7194c16">libnet-functions.h</a> +<li>libnet_build_icmpv4_redirect() +: <a class="el" href="libnet-functions_8h.html#973112121198b7151d21ab7285f6ae34">libnet-functions.h</a> +<li>libnet_build_icmpv4_timeexceed() +: <a class="el" href="libnet-functions_8h.html#87fd21c0e964dc0e2f8866178240db39">libnet-functions.h</a> +<li>libnet_build_icmpv4_timestamp() +: <a class="el" href="libnet-functions_8h.html#512a61266327928df97b010bc3f821b6">libnet-functions.h</a> +<li>libnet_build_icmpv4_unreach() +: <a class="el" href="libnet-functions_8h.html#d8e682f057f00dc53fe82960d7893b3f">libnet-functions.h</a> +<li>libnet_build_igmp() +: <a class="el" href="libnet-functions_8h.html#d614cefecf7ffbabdf241e707c474575">libnet-functions.h</a> +<li>libnet_build_ipsec_ah() +: <a class="el" href="libnet-functions_8h.html#ad130b6104956524af16fcb18fa759e9">libnet-functions.h</a> +<li>libnet_build_ipsec_esp_ftr() +: <a class="el" href="libnet-functions_8h.html#47d4aa351486618f993ed6e2652681b1">libnet-functions.h</a> +<li>libnet_build_ipsec_esp_hdr() +: <a class="el" href="libnet-functions_8h.html#7080bea55af439f0e74031197bc0924c">libnet-functions.h</a> +<li>libnet_build_ipv4() +: <a class="el" href="libnet-functions_8h.html#ace7ef7ee9dab7064eafc703bbd51c02">libnet-functions.h</a> +<li>libnet_build_ipv4_options() +: <a class="el" href="libnet-functions_8h.html#f5a9b52bc56903e3c71b3ae155ffc1df">libnet-functions.h</a> +<li>libnet_build_ipv6() +: <a class="el" href="libnet-functions_8h.html#844fc0a5b0f5acf57cbe4c9f42a1125c">libnet-functions.h</a> +<li>libnet_build_ipv6_destopts() +: <a class="el" href="libnet-functions_8h.html#a5695b5f8419b440d41bbac0aaa34564">libnet-functions.h</a> +<li>libnet_build_ipv6_frag() +: <a class="el" href="libnet-functions_8h.html#6c65244937ef5bc8e84efa5fe54aaac9">libnet-functions.h</a> +<li>libnet_build_ipv6_hbhopts() +: <a class="el" href="libnet-functions_8h.html#db7b7870cc626d8d67f723de286034a9">libnet-functions.h</a> +<li>libnet_build_ipv6_routing() +: <a class="el" href="libnet-functions_8h.html#ccf52055b316417674bfcb76f85d6227">libnet-functions.h</a> +<li>libnet_build_isl() +: <a class="el" href="libnet-functions_8h.html#84a2f87c5188f95a73ab04e7bb8eebf3">libnet-functions.h</a> +<li>libnet_build_link() +: <a class="el" href="libnet-functions_8h.html#71bc438f807ab7e84d424533e81e1693">libnet-functions.h</a> +<li>libnet_build_mpls() +: <a class="el" href="libnet-functions_8h.html#2be4c11b7a37ab8ad9d46e1ebf3b53db">libnet-functions.h</a> +<li>libnet_build_ntp() +: <a class="el" href="libnet-functions_8h.html#a18676bbed2910988a65ace745226301">libnet-functions.h</a> +<li>libnet_build_ospfv2() +: <a class="el" href="libnet-functions_8h.html#40115f0c696b84e2f4f84c09e72f60dc">libnet-functions.h</a> +<li>libnet_build_ospfv2_dbd() +: <a class="el" href="libnet-functions_8h.html#60b59bb26475cd0892299c4888454b3b">libnet-functions.h</a> +<li>libnet_build_ospfv2_hello() +: <a class="el" href="libnet-functions_8h.html#0f0d868bb17ff951305327becaec80e5">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa() +: <a class="el" href="libnet-functions_8h.html#8884632ef2860b3b292188fcacf54cf8">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa_as() +: <a class="el" href="libnet-functions_8h.html#bcecd50e35e742531f59cce0b90b8b79">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa_net() +: <a class="el" href="libnet-functions_8h.html#ae2ddd904b99753f88073c1525e9a08f">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa_rtr() +: <a class="el" href="libnet-functions_8h.html#8f27133661d6c10e3c776cfb7e24b8b6">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa_sum() +: <a class="el" href="libnet-functions_8h.html#b9d76074203ed1e92683a056b6f7b8ba">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsr() +: <a class="el" href="libnet-functions_8h.html#bd981b21f34c0efcdbd7123f9c6b1ab4">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsu() +: <a class="el" href="libnet-functions_8h.html#9460b64aba613d6e367a3a6d472ae5e6">libnet-functions.h</a> +<li>libnet_build_rip() +: <a class="el" href="libnet-functions_8h.html#c9549e65e228cdfa901fca9012f1b52f">libnet-functions.h</a> +<li>libnet_build_rpc_call() +: <a class="el" href="libnet-functions_8h.html#33bdb212c766a869a55560d523deb807">libnet-functions.h</a> +<li>libnet_build_sebek() +: <a class="el" href="libnet-functions_8h.html#d20d81e5ce0cd581ff374242fb30a089">libnet-functions.h</a> +<li>libnet_build_stp_conf() +: <a class="el" href="libnet-functions_8h.html#0a3c886a4103e0a80aea25d6d326b6bf">libnet-functions.h</a> +<li>libnet_build_stp_tcn() +: <a class="el" href="libnet-functions_8h.html#0d0bf94c6887aec7702cf9f4190a1e55">libnet-functions.h</a> +<li>libnet_build_tcp() +: <a class="el" href="libnet-functions_8h.html#24b1a32adad116ddc743482a229af490">libnet-functions.h</a> +<li>libnet_build_tcp_options() +: <a class="el" href="libnet-functions_8h.html#316a2d08bdd3199b6b30fa446b48df51">libnet-functions.h</a> +<li>libnet_build_token_ring() +: <a class="el" href="libnet-functions_8h.html#65635fcbae54edb768ed36e8ce3abca6">libnet-functions.h</a> +<li>libnet_build_udp() +: <a class="el" href="libnet-functions_8h.html#6d3f91d01237eef2f82ffd322ecbc792">libnet-functions.h</a> +<li>libnet_build_vrrp() +: <a class="el" href="libnet-functions_8h.html#e94f381e758de9faf26920042a2830e0">libnet-functions.h</a> +<li>libnet_clear_packet() +: <a class="el" href="libnet-functions_8h.html#b84889f7fe57a1801cf03eceac47463e">libnet-functions.h</a> +<li>libnet_cq_add() +: <a class="el" href="libnet-functions_8h.html#20887ffe940f1d2c5bcae79a188176c6">libnet-functions.h</a> +<li>libnet_cq_destroy() +: <a class="el" href="libnet-functions_8h.html#565d99e292980d5033bef2d186596217">libnet-functions.h</a> +<li>libnet_cq_end_loop() +: <a class="el" href="libnet-functions_8h.html#4846c3ce22db19195b235ad11d7c60ce">libnet-functions.h</a> +<li>libnet_cq_find_by_label() +: <a class="el" href="libnet-functions_8h.html#0cd216f0e5563ee06043a8ebfa16fe57">libnet-functions.h</a> +<li>libnet_cq_getlabel() +: <a class="el" href="libnet-functions_8h.html#bb1341d217de4d9c39ec484951e518b0">libnet-functions.h</a> +<li>libnet_cq_head() +: <a class="el" href="libnet-functions_8h.html#7e98a045ac6e29ca421507d9a200b5aa">libnet-functions.h</a> +<li>libnet_cq_last() +: <a class="el" href="libnet-functions_8h.html#ab1eb1e3ae64cde579a5a6035d5406c8">libnet-functions.h</a> +<li>libnet_cq_next() +: <a class="el" href="libnet-functions_8h.html#d312f3182e3e5367db87fc6bab32604d">libnet-functions.h</a> +<li>libnet_cq_remove() +: <a class="el" href="libnet-functions_8h.html#29f60504a0fe9b7bf6f5a962063118bb">libnet-functions.h</a> +<li>libnet_cq_remove_by_label() +: <a class="el" href="libnet-functions_8h.html#4e972664a0d839eab039f8fb2379987a">libnet-functions.h</a> +<li>libnet_cq_size() +: <a class="el" href="libnet-functions_8h.html#d2d4679155425c02822559bcb0caa275">libnet-functions.h</a> +<li>libnet_destroy() +: <a class="el" href="libnet-functions_8h.html#591804711cffa92582703a5aedbd9b25">libnet-functions.h</a> +<li>libnet_diag_dump_context() +: <a class="el" href="libnet-functions_8h.html#3aa6623246e13310dc6f9f9834e7313b">libnet-functions.h</a> +<li>libnet_diag_dump_hex() +: <a class="el" href="libnet-functions_8h.html#862af1289e6eb7a930e18bf1f3008cd4">libnet-functions.h</a> +<li>libnet_diag_dump_pblock() +: <a class="el" href="libnet-functions_8h.html#9825c6c69efd6ef24545d59177a333e6">libnet-functions.h</a> +<li>libnet_diag_dump_pblock_type() +: <a class="el" href="libnet-functions_8h.html#053bcb30c956b858db88b9a551e9360b">libnet-functions.h</a> +<li>LIBNET_DONT_RESOLVE +: <a class="el" href="libnet-macros_8h.html#c67cb6e9b00fd492cc3a9247e9477d87">libnet-macros.h</a> +<li>LIBNET_ERRBUF_SIZE +: <a class="el" href="libnet-macros_8h.html#2d720375e2ef5a85a62d6069283a5223">libnet-macros.h</a> +<li>libnet_get_hwaddr() +: <a class="el" href="libnet-functions_8h.html#6531e479687de8d195bd1605422735ca">libnet-functions.h</a> +<li>libnet_get_ipaddr4() +: <a class="el" href="libnet-functions_8h.html#e5143c0ab5dc9e9fa817d865eac428b0">libnet-functions.h</a> +<li>libnet_get_ipaddr6() +: <a class="el" href="libnet-functions_8h.html#3d7de8968c2087df7a22140d7993e267">libnet-functions.h</a> +<li>libnet_get_prand() +: <a class="el" href="libnet-functions_8h.html#453d816dc8adffaefc040a1bf5bd9b5f">libnet-functions.h</a> +<li>libnet_getdevice() +: <a class="el" href="libnet-functions_8h.html#1e68365ece2c976a75bc50e91df40ea0">libnet-functions.h</a> +<li>libnet_geterror() +: <a class="el" href="libnet-functions_8h.html#36c0b24a4926a8f5d9d392836e915f2e">libnet-functions.h</a> +<li>libnet_getfd() +: <a class="el" href="libnet-functions_8h.html#b9b137f454b3da05d4ac5fe388c1f2b8">libnet-functions.h</a> +<li>libnet_getgre_length() +: <a class="el" href="libnet-functions_8h.html#0af792a7e4bc49bd252b062cd4f35af5">libnet-functions.h</a> +<li>libnet_getpacket_size() +: <a class="el" href="libnet-functions_8h.html#a04f828cf6b7ade20204ec0e3dcbc778">libnet-functions.h</a> +<li>libnet_getpbuf() +: <a class="el" href="libnet-functions_8h.html#8b784c9899c429dd0f4790a71bdf55a2">libnet-functions.h</a> +<li>libnet_getpbuf_size() +: <a class="el" href="libnet-functions_8h.html#095de516e5b119d6e72fff4286157386">libnet-functions.h</a> +<li>libnet_hex_aton() +: <a class="el" href="libnet-functions_8h.html#66bfbb546b4a9fd49d446870b3b30bb0">libnet-functions.h</a> +<li>libnet_init() +: <a class="el" href="libnet-functions_8h.html#6a879b30d3e1864fd9bad33e195223b5">libnet-functions.h</a> +<li>LIBNET_MAX_PACKET +: <a class="el" href="libnet-macros_8h.html#c7301c95aa36d66e8904979650b5189d">libnet-macros.h</a> +<li>LIBNET_MAXOPTION_SIZE +: <a class="el" href="libnet-macros_8h.html#e9cd154f8cb482809ee456b6ac43dea5">libnet-macros.h</a> +<li>libnet_name2addr4() +: <a class="el" href="libnet-functions_8h.html#5042e4e9d37d9c1ab566b8d3b97e21a2">libnet-functions.h</a> +<li>libnet_name2addr6() +: <a class="el" href="libnet-functions_8h.html#6f3677b524c46fad4d185be9a3142099">libnet-functions.h</a> +<li>LIBNET_OFF +: <a class="el" href="libnet-macros_8h.html#f87da67c016a9791d256c2d71bf0b0ac">libnet-macros.h</a> +<li>LIBNET_ON +: <a class="el" href="libnet-macros_8h.html#5ff9536ca9bbe6f73f69bec817962742">libnet-macros.h</a> +<li>libnet_plist_chain_dump() +: <a class="el" href="libnet-functions_8h.html#39e332daa771627372a01867818b4301">libnet-functions.h</a> +<li>libnet_plist_chain_dump_string() +: <a class="el" href="libnet-functions_8h.html#b854695d1306f9af440145fc6767d953">libnet-functions.h</a> +<li>libnet_plist_chain_free() +: <a class="el" href="libnet-functions_8h.html#b5cb1d70164207a7c279a909576058be">libnet-functions.h</a> +<li>libnet_plist_chain_new() +: <a class="el" href="libnet-functions_8h.html#aee8e5f54482bf3c9b7c5b101fa8f41f">libnet-functions.h</a> +<li>libnet_plist_chain_next_pair() +: <a class="el" href="libnet-functions_8h.html#05ced873eacf4a000e4ce3a3ab635108">libnet-functions.h</a> +<li>LIBNET_PR2 +: <a class="el" href="libnet-macros_8h.html#96a6017948aa76e5a5d415c3227348df">libnet-macros.h</a> +<li>LIBNET_RESOLVE +: <a class="el" href="libnet-macros_8h.html#6733960f6981f1930b2d1a489df89cc7">libnet-macros.h</a> +<li>libnet_seed_prand() +: <a class="el" href="libnet-functions_8h.html#69470998be995ec8c5e11ecbb19137f5">libnet-functions.h</a> +<li>libnet_stats() +: <a class="el" href="libnet-functions_8h.html#886dc359d6add4b0608e8611af7e1b35">libnet-functions.h</a> +<li>libnet_toggle_checksum() +: <a class="el" href="libnet-functions_8h.html#d36144707ce7994c12ef9d87dc9a2edf">libnet-functions.h</a> +<li>libnet_version() +: <a class="el" href="libnet-functions_8h.html#5264b060183d307688780bf862fae37c">libnet-functions.h</a> +<li>libnet_write() +: <a class="el" href="libnet-functions_8h.html#53375552efe95906e152152fc170cc0d">libnet-functions.h</a> +</ul> +<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals_defs.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals_defs.html new file mode 100644 index 0000000..b8de6df --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals_defs.html @@ -0,0 +1,55 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: Data Fields</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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 class="tabs"> + <ul> + <li><a href="files.html"><span>File List</span></a></li> + <li class="current"><a href="globals.html"><span>Globals</span></a></li> + </ul> +</div> +<div class="tabs"> + <ul> + <li><a href="globals.html"><span>All</span></a></li> + <li><a href="globals_func.html"><span>Functions</span></a></li> + <li class="current"><a href="globals_defs.html"><span>Defines</span></a></li> + </ul> +</div> + +<p> +<ul> +<li>for_each_context_in_cq +: <a class="el" href="libnet-macros_8h.html#f36eb84eee10c525720134cfadb50a3e">libnet-macros.h</a> +<li>IN6ADDR_ERROR_INIT +: <a class="el" href="libnet-macros_8h.html#9c76fe8da8e411fe1db9f75583dc1b8a">libnet-macros.h</a> +<li>LIBNET_DONT_RESOLVE +: <a class="el" href="libnet-macros_8h.html#c67cb6e9b00fd492cc3a9247e9477d87">libnet-macros.h</a> +<li>LIBNET_ERRBUF_SIZE +: <a class="el" href="libnet-macros_8h.html#2d720375e2ef5a85a62d6069283a5223">libnet-macros.h</a> +<li>LIBNET_MAX_PACKET +: <a class="el" href="libnet-macros_8h.html#c7301c95aa36d66e8904979650b5189d">libnet-macros.h</a> +<li>LIBNET_MAXOPTION_SIZE +: <a class="el" href="libnet-macros_8h.html#e9cd154f8cb482809ee456b6ac43dea5">libnet-macros.h</a> +<li>LIBNET_OFF +: <a class="el" href="libnet-macros_8h.html#f87da67c016a9791d256c2d71bf0b0ac">libnet-macros.h</a> +<li>LIBNET_ON +: <a class="el" href="libnet-macros_8h.html#5ff9536ca9bbe6f73f69bec817962742">libnet-macros.h</a> +<li>LIBNET_PR2 +: <a class="el" href="libnet-macros_8h.html#96a6017948aa76e5a5d415c3227348df">libnet-macros.h</a> +<li>LIBNET_RESOLVE +: <a class="el" href="libnet-macros_8h.html#6733960f6981f1930b2d1a489df89cc7">libnet-macros.h</a> +</ul> +<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals_func.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals_func.html new file mode 100644 index 0000000..9de18a4 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/globals_func.html @@ -0,0 +1,280 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: Data Fields</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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 class="tabs"> + <ul> + <li><a href="files.html"><span>File List</span></a></li> + <li class="current"><a href="globals.html"><span>Globals</span></a></li> + </ul> +</div> +<div class="tabs"> + <ul> + <li><a href="globals.html"><span>All</span></a></li> + <li class="current"><a href="globals_func.html"><span>Functions</span></a></li> + <li><a href="globals_defs.html"><span>Defines</span></a></li> + </ul> +</div> +<div class="tabs"> + <ul> + <li><a href="#index_l"><span>l</span></a></li> + </ul> +</div> + +<p> + +<p> +<h3><a class="anchor" name="index_l">- l -</a></h3><ul> +<li>libnet_addr2name4() +: <a class="el" href="libnet-functions_8h.html#65cea3a63aac7a17f681ab15fcfd2947">libnet-functions.h</a> +<li>libnet_addr2name6_r() +: <a class="el" href="libnet-functions_8h.html#221ab1d86e36a0b1411eebdbea0cd012">libnet-functions.h</a> +<li>libnet_adv_cull_header() +: <a class="el" href="libnet-functions_8h.html#e804d72696e8e050bd0893b1869b3126">libnet-functions.h</a> +<li>libnet_adv_cull_packet() +: <a class="el" href="libnet-functions_8h.html#9040018e0c1b2c795066941c0ebfc015">libnet-functions.h</a> +<li>libnet_adv_free_packet() +: <a class="el" href="libnet-functions_8h.html#b73eb15623b02971e5a45d8bf82fb9e2">libnet-functions.h</a> +<li>libnet_adv_write_link() +: <a class="el" href="libnet-functions_8h.html#f70276132971083dba940f40b1487434">libnet-functions.h</a> +<li>libnet_adv_write_raw_ipv4() +: <a class="el" href="libnet-functions_8h.html#fa26941a0155d45914003642c6976ff4">libnet-functions.h</a> +<li>libnet_autobuild_arp() +: <a class="el" href="libnet-functions_8h.html#c2ac4909b3657c4ac34c80dbc9f91abe">libnet-functions.h</a> +<li>libnet_autobuild_ethernet() +: <a class="el" href="libnet-functions_8h.html#0ab98b1c67ac61b39b646ecfd93d58e3">libnet-functions.h</a> +<li>libnet_autobuild_fddi() +: <a class="el" href="libnet-functions_8h.html#2a0f9f03a1c43253638ecb07dfc2bb62">libnet-functions.h</a> +<li>libnet_autobuild_ipv4() +: <a class="el" href="libnet-functions_8h.html#bcef75c186b4db27f13a29c38b8f40ec">libnet-functions.h</a> +<li>libnet_autobuild_ipv6() +: <a class="el" href="libnet-functions_8h.html#f21186614be986ab83740275bb984426">libnet-functions.h</a> +<li>libnet_autobuild_link() +: <a class="el" href="libnet-functions_8h.html#3e21b6aaf8a1c690b6dca96c410083ee">libnet-functions.h</a> +<li>libnet_autobuild_token_ring() +: <a class="el" href="libnet-functions_8h.html#e2962f923beabedfe761dcd97cf41e87">libnet-functions.h</a> +<li>libnet_build_802_1q() +: <a class="el" href="libnet-functions_8h.html#60a223766dc718c544ec500b0829d39e">libnet-functions.h</a> +<li>libnet_build_802_1x() +: <a class="el" href="libnet-functions_8h.html#2e2ba82d84c8af087e53c60cb2cf0f16">libnet-functions.h</a> +<li>libnet_build_802_2() +: <a class="el" href="libnet-functions_8h.html#df241a95102fc267d0a20a1a73f0c5f1">libnet-functions.h</a> +<li>libnet_build_802_2snap() +: <a class="el" href="libnet-functions_8h.html#997b6c996b95fbcb09f87a0caf12ffa0">libnet-functions.h</a> +<li>libnet_build_802_3() +: <a class="el" href="libnet-functions_8h.html#55367f2634cf6409bbda8bbf5b834877">libnet-functions.h</a> +<li>libnet_build_arp() +: <a class="el" href="libnet-functions_8h.html#65c81208185c68937ef97c0203d3d924">libnet-functions.h</a> +<li>libnet_build_bgp4_header() +: <a class="el" href="libnet-functions_8h.html#5d7fd09f44af695b543beaff7abd2c1c">libnet-functions.h</a> +<li>libnet_build_bgp4_notification() +: <a class="el" href="libnet-functions_8h.html#1ba1e13d1fc8cc089ddd7931a6890d2b">libnet-functions.h</a> +<li>libnet_build_bgp4_open() +: <a class="el" href="libnet-functions_8h.html#9f5e3e137a1290437eb54ead063821f8">libnet-functions.h</a> +<li>libnet_build_bgp4_update() +: <a class="el" href="libnet-functions_8h.html#213d5a264ea39a17fc0fc9edb3aac30c">libnet-functions.h</a> +<li>libnet_build_bootpv4() +: <a class="el" href="libnet-functions_8h.html#37164c33698bd0c59cd51393a1fdfae6">libnet-functions.h</a> +<li>libnet_build_cdp() +: <a class="el" href="libnet-functions_8h.html#e16743df24525d5ab9b4c1ef13e87423">libnet-functions.h</a> +<li>libnet_build_data() +: <a class="el" href="libnet-functions_8h.html#cb56eccdd9d924cd3a81affdbef4cf30">libnet-functions.h</a> +<li>libnet_build_dhcpv4() +: <a class="el" href="libnet-functions_8h.html#20d397bac4d614e395878f239d26d4dc">libnet-functions.h</a> +<li>libnet_build_dnsv4() +: <a class="el" href="libnet-functions_8h.html#98bc91a6c39910ee6069d789d8dcd3e6">libnet-functions.h</a> +<li>libnet_build_egre() +: <a class="el" href="libnet-functions_8h.html#e8c54127e49779805cedf46506f564d4">libnet-functions.h</a> +<li>libnet_build_ethernet() +: <a class="el" href="libnet-functions_8h.html#b8a60ba5d3c669a1439ace4f91ee52e0">libnet-functions.h</a> +<li>libnet_build_fddi() +: <a class="el" href="libnet-functions_8h.html#2fb726d9841fa180bd79ab0a6362f533">libnet-functions.h</a> +<li>libnet_build_gre() +: <a class="el" href="libnet-functions_8h.html#fff121ac7bc157e3df0eb1bd624263c1">libnet-functions.h</a> +<li>libnet_build_gre_last_sre() +: <a class="el" href="libnet-functions_8h.html#578594ad820ae9d82fe3f9ea470f0b27">libnet-functions.h</a> +<li>libnet_build_gre_sre() +: <a class="el" href="libnet-functions_8h.html#7cca16e4e1b5ca96a1b0a35a2b766710">libnet-functions.h</a> +<li>libnet_build_hsrp() +: <a class="el" href="libnet-functions_8h.html#69bf76db8b62ec812cb734965c31eb46">libnet-functions.h</a> +<li>libnet_build_icmpv4_echo() +: <a class="el" href="libnet-functions_8h.html#b80f86d2cbf32126fe5952cc77d7c512">libnet-functions.h</a> +<li>libnet_build_icmpv4_mask() +: <a class="el" href="libnet-functions_8h.html#58605cfff0090e3cbf26abd5b7194c16">libnet-functions.h</a> +<li>libnet_build_icmpv4_redirect() +: <a class="el" href="libnet-functions_8h.html#973112121198b7151d21ab7285f6ae34">libnet-functions.h</a> +<li>libnet_build_icmpv4_timeexceed() +: <a class="el" href="libnet-functions_8h.html#87fd21c0e964dc0e2f8866178240db39">libnet-functions.h</a> +<li>libnet_build_icmpv4_timestamp() +: <a class="el" href="libnet-functions_8h.html#512a61266327928df97b010bc3f821b6">libnet-functions.h</a> +<li>libnet_build_icmpv4_unreach() +: <a class="el" href="libnet-functions_8h.html#d8e682f057f00dc53fe82960d7893b3f">libnet-functions.h</a> +<li>libnet_build_igmp() +: <a class="el" href="libnet-functions_8h.html#d614cefecf7ffbabdf241e707c474575">libnet-functions.h</a> +<li>libnet_build_ipsec_ah() +: <a class="el" href="libnet-functions_8h.html#ad130b6104956524af16fcb18fa759e9">libnet-functions.h</a> +<li>libnet_build_ipsec_esp_ftr() +: <a class="el" href="libnet-functions_8h.html#47d4aa351486618f993ed6e2652681b1">libnet-functions.h</a> +<li>libnet_build_ipsec_esp_hdr() +: <a class="el" href="libnet-functions_8h.html#7080bea55af439f0e74031197bc0924c">libnet-functions.h</a> +<li>libnet_build_ipv4() +: <a class="el" href="libnet-functions_8h.html#ace7ef7ee9dab7064eafc703bbd51c02">libnet-functions.h</a> +<li>libnet_build_ipv4_options() +: <a class="el" href="libnet-functions_8h.html#f5a9b52bc56903e3c71b3ae155ffc1df">libnet-functions.h</a> +<li>libnet_build_ipv6() +: <a class="el" href="libnet-functions_8h.html#844fc0a5b0f5acf57cbe4c9f42a1125c">libnet-functions.h</a> +<li>libnet_build_ipv6_destopts() +: <a class="el" href="libnet-functions_8h.html#a5695b5f8419b440d41bbac0aaa34564">libnet-functions.h</a> +<li>libnet_build_ipv6_frag() +: <a class="el" href="libnet-functions_8h.html#6c65244937ef5bc8e84efa5fe54aaac9">libnet-functions.h</a> +<li>libnet_build_ipv6_hbhopts() +: <a class="el" href="libnet-functions_8h.html#db7b7870cc626d8d67f723de286034a9">libnet-functions.h</a> +<li>libnet_build_ipv6_routing() +: <a class="el" href="libnet-functions_8h.html#ccf52055b316417674bfcb76f85d6227">libnet-functions.h</a> +<li>libnet_build_isl() +: <a class="el" href="libnet-functions_8h.html#84a2f87c5188f95a73ab04e7bb8eebf3">libnet-functions.h</a> +<li>libnet_build_link() +: <a class="el" href="libnet-functions_8h.html#71bc438f807ab7e84d424533e81e1693">libnet-functions.h</a> +<li>libnet_build_mpls() +: <a class="el" href="libnet-functions_8h.html#2be4c11b7a37ab8ad9d46e1ebf3b53db">libnet-functions.h</a> +<li>libnet_build_ntp() +: <a class="el" href="libnet-functions_8h.html#a18676bbed2910988a65ace745226301">libnet-functions.h</a> +<li>libnet_build_ospfv2() +: <a class="el" href="libnet-functions_8h.html#40115f0c696b84e2f4f84c09e72f60dc">libnet-functions.h</a> +<li>libnet_build_ospfv2_dbd() +: <a class="el" href="libnet-functions_8h.html#60b59bb26475cd0892299c4888454b3b">libnet-functions.h</a> +<li>libnet_build_ospfv2_hello() +: <a class="el" href="libnet-functions_8h.html#0f0d868bb17ff951305327becaec80e5">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa() +: <a class="el" href="libnet-functions_8h.html#8884632ef2860b3b292188fcacf54cf8">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa_as() +: <a class="el" href="libnet-functions_8h.html#bcecd50e35e742531f59cce0b90b8b79">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa_net() +: <a class="el" href="libnet-functions_8h.html#ae2ddd904b99753f88073c1525e9a08f">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa_rtr() +: <a class="el" href="libnet-functions_8h.html#8f27133661d6c10e3c776cfb7e24b8b6">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsa_sum() +: <a class="el" href="libnet-functions_8h.html#b9d76074203ed1e92683a056b6f7b8ba">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsr() +: <a class="el" href="libnet-functions_8h.html#bd981b21f34c0efcdbd7123f9c6b1ab4">libnet-functions.h</a> +<li>libnet_build_ospfv2_lsu() +: <a class="el" href="libnet-functions_8h.html#9460b64aba613d6e367a3a6d472ae5e6">libnet-functions.h</a> +<li>libnet_build_rip() +: <a class="el" href="libnet-functions_8h.html#c9549e65e228cdfa901fca9012f1b52f">libnet-functions.h</a> +<li>libnet_build_rpc_call() +: <a class="el" href="libnet-functions_8h.html#33bdb212c766a869a55560d523deb807">libnet-functions.h</a> +<li>libnet_build_sebek() +: <a class="el" href="libnet-functions_8h.html#d20d81e5ce0cd581ff374242fb30a089">libnet-functions.h</a> +<li>libnet_build_stp_conf() +: <a class="el" href="libnet-functions_8h.html#0a3c886a4103e0a80aea25d6d326b6bf">libnet-functions.h</a> +<li>libnet_build_stp_tcn() +: <a class="el" href="libnet-functions_8h.html#0d0bf94c6887aec7702cf9f4190a1e55">libnet-functions.h</a> +<li>libnet_build_tcp() +: <a class="el" href="libnet-functions_8h.html#24b1a32adad116ddc743482a229af490">libnet-functions.h</a> +<li>libnet_build_tcp_options() +: <a class="el" href="libnet-functions_8h.html#316a2d08bdd3199b6b30fa446b48df51">libnet-functions.h</a> +<li>libnet_build_token_ring() +: <a class="el" href="libnet-functions_8h.html#65635fcbae54edb768ed36e8ce3abca6">libnet-functions.h</a> +<li>libnet_build_udp() +: <a class="el" href="libnet-functions_8h.html#6d3f91d01237eef2f82ffd322ecbc792">libnet-functions.h</a> +<li>libnet_build_vrrp() +: <a class="el" href="libnet-functions_8h.html#e94f381e758de9faf26920042a2830e0">libnet-functions.h</a> +<li>libnet_clear_packet() +: <a class="el" href="libnet-functions_8h.html#b84889f7fe57a1801cf03eceac47463e">libnet-functions.h</a> +<li>libnet_cq_add() +: <a class="el" href="libnet-functions_8h.html#20887ffe940f1d2c5bcae79a188176c6">libnet-functions.h</a> +<li>libnet_cq_destroy() +: <a class="el" href="libnet-functions_8h.html#565d99e292980d5033bef2d186596217">libnet-functions.h</a> +<li>libnet_cq_end_loop() +: <a class="el" href="libnet-functions_8h.html#4846c3ce22db19195b235ad11d7c60ce">libnet-functions.h</a> +<li>libnet_cq_find_by_label() +: <a class="el" href="libnet-functions_8h.html#0cd216f0e5563ee06043a8ebfa16fe57">libnet-functions.h</a> +<li>libnet_cq_getlabel() +: <a class="el" href="libnet-functions_8h.html#bb1341d217de4d9c39ec484951e518b0">libnet-functions.h</a> +<li>libnet_cq_head() +: <a class="el" href="libnet-functions_8h.html#7e98a045ac6e29ca421507d9a200b5aa">libnet-functions.h</a> +<li>libnet_cq_last() +: <a class="el" href="libnet-functions_8h.html#ab1eb1e3ae64cde579a5a6035d5406c8">libnet-functions.h</a> +<li>libnet_cq_next() +: <a class="el" href="libnet-functions_8h.html#d312f3182e3e5367db87fc6bab32604d">libnet-functions.h</a> +<li>libnet_cq_remove() +: <a class="el" href="libnet-functions_8h.html#29f60504a0fe9b7bf6f5a962063118bb">libnet-functions.h</a> +<li>libnet_cq_remove_by_label() +: <a class="el" href="libnet-functions_8h.html#4e972664a0d839eab039f8fb2379987a">libnet-functions.h</a> +<li>libnet_cq_size() +: <a class="el" href="libnet-functions_8h.html#d2d4679155425c02822559bcb0caa275">libnet-functions.h</a> +<li>libnet_destroy() +: <a class="el" href="libnet-functions_8h.html#591804711cffa92582703a5aedbd9b25">libnet-functions.h</a> +<li>libnet_diag_dump_context() +: <a class="el" href="libnet-functions_8h.html#3aa6623246e13310dc6f9f9834e7313b">libnet-functions.h</a> +<li>libnet_diag_dump_hex() +: <a class="el" href="libnet-functions_8h.html#862af1289e6eb7a930e18bf1f3008cd4">libnet-functions.h</a> +<li>libnet_diag_dump_pblock() +: <a class="el" href="libnet-functions_8h.html#9825c6c69efd6ef24545d59177a333e6">libnet-functions.h</a> +<li>libnet_diag_dump_pblock_type() +: <a class="el" href="libnet-functions_8h.html#053bcb30c956b858db88b9a551e9360b">libnet-functions.h</a> +<li>libnet_get_hwaddr() +: <a class="el" href="libnet-functions_8h.html#6531e479687de8d195bd1605422735ca">libnet-functions.h</a> +<li>libnet_get_ipaddr4() +: <a class="el" href="libnet-functions_8h.html#e5143c0ab5dc9e9fa817d865eac428b0">libnet-functions.h</a> +<li>libnet_get_ipaddr6() +: <a class="el" href="libnet-functions_8h.html#3d7de8968c2087df7a22140d7993e267">libnet-functions.h</a> +<li>libnet_get_prand() +: <a class="el" href="libnet-functions_8h.html#453d816dc8adffaefc040a1bf5bd9b5f">libnet-functions.h</a> +<li>libnet_getdevice() +: <a class="el" href="libnet-functions_8h.html#1e68365ece2c976a75bc50e91df40ea0">libnet-functions.h</a> +<li>libnet_geterror() +: <a class="el" href="libnet-functions_8h.html#36c0b24a4926a8f5d9d392836e915f2e">libnet-functions.h</a> +<li>libnet_getfd() +: <a class="el" href="libnet-functions_8h.html#b9b137f454b3da05d4ac5fe388c1f2b8">libnet-functions.h</a> +<li>libnet_getgre_length() +: <a class="el" href="libnet-functions_8h.html#0af792a7e4bc49bd252b062cd4f35af5">libnet-functions.h</a> +<li>libnet_getpacket_size() +: <a class="el" href="libnet-functions_8h.html#a04f828cf6b7ade20204ec0e3dcbc778">libnet-functions.h</a> +<li>libnet_getpbuf() +: <a class="el" href="libnet-functions_8h.html#8b784c9899c429dd0f4790a71bdf55a2">libnet-functions.h</a> +<li>libnet_getpbuf_size() +: <a class="el" href="libnet-functions_8h.html#095de516e5b119d6e72fff4286157386">libnet-functions.h</a> +<li>libnet_hex_aton() +: <a class="el" href="libnet-functions_8h.html#66bfbb546b4a9fd49d446870b3b30bb0">libnet-functions.h</a> +<li>libnet_init() +: <a class="el" href="libnet-functions_8h.html#6a879b30d3e1864fd9bad33e195223b5">libnet-functions.h</a> +<li>libnet_name2addr4() +: <a class="el" href="libnet-functions_8h.html#5042e4e9d37d9c1ab566b8d3b97e21a2">libnet-functions.h</a> +<li>libnet_name2addr6() +: <a class="el" href="libnet-functions_8h.html#6f3677b524c46fad4d185be9a3142099">libnet-functions.h</a> +<li>libnet_plist_chain_dump() +: <a class="el" href="libnet-functions_8h.html#39e332daa771627372a01867818b4301">libnet-functions.h</a> +<li>libnet_plist_chain_dump_string() +: <a class="el" href="libnet-functions_8h.html#b854695d1306f9af440145fc6767d953">libnet-functions.h</a> +<li>libnet_plist_chain_free() +: <a class="el" href="libnet-functions_8h.html#b5cb1d70164207a7c279a909576058be">libnet-functions.h</a> +<li>libnet_plist_chain_new() +: <a class="el" href="libnet-functions_8h.html#aee8e5f54482bf3c9b7c5b101fa8f41f">libnet-functions.h</a> +<li>libnet_plist_chain_next_pair() +: <a class="el" href="libnet-functions_8h.html#05ced873eacf4a000e4ce3a3ab635108">libnet-functions.h</a> +<li>libnet_seed_prand() +: <a class="el" href="libnet-functions_8h.html#69470998be995ec8c5e11ecbb19137f5">libnet-functions.h</a> +<li>libnet_stats() +: <a class="el" href="libnet-functions_8h.html#886dc359d6add4b0608e8611af7e1b35">libnet-functions.h</a> +<li>libnet_toggle_checksum() +: <a class="el" href="libnet-functions_8h.html#d36144707ce7994c12ef9d87dc9a2edf">libnet-functions.h</a> +<li>libnet_version() +: <a class="el" href="libnet-functions_8h.html#5264b060183d307688780bf862fae37c">libnet-functions.h</a> +<li>libnet_write() +: <a class="el" href="libnet-functions_8h.html#53375552efe95906e152152fc170cc0d">libnet-functions.h</a> +</ul> +<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/index.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/index.html new file mode 100644 index 0000000..06d55c8 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/index.html @@ -0,0 +1,22 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: Libnet Packet Assembly Library</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <li class="current"><a href="index.html"><span>Main Page</span></a></li> + <li><a href="files.html"><span>Files</span></a></li> + </ul> +</div> +<h1>Libnet Packet Assembly Library</h1> +<p> +<h3 align="center">1.1.4 </h3><h2><a class="anchor" name="intro"> +Overview</a></h2> +Libnet is a high-level API (toolkit) allowing the application programmer to construct and inject network packets. It provides a portable and simplified interface for low-level network packet shaping, handling and injection. Libnet hides much of the tedium of packet creation from the application programmer such as multiplexing, buffer management, arcane packet header information, byte-ordering, OS-dependent issues, and much more. Libnet features portable packet creation interfaces at the IP layer and link layer, as well as a host of supplementary and complementary functionality. Using libnet, quick and simple packet assembly applications can be whipped up with little effort. With a bit more time, more complex programs can be written (Traceroute and ping were easily rewritten using libnet and <a href="www.tcpdump.org">libpcap</a>). <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-asn1_8h-source.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-asn1_8h-source.html new file mode 100644 index 0000000..381146a --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-asn1_8h-source.html @@ -0,0 +1,273 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet-asn1.h Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet-asn1.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> +<a name="l00002"></a>00002 <span class="comment"> * $Id: libnet-asn1.h,v 1.3 2004/01/17 07:51:19 mike Exp $</span> +<a name="l00003"></a>00003 <span class="comment"> *</span> +<a name="l00004"></a>00004 <span class="comment"> * libnet-asn1.h - Network routine library ASN.1 header file</span> +<a name="l00005"></a>00005 <span class="comment"> *</span> +<a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com></span> +<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span> +<a name="l00008"></a>00008 <span class="comment"> *</span> +<a name="l00009"></a>00009 <span class="comment"> * Definitions for Abstract Syntax Notation One, ASN.1</span> +<a name="l00010"></a>00010 <span class="comment"> * As defined in ISO/IS 8824 and ISO/IS 8825</span> +<a name="l00011"></a>00011 <span class="comment"> *</span> +<a name="l00012"></a>00012 <span class="comment"> * Copyright 1988, 1989 by Carnegie Mellon University</span> +<a name="l00013"></a>00013 <span class="comment"> * All rights reserved.</span> +<a name="l00014"></a>00014 <span class="comment"> *</span> +<a name="l00015"></a>00015 <span class="comment"> * Permission to use, copy, modify, and distribute this software and its</span> +<a name="l00016"></a>00016 <span class="comment"> * documentation for any purpose and without fee is hereby granted,</span> +<a name="l00017"></a>00017 <span class="comment"> * provided that the above copyright notice appear in all copies and that</span> +<a name="l00018"></a>00018 <span class="comment"> * both that copyright notice and this permission notice appear in</span> +<a name="l00019"></a>00019 <span class="comment"> * supporting documentation, and that the name of CMU not be</span> +<a name="l00020"></a>00020 <span class="comment"> * used in advertising or publicity pertaining to distribution of the</span> +<a name="l00021"></a>00021 <span class="comment"> * software without specific, written prior permission.</span> +<a name="l00022"></a>00022 <span class="comment"> *</span> +<a name="l00023"></a>00023 <span class="comment"> * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING</span> +<a name="l00024"></a>00024 <span class="comment"> * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL</span> +<a name="l00025"></a>00025 <span class="comment"> * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR</span> +<a name="l00026"></a>00026 <span class="comment"> * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,</span> +<a name="l00027"></a>00027 <span class="comment"> * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,</span> +<a name="l00028"></a>00028 <span class="comment"> * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS</span> +<a name="l00029"></a>00029 <span class="comment"> * SOFTWARE.</span> +<a name="l00030"></a>00030 <span class="comment"> *</span> +<a name="l00031"></a>00031 <span class="comment"> * Copyright (c) 1998 - 2001 Mike D. Schiffman <mike@infonexus.com></span> +<a name="l00032"></a>00032 <span class="comment"> * All rights reserved.</span> +<a name="l00033"></a>00033 <span class="comment"> *</span> +<a name="l00034"></a>00034 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span> +<a name="l00035"></a>00035 <span class="comment"> * modification, are permitted provided that the following conditions</span> +<a name="l00036"></a>00036 <span class="comment"> * are met:</span> +<a name="l00037"></a>00037 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span> +<a name="l00038"></a>00038 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span> +<a name="l00039"></a>00039 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span> +<a name="l00040"></a>00040 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span> +<a name="l00041"></a>00041 <span class="comment"> * documentation and/or other materials provided with the distribution.</span> +<a name="l00042"></a>00042 <span class="comment"> *</span> +<a name="l00043"></a>00043 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span> +<a name="l00044"></a>00044 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> +<a name="l00045"></a>00045 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> +<a name="l00046"></a>00046 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span> +<a name="l00047"></a>00047 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span> +<a name="l00048"></a>00048 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span> +<a name="l00049"></a>00049 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> +<a name="l00050"></a>00050 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span> +<a name="l00051"></a>00051 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span> +<a name="l00052"></a>00052 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span> +<a name="l00053"></a>00053 <span class="comment"> * SUCH DAMAGE.</span> +<a name="l00054"></a>00054 <span class="comment"> */</span> +<a name="l00055"></a>00055 +<a name="l00056"></a>00056 <span class="preprocessor">#ifndef __LIBNET_ASN1_H</span> +<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_ASN1_H</span> +<a name="l00058"></a>00058 <span class="preprocessor"></span> +<a name="l00059"></a>00059 <span class="preprocessor">#ifndef EIGHTBIT_SUBIDS</span> +<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="keyword">typedef</span> u_int32_t oid; +<a name="l00061"></a>00061 <span class="preprocessor">#define MAX_SUBID 0xFFFFFFFF</span> +<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#else</span> +<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="keyword">typedef</span> u_int8_t oid; +<a name="l00064"></a>00064 <span class="preprocessor">#define MAX_SUBID 0xFF</span> +<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00066"></a>00066 <span class="preprocessor"></span> +<a name="l00067"></a>00067 <span class="preprocessor">#define MAX_OID_LEN 64 </span><span class="comment">/* max subid's in an oid */</span> +<a name="l00068"></a>00068 +<a name="l00069"></a>00069 <span class="preprocessor">#define ASN_BOOLEAN (0x01)</span> +<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#define ASN_INTEGER (0x02)</span> +<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#define ASN_BIT_STR (0x03)</span> +<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor">#define ASN_OCTET_STR (0x04)</span> +<a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#define ASN_NULL (0x05)</span> +<a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor">#define ASN_OBJECT_ID (0x06)</span> +<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#define ASN_SEQUENCE (0x10)</span> +<a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor">#define ASN_SET (0x11)</span> +<a name="l00077"></a>00077 <span class="preprocessor"></span> +<a name="l00078"></a>00078 <span class="preprocessor">#define ASN_UNIVERSAL (0x00)</span> +<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#define ASN_APPLICATION (0x40)</span> +<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define ASN_CONTEXT (0x80)</span> +<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#define ASN_PRIVATE (0xC0)</span> +<a name="l00082"></a>00082 <span class="preprocessor"></span> +<a name="l00083"></a>00083 <span class="preprocessor">#define ASN_PRIMITIVE (0x00)</span> +<a name="l00084"></a>00084 <span class="preprocessor"></span><span class="preprocessor">#define ASN_CONSTRUCTOR (0x20)</span> +<a name="l00085"></a>00085 <span class="preprocessor"></span> +<a name="l00086"></a>00086 <span class="preprocessor">#define ASN_LONG_LEN (0x80)</span> +<a name="l00087"></a>00087 <span class="preprocessor"></span><span class="preprocessor">#define ASN_EXTENSION_ID (0x1F)</span> +<a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#define ASN_BIT8 (0x80)</span> +<a name="l00089"></a>00089 <span class="preprocessor"></span> +<a name="l00090"></a>00090 <span class="preprocessor">#define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR)</span> +<a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) = ASN_EXTENSION_ID)</span> +<a name="l00092"></a>00092 <span class="preprocessor"></span> +<a name="l00093"></a>00093 <span class="comment">/*</span> +<a name="l00094"></a>00094 <span class="comment"> * All of the build_asn1_* (build_asn1_length being an exception) functions</span> +<a name="l00095"></a>00095 <span class="comment"> * take the same first 3 arguments:</span> +<a name="l00096"></a>00096 <span class="comment"> *</span> +<a name="l00097"></a>00097 <span class="comment"> * u_int8_t *data: This is a pointer to the start of the data object to be</span> +<a name="l00098"></a>00098 <span class="comment"> * manipulated.</span> +<a name="l00099"></a>00099 <span class="comment"> * int *datalen: This is a pointer to the number of valid bytes following</span> +<a name="l00100"></a>00100 <span class="comment"> * "data". This should be not be exceeded in any function.</span> +<a name="l00101"></a>00101 <span class="comment"> * Upon exiting a function, this value will reflect the</span> +<a name="l00102"></a>00102 <span class="comment"> * changed "data" and then refer to the new number of valid</span> +<a name="l00103"></a>00103 <span class="comment"> * bytes until the end of "data".</span> +<a name="l00104"></a>00104 <span class="comment"> * u_int8_t type: The ASN.1 object type.</span> +<a name="l00105"></a>00105 <span class="comment"> */</span> +<a name="l00106"></a>00106 +<a name="l00107"></a>00107 +<a name="l00108"></a>00108 <span class="comment">/*</span> +<a name="l00109"></a>00109 <span class="comment"> * Builds an ASN object containing an integer.</span> +<a name="l00110"></a>00110 <span class="comment"> *</span> +<a name="l00111"></a>00111 <span class="comment"> * Returns NULL upon error or a pointer to the first byte past the end of</span> +<a name="l00112"></a>00112 <span class="comment"> * this object (the start of the next object).</span> +<a name="l00113"></a>00113 <span class="comment"> */</span> +<a name="l00114"></a>00114 +<a name="l00115"></a>00115 u_int8_t * +<a name="l00116"></a>00116 libnet_build_asn1_int( +<a name="l00117"></a>00117 u_int8_t *, <span class="comment">/* Pointer to the output buffer */</span> +<a name="l00118"></a>00118 <span class="keywordtype">int</span> *, <span class="comment">/* Number of valid bytes left in the buffer */</span> +<a name="l00119"></a>00119 u_int8_t, <span class="comment">/* ASN object type */</span> +<a name="l00120"></a>00120 int32_t *, <span class="comment">/* Pointer to a int32_t integer */</span> +<a name="l00121"></a>00121 <span class="keywordtype">int</span> <span class="comment">/* Size of a int32_t integer */</span> +<a name="l00122"></a>00122 ); +<a name="l00123"></a>00123 +<a name="l00124"></a>00124 +<a name="l00125"></a>00125 <span class="comment">/*</span> +<a name="l00126"></a>00126 <span class="comment"> * Builds an ASN object containing an unsigned integer.</span> +<a name="l00127"></a>00127 <span class="comment"> *</span> +<a name="l00128"></a>00128 <span class="comment"> * Returns NULL upon error or a pointer to the first byte past the end of</span> +<a name="l00129"></a>00129 <span class="comment"> * this object (the start of the next object).</span> +<a name="l00130"></a>00130 <span class="comment"> */</span> +<a name="l00131"></a>00131 +<a name="l00132"></a>00132 u_int8_t * +<a name="l00133"></a>00133 libnet_build_asn1_uint( +<a name="l00134"></a>00134 u_int8_t *, <span class="comment">/* Pointer to the output buffer */</span> +<a name="l00135"></a>00135 <span class="keywordtype">int</span> *, <span class="comment">/* Number of valid bytes left in the buffer */</span> +<a name="l00136"></a>00136 u_int8_t, <span class="comment">/* ASN object type */</span> +<a name="l00137"></a>00137 u_int32_t *, <span class="comment">/* Pointer to an unsigned int32_t integer */</span> +<a name="l00138"></a>00138 <span class="keywordtype">int</span> <span class="comment">/* Size of a int32_t integer */</span> +<a name="l00139"></a>00139 ); +<a name="l00140"></a>00140 +<a name="l00141"></a>00141 +<a name="l00142"></a>00142 <span class="comment">/*</span> +<a name="l00143"></a>00143 <span class="comment"> * Builds an ASN object containing an octect string.</span> +<a name="l00144"></a>00144 <span class="comment"> *</span> +<a name="l00145"></a>00145 <span class="comment"> * Returns NULL upon error or a pointer to the first byte past the end of</span> +<a name="l00146"></a>00146 <span class="comment"> * this object (the start of the next object).</span> +<a name="l00147"></a>00147 <span class="comment"> */</span> +<a name="l00148"></a>00148 +<a name="l00149"></a>00149 u_int8_t * +<a name="l00150"></a>00150 libnet_build_asn1_string( +<a name="l00151"></a>00151 u_int8_t *, <span class="comment">/* Pointer to the output buffer */</span> +<a name="l00152"></a>00152 <span class="keywordtype">int</span> *, <span class="comment">/* Number of valid bytes left in the buffer */</span> +<a name="l00153"></a>00153 u_int8_t, <span class="comment">/* ASN object type */</span> +<a name="l00154"></a>00154 u_int8_t *, <span class="comment">/* Pointer to a string to be built into an object */</span> +<a name="l00155"></a>00155 <span class="keywordtype">int</span> <span class="comment">/* Size of the string */</span> +<a name="l00156"></a>00156 ); +<a name="l00157"></a>00157 +<a name="l00158"></a>00158 +<a name="l00159"></a>00159 <span class="comment">/*</span> +<a name="l00160"></a>00160 <span class="comment"> * Builds an ASN header for an object with the ID and length specified. This</span> +<a name="l00161"></a>00161 <span class="comment"> * only works on data types < 30, i.e. no extension octets. The maximum</span> +<a name="l00162"></a>00162 <span class="comment"> * length is 0xFFFF;</span> +<a name="l00163"></a>00163 <span class="comment"> *</span> +<a name="l00164"></a>00164 <span class="comment"> * Returns a pointer to the first byte of the contents of this object or</span> +<a name="l00165"></a>00165 <span class="comment"> * NULL upon error</span> +<a name="l00166"></a>00166 <span class="comment"> */</span> +<a name="l00167"></a>00167 +<a name="l00168"></a>00168 u_int8_t * +<a name="l00169"></a>00169 libnet_build_asn1_header( +<a name="l00170"></a>00170 u_int8_t *, <span class="comment">/* Pointer to the start of the object */</span> +<a name="l00171"></a>00171 <span class="keywordtype">int</span> *, <span class="comment">/* Number of valid bytes left in buffer */</span> +<a name="l00172"></a>00172 u_int8_t, <span class="comment">/* ASN object type */</span> +<a name="l00173"></a>00173 <span class="keywordtype">int</span> <span class="comment">/* ASN object length */</span> +<a name="l00174"></a>00174 ); +<a name="l00175"></a>00175 +<a name="l00176"></a>00176 +<a name="l00177"></a>00177 u_int8_t * +<a name="l00178"></a>00178 libnet_build_asn1_length( +<a name="l00179"></a>00179 u_int8_t *, <span class="comment">/* Pointer to start of object */</span> +<a name="l00180"></a>00180 <span class="keywordtype">int</span> *, <span class="comment">/* Number of valid bytes in buffer */</span> +<a name="l00181"></a>00181 <span class="keywordtype">int</span> <span class="comment">/* Length of object */</span> +<a name="l00182"></a>00182 ); +<a name="l00183"></a>00183 +<a name="l00184"></a>00184 +<a name="l00185"></a>00185 <span class="comment">/*</span> +<a name="l00186"></a>00186 <span class="comment"> * Builds an ASN header for a sequence with the ID and length specified.</span> +<a name="l00187"></a>00187 <span class="comment"> *</span> +<a name="l00188"></a>00188 <span class="comment"> * This only works on data types < 30, i.e. no extension octets.</span> +<a name="l00189"></a>00189 <span class="comment"> * The maximum length is 0xFFFF;</span> +<a name="l00190"></a>00190 <span class="comment"> *</span> +<a name="l00191"></a>00191 <span class="comment"> * Returns a pointer to the first byte of the contents of this object.</span> +<a name="l00192"></a>00192 <span class="comment"> * Returns NULL on any error.</span> +<a name="l00193"></a>00193 <span class="comment"> */</span> +<a name="l00194"></a>00194 +<a name="l00195"></a>00195 u_int8_t * +<a name="l00196"></a>00196 libnet_build_asn1_sequence( +<a name="l00197"></a>00197 u_int8_t *, +<a name="l00198"></a>00198 <span class="keywordtype">int</span> *, +<a name="l00199"></a>00199 u_int8_t, +<a name="l00200"></a>00200 <span class="keywordtype">int</span> +<a name="l00201"></a>00201 ); +<a name="l00202"></a>00202 +<a name="l00203"></a>00203 +<a name="l00204"></a>00204 <span class="comment">/*</span> +<a name="l00205"></a>00205 <span class="comment"> * Builds an ASN object identifier object containing the input string.</span> +<a name="l00206"></a>00206 <span class="comment"> *</span> +<a name="l00207"></a>00207 <span class="comment"> * Returns NULL upon error or a pointer to the first byte past the end of</span> +<a name="l00208"></a>00208 <span class="comment"> * this object (the start of the next object).</span> +<a name="l00209"></a>00209 <span class="comment"> */</span> +<a name="l00210"></a>00210 +<a name="l00211"></a>00211 u_int8_t * +<a name="l00212"></a>00212 libnet_build_asn1_objid( +<a name="l00213"></a>00213 u_int8_t *, +<a name="l00214"></a>00214 <span class="keywordtype">int</span> *, +<a name="l00215"></a>00215 u_int8_t, +<a name="l00216"></a>00216 oid *, +<a name="l00217"></a>00217 <span class="keywordtype">int</span> +<a name="l00218"></a>00218 ); +<a name="l00219"></a>00219 +<a name="l00220"></a>00220 +<a name="l00221"></a>00221 <span class="comment">/*</span> +<a name="l00222"></a>00222 <span class="comment"> * Builds an ASN null object.</span> +<a name="l00223"></a>00223 <span class="comment"> *</span> +<a name="l00224"></a>00224 <span class="comment"> * Returns NULL upon error or a pointer to the first byte past the end of</span> +<a name="l00225"></a>00225 <span class="comment"> * this object (the start of the next object).</span> +<a name="l00226"></a>00226 <span class="comment"> */</span> +<a name="l00227"></a>00227 +<a name="l00228"></a>00228 u_int8_t * +<a name="l00229"></a>00229 libnet_build_asn1_null( +<a name="l00230"></a>00230 u_int8_t *, +<a name="l00231"></a>00231 <span class="keywordtype">int</span> *, +<a name="l00232"></a>00232 u_int8_t +<a name="l00233"></a>00233 ); +<a name="l00234"></a>00234 +<a name="l00235"></a>00235 +<a name="l00236"></a>00236 <span class="comment">/*</span> +<a name="l00237"></a>00237 <span class="comment"> * Builds an ASN bitstring.</span> +<a name="l00238"></a>00238 <span class="comment"> *</span> +<a name="l00239"></a>00239 <span class="comment"> * Returns NULL upon error or a pointer to the first byte past the end of</span> +<a name="l00240"></a>00240 <span class="comment"> * this object (the start of the next object).</span> +<a name="l00241"></a>00241 <span class="comment"> */</span> +<a name="l00242"></a>00242 +<a name="l00243"></a>00243 u_int8_t * +<a name="l00244"></a>00244 libnet_build_asn1_bitstring( +<a name="l00245"></a>00245 u_int8_t *, +<a name="l00246"></a>00246 <span class="keywordtype">int</span> *, +<a name="l00247"></a>00247 u_int8_t, +<a name="l00248"></a>00248 u_int8_t *, <span class="comment">/* Pointer to the input buffer */</span> +<a name="l00249"></a>00249 <span class="keywordtype">int</span> <span class="comment">/* Length of the input buffer */</span> +<a name="l00250"></a>00250 ); +<a name="l00251"></a>00251 +<a name="l00252"></a>00252 +<a name="l00253"></a>00253 <span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_ASN1_H */</span> +<a name="l00254"></a>00254 +<a name="l00255"></a>00255 <span class="comment">/* EOF */</span> +</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-functions_8h-source.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-functions_8h-source.html new file mode 100644 index 0000000..1a46894 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-functions_8h-source.html @@ -0,0 +1,765 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet-functions.h Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet-functions.h</h1><a href="libnet-functions_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> +<a name="l00002"></a>00002 <span class="comment"> * $Id: libnet-functions.h,v 1.43 2004/11/09 07:05:07 mike Exp $</span> +<a name="l00003"></a>00003 <span class="comment"> *</span> +<a name="l00004"></a>00004 <span class="comment"> * libnet-functions.h - function prototypes</span> +<a name="l00005"></a>00005 <span class="comment"> *</span> +<a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com></span> +<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span> +<a name="l00008"></a>00008 <span class="comment"> *</span> +<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span> +<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span> +<a name="l00011"></a>00011 <span class="comment"> * are met:</span> +<a name="l00012"></a>00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span> +<a name="l00013"></a>00013 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span> +<a name="l00014"></a>00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span> +<a name="l00015"></a>00015 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span> +<a name="l00016"></a>00016 <span class="comment"> * documentation and/or other materials provided with the distribution.</span> +<a name="l00017"></a>00017 <span class="comment"> *</span> +<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span> +<a name="l00019"></a>00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> +<a name="l00020"></a>00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> +<a name="l00021"></a>00021 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span> +<a name="l00022"></a>00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span> +<a name="l00023"></a>00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span> +<a name="l00024"></a>00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> +<a name="l00025"></a>00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span> +<a name="l00026"></a>00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span> +<a name="l00027"></a>00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span> +<a name="l00028"></a>00028 <span class="comment"> * SUCH DAMAGE.</span> +<a name="l00029"></a>00029 <span class="comment"> *</span> +<a name="l00030"></a>00030 <span class="comment"> */</span> +<a name="l00031"></a>00031 +<a name="l00032"></a>00032 <span class="preprocessor">#ifndef __LIBNET_FUNCTIONS_H</span> +<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_FUNCTIONS_H</span> +<a name="l00034"></a>00034 <span class="preprocessor"></span> +<a name="l00063"></a>00063 libnet_t * +<a name="l00064"></a>00064 <a class="code" href="libnet-functions_8h.html#6a879b30d3e1864fd9bad33e195223b5">libnet_init</a>(<span class="keywordtype">int</span> injection_type, <span class="keywordtype">char</span> *device, <span class="keywordtype">char</span> *err_buf); +<a name="l00065"></a>00065 +<a name="l00071"></a>00071 <span class="keywordtype">void</span> +<a name="l00072"></a>00072 <a class="code" href="libnet-functions_8h.html#591804711cffa92582703a5aedbd9b25">libnet_destroy</a>(libnet_t *l); +<a name="l00073"></a>00073 +<a name="l00080"></a>00080 <span class="keywordtype">void</span> +<a name="l00081"></a>00081 <a class="code" href="libnet-functions_8h.html#b84889f7fe57a1801cf03eceac47463e">libnet_clear_packet</a>(libnet_t *l); +<a name="l00082"></a>00082 +<a name="l00089"></a>00089 <span class="keywordtype">void</span> +<a name="l00090"></a>00090 <a class="code" href="libnet-functions_8h.html#886dc359d6add4b0608e8611af7e1b35">libnet_stats</a>(libnet_t *l, <span class="keyword">struct</span> <a class="code" href="libnet-functions_8h.html#886dc359d6add4b0608e8611af7e1b35">libnet_stats</a> *ls); +<a name="l00091"></a>00091 +<a name="l00097"></a>00097 <span class="keywordtype">int</span> +<a name="l00098"></a>00098 <a class="code" href="libnet-functions_8h.html#b9b137f454b3da05d4ac5fe388c1f2b8">libnet_getfd</a>(libnet_t *l); +<a name="l00099"></a>00099 +<a name="l00106"></a>00106 <span class="keyword">const</span> <span class="keywordtype">char</span> * +<a name="l00107"></a>00107 <a class="code" href="libnet-functions_8h.html#1e68365ece2c976a75bc50e91df40ea0">libnet_getdevice</a>(libnet_t *l); +<a name="l00108"></a>00108 +<a name="l00117"></a>00117 u_int8_t * +<a name="l00118"></a>00118 <a class="code" href="libnet-functions_8h.html#8b784c9899c429dd0f4790a71bdf55a2">libnet_getpbuf</a>(libnet_t *l, libnet_ptag_t ptag); +<a name="l00119"></a>00119 +<a name="l00128"></a>00128 u_int32_t +<a name="l00129"></a>00129 <a class="code" href="libnet-functions_8h.html#095de516e5b119d6e72fff4286157386">libnet_getpbuf_size</a>(libnet_t *l, libnet_ptag_t ptag); +<a name="l00130"></a>00130 +<a name="l00138"></a>00138 <span class="keywordtype">char</span> * +<a name="l00139"></a>00139 <a class="code" href="libnet-functions_8h.html#36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror</a>(libnet_t *l); +<a name="l00140"></a>00140 +<a name="l00147"></a>00147 u_int32_t +<a name="l00148"></a>00148 <a class="code" href="libnet-functions_8h.html#a04f828cf6b7ade20204ec0e3dcbc778">libnet_getpacket_size</a>(libnet_t *l); +<a name="l00149"></a>00149 +<a name="l00155"></a>00155 <span class="keywordtype">int</span> +<a name="l00156"></a>00156 <a class="code" href="libnet-functions_8h.html#69470998be995ec8c5e11ecbb19137f5">libnet_seed_prand</a>(libnet_t *l); +<a name="l00157"></a>00157 +<a name="l00171"></a>00171 u_int32_t +<a name="l00172"></a>00172 <a class="code" href="libnet-functions_8h.html#453d816dc8adffaefc040a1bf5bd9b5f">libnet_get_prand</a>(<span class="keywordtype">int</span> mod); +<a name="l00173"></a>00173 +<a name="l00195"></a>00195 <span class="keywordtype">int</span> +<a name="l00196"></a>00196 <a class="code" href="libnet-functions_8h.html#d36144707ce7994c12ef9d87dc9a2edf">libnet_toggle_checksum</a>(libnet_t *l, libnet_ptag_t ptag, <span class="keywordtype">int</span> mode); +<a name="l00197"></a>00197 +<a name="l00210"></a>00210 <span class="keywordtype">char</span> * +<a name="l00211"></a>00211 <a class="code" href="libnet-functions_8h.html#65cea3a63aac7a17f681ab15fcfd2947">libnet_addr2name4</a>(u_int32_t in, u_int8_t use_name); +<a name="l00212"></a>00212 +<a name="l00226"></a>00226 u_int32_t +<a name="l00227"></a>00227 <a class="code" href="libnet-functions_8h.html#5042e4e9d37d9c1ab566b8d3b97e21a2">libnet_name2addr4</a>(libnet_t *l, <span class="keywordtype">char</span> *host_name, u_int8_t use_name); +<a name="l00228"></a>00228 +<a name="l00229"></a>00229 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">struct </span>libnet_in6_addr in6addr_error; +<a name="l00230"></a>00230 +<a name="l00244"></a>00244 <span class="keyword">struct </span>libnet_in6_addr +<a name="l00245"></a>00245 <a class="code" href="libnet-functions_8h.html#6f3677b524c46fad4d185be9a3142099">libnet_name2addr6</a>(libnet_t *l, <span class="keywordtype">char</span> *host_name, u_int8_t use_name); +<a name="l00246"></a>00246 +<a name="l00250"></a>00250 <span class="keywordtype">void</span> +<a name="l00251"></a>00251 <a class="code" href="libnet-functions_8h.html#221ab1d86e36a0b1411eebdbea0cd012">libnet_addr2name6_r</a>(<span class="keyword">struct</span> libnet_in6_addr addr, u_int8_t use_name, +<a name="l00252"></a>00252 <span class="keywordtype">char</span> *host_name, <span class="keywordtype">int</span> host_name_len); +<a name="l00253"></a>00253 +<a name="l00269"></a>00269 <span class="keywordtype">int</span> +<a name="l00270"></a>00270 <a class="code" href="libnet-functions_8h.html#aee8e5f54482bf3c9b7c5b101fa8f41f">libnet_plist_chain_new</a>(libnet_t *l, libnet_plist_t **plist, <span class="keywordtype">char</span> *token_list); +<a name="l00271"></a>00271 +<a name="l00283"></a>00283 <span class="keywordtype">int</span> +<a name="l00284"></a>00284 <a class="code" href="libnet-functions_8h.html#05ced873eacf4a000e4ce3a3ab635108">libnet_plist_chain_next_pair</a>(libnet_plist_t *plist, u_int16_t *bport, +<a name="l00285"></a>00285 u_int16_t *eport); +<a name="l00286"></a>00286 +<a name="l00293"></a>00293 <span class="keywordtype">int</span> +<a name="l00294"></a>00294 <a class="code" href="libnet-functions_8h.html#39e332daa771627372a01867818b4301">libnet_plist_chain_dump</a>(libnet_plist_t *plist); +<a name="l00295"></a>00295 +<a name="l00304"></a>00304 <span class="keywordtype">char</span> * +<a name="l00305"></a>00305 <a class="code" href="libnet-functions_8h.html#b854695d1306f9af440145fc6767d953">libnet_plist_chain_dump_string</a>(libnet_plist_t *plist); +<a name="l00306"></a>00306 +<a name="l00312"></a>00312 <span class="keywordtype">int</span> +<a name="l00313"></a>00313 <a class="code" href="libnet-functions_8h.html#b5cb1d70164207a7c279a909576058be">libnet_plist_chain_free</a>(libnet_plist_t *plist); +<a name="l00314"></a>00314 +<a name="l00402"></a>00402 libnet_ptag_t +<a name="l00403"></a>00403 <a class="code" href="libnet-functions_8h.html#60a223766dc718c544ec500b0829d39e">libnet_build_802_1q</a>(u_int8_t *dst, u_int8_t *src, u_int16_t tpi, +<a name="l00404"></a>00404 u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, +<a name="l00405"></a>00405 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00406"></a>00406 +<a name="l00418"></a>00418 libnet_ptag_t +<a name="l00419"></a>00419 <a class="code" href="libnet-functions_8h.html#2e2ba82d84c8af087e53c60cb2cf0f16">libnet_build_802_1x</a>(u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, +<a name="l00420"></a>00420 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00421"></a>00421 +<a name="l00433"></a>00433 libnet_ptag_t +<a name="l00434"></a>00434 <a class="code" href="libnet-functions_8h.html#df241a95102fc267d0a20a1a73f0c5f1">libnet_build_802_2</a>(u_int8_t dsap, u_int8_t ssap, u_int8_t control, +<a name="l00435"></a>00435 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00436"></a>00436 +<a name="l00450"></a>00450 libnet_ptag_t +<a name="l00451"></a>00451 <a class="code" href="libnet-functions_8h.html#997b6c996b95fbcb09f87a0caf12ffa0">libnet_build_802_2snap</a>(u_int8_t dsap, u_int8_t ssap, u_int8_t control, +<a name="l00452"></a>00452 u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, +<a name="l00453"></a>00453 libnet_t *l, libnet_ptag_t ptag); +<a name="l00454"></a>00454 +<a name="l00470"></a>00470 libnet_ptag_t +<a name="l00471"></a>00471 <a class="code" href="libnet-functions_8h.html#55367f2634cf6409bbda8bbf5b834877">libnet_build_802_3</a>(u_int8_t *dst, u_int8_t *src, u_int16_t len, +<a name="l00472"></a>00472 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00473"></a>00473 +<a name="l00489"></a>00489 libnet_ptag_t +<a name="l00490"></a>00490 <a class="code" href="libnet-functions_8h.html#b8a60ba5d3c669a1439ace4f91ee52e0">libnet_build_ethernet</a>(u_int8_t *dst, u_int8_t *src, u_int16_t type, +<a name="l00491"></a>00491 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00492"></a>00492 +<a name="l00504"></a>00504 libnet_ptag_t +<a name="l00505"></a>00505 <a class="code" href="libnet-functions_8h.html#0ab98b1c67ac61b39b646ecfd93d58e3">libnet_autobuild_ethernet</a>(u_int8_t *dst, u_int16_t type, libnet_t *l); +<a name="l00506"></a>00506 +<a name="l00523"></a>00523 libnet_ptag_t +<a name="l00524"></a>00524 <a class="code" href="libnet-functions_8h.html#2fb726d9841fa180bd79ab0a6362f533">libnet_build_fddi</a>(u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, +<a name="l00525"></a>00525 u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, +<a name="l00526"></a>00526 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00527"></a>00527 +<a name="l00540"></a>00540 libnet_ptag_t +<a name="l00541"></a>00541 <a class="code" href="libnet-functions_8h.html#2a0f9f03a1c43253638ecb07dfc2bb62">libnet_autobuild_fddi</a>(u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, +<a name="l00542"></a>00542 u_int8_t cf, u_int8_t *oui, u_int16_t type, libnet_t *l); +<a name="l00543"></a>00543 +<a name="l00563"></a>00563 libnet_ptag_t +<a name="l00564"></a>00564 <a class="code" href="libnet-functions_8h.html#65c81208185c68937ef97c0203d3d924">libnet_build_arp</a>(u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, +<a name="l00565"></a>00565 u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, +<a name="l00566"></a>00566 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00567"></a>00567 +<a name="l00580"></a>00580 libnet_ptag_t +<a name="l00581"></a>00581 <a class="code" href="libnet-functions_8h.html#c2ac4909b3657c4ac34c80dbc9f91abe">libnet_autobuild_arp</a>(u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, +<a name="l00582"></a>00582 u_int8_t *tpa, libnet_t *l); +<a name="l00583"></a>00583 +<a name="l00601"></a>00601 libnet_ptag_t +<a name="l00602"></a>00602 <a class="code" href="libnet-functions_8h.html#24b1a32adad116ddc743482a229af490">libnet_build_tcp</a>(u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, +<a name="l00603"></a>00603 u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, +<a name="l00604"></a>00604 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00605"></a>00605 +<a name="l00621"></a>00621 libnet_ptag_t +<a name="l00622"></a>00622 <a class="code" href="libnet-functions_8h.html#316a2d08bdd3199b6b30fa446b48df51">libnet_build_tcp_options</a>(u_int8_t *options, u_int32_t options_s, libnet_t *l, +<a name="l00623"></a>00623 libnet_ptag_t ptag); +<a name="l00624"></a>00624 +<a name="l00637"></a>00637 libnet_ptag_t +<a name="l00638"></a>00638 <a class="code" href="libnet-functions_8h.html#6d3f91d01237eef2f82ffd322ecbc792">libnet_build_udp</a>(u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, +<a name="l00639"></a>00639 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00640"></a>00640 +<a name="l00660"></a>00660 libnet_ptag_t +<a name="l00661"></a>00661 <a class="code" href="libnet-functions_8h.html#e16743df24525d5ab9b4c1ef13e87423">libnet_build_cdp</a>(u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, +<a name="l00662"></a>00662 u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_t payload_s, +<a name="l00663"></a>00663 libnet_t *l, libnet_ptag_t ptag); +<a name="l00664"></a>00664 +<a name="l00679"></a>00679 libnet_ptag_t +<a name="l00680"></a>00680 <a class="code" href="libnet-functions_8h.html#b80f86d2cbf32126fe5952cc77d7c512">libnet_build_icmpv4_echo</a>(u_int8_t type, u_int8_t code, u_int16_t sum, +<a name="l00681"></a>00681 u_int16_t <span class="keywordtype">id</span>, u_int16_t seq, u_int8_t *payload, u_int32_t payload_s, +<a name="l00682"></a>00682 libnet_t *l, libnet_ptag_t ptag); +<a name="l00683"></a>00683 +<a name="l00699"></a>00699 libnet_ptag_t +<a name="l00700"></a>00700 <a class="code" href="libnet-functions_8h.html#58605cfff0090e3cbf26abd5b7194c16">libnet_build_icmpv4_mask</a>(u_int8_t type, u_int8_t code, u_int16_t sum, +<a name="l00701"></a>00701 u_int16_t <span class="keywordtype">id</span>, u_int16_t seq, u_int32_t mask, u_int8_t *payload, +<a name="l00702"></a>00702 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00703"></a>00703 +<a name="l00717"></a>00717 libnet_ptag_t +<a name="l00718"></a>00718 <a class="code" href="libnet-functions_8h.html#d8e682f057f00dc53fe82960d7893b3f">libnet_build_icmpv4_unreach</a>(u_int8_t type, u_int8_t code, u_int16_t sum, +<a name="l00719"></a>00719 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00720"></a>00720 +<a name="l00735"></a>00735 libnet_ptag_t +<a name="l00736"></a>00736 <a class="code" href="libnet-functions_8h.html#973112121198b7151d21ab7285f6ae34">libnet_build_icmpv4_redirect</a>(u_int8_t type, u_int8_t code, u_int16_t sum, +<a name="l00737"></a>00737 u_int32_t gateway, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l00738"></a>00738 libnet_ptag_t ptag); +<a name="l00739"></a>00739 +<a name="l00754"></a>00754 libnet_ptag_t +<a name="l00755"></a>00755 <a class="code" href="libnet-functions_8h.html#87fd21c0e964dc0e2f8866178240db39">libnet_build_icmpv4_timeexceed</a>(u_int8_t type, u_int8_t code, u_int16_t sum, +<a name="l00756"></a>00756 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00757"></a>00757 +<a name="l00775"></a>00775 libnet_ptag_t +<a name="l00776"></a>00776 <a class="code" href="libnet-functions_8h.html#512a61266327928df97b010bc3f821b6">libnet_build_icmpv4_timestamp</a>(u_int8_t type, u_int8_t code, u_int16_t sum, +<a name="l00777"></a>00777 u_int16_t <span class="keywordtype">id</span>, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, +<a name="l00778"></a>00778 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00779"></a>00779 +<a name="l00792"></a>00792 libnet_ptag_t +<a name="l00793"></a>00793 <a class="code" href="libnet-functions_8h.html#d614cefecf7ffbabdf241e707c474575">libnet_build_igmp</a>(u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, +<a name="l00794"></a>00794 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00795"></a>00795 +<a name="l00815"></a>00815 libnet_ptag_t +<a name="l00816"></a>00816 <a class="code" href="libnet-functions_8h.html#ace7ef7ee9dab7064eafc703bbd51c02">libnet_build_ipv4</a>(u_int16_t ip_len, u_int8_t tos, u_int16_t <span class="keywordtype">id</span>, u_int16_t frag, +<a name="l00817"></a>00817 u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, +<a name="l00818"></a>00818 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00819"></a>00819 +<a name="l00838"></a>00838 libnet_ptag_t +<a name="l00839"></a>00839 <a class="code" href="libnet-functions_8h.html#f5a9b52bc56903e3c71b3ae155ffc1df">libnet_build_ipv4_options</a>(u_int8_t *options, u_int32_t options_s, libnet_t *l, +<a name="l00840"></a>00840 libnet_ptag_t ptag); +<a name="l00841"></a>00841 +<a name="l00855"></a>00855 libnet_ptag_t +<a name="l00856"></a>00856 <a class="code" href="libnet-functions_8h.html#bcef75c186b4db27f13a29c38b8f40ec">libnet_autobuild_ipv4</a>(u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t *l); +<a name="l00857"></a>00857 +<a name="l00873"></a>00873 libnet_ptag_t +<a name="l00874"></a>00874 <a class="code" href="libnet-functions_8h.html#844fc0a5b0f5acf57cbe4c9f42a1125c">libnet_build_ipv6</a>(u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, +<a name="l00875"></a>00875 u_int8_t hl, <span class="keyword">struct</span> libnet_in6_addr src, <span class="keyword">struct</span> libnet_in6_addr dst, +<a name="l00876"></a>00876 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00877"></a>00877 +<a name="l00890"></a>00890 libnet_ptag_t +<a name="l00891"></a>00891 <a class="code" href="libnet-functions_8h.html#6c65244937ef5bc8e84efa5fe54aaac9">libnet_build_ipv6_frag</a>(u_int8_t nh, u_int8_t reserved, u_int16_t frag, +<a name="l00892"></a>00892 u_int32_t <span class="keywordtype">id</span>, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l00893"></a>00893 libnet_ptag_t ptag); +<a name="l00894"></a>00894 +<a name="l00912"></a>00912 libnet_ptag_t +<a name="l00913"></a>00913 <a class="code" href="libnet-functions_8h.html#ccf52055b316417674bfcb76f85d6227">libnet_build_ipv6_routing</a>(u_int8_t nh, u_int8_t len, u_int8_t rtype, +<a name="l00914"></a>00914 u_int8_t segments, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l00915"></a>00915 libnet_ptag_t ptag); +<a name="l00916"></a>00916 +<a name="l00930"></a>00930 libnet_ptag_t +<a name="l00931"></a>00931 <a class="code" href="libnet-functions_8h.html#a5695b5f8419b440d41bbac0aaa34564">libnet_build_ipv6_destopts</a>(u_int8_t nh, u_int8_t len, u_int8_t *payload, +<a name="l00932"></a>00932 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00933"></a>00933 +<a name="l00948"></a>00948 libnet_ptag_t +<a name="l00949"></a>00949 <a class="code" href="libnet-functions_8h.html#db7b7870cc626d8d67f723de286034a9">libnet_build_ipv6_hbhopts</a>(u_int8_t nh, u_int8_t len, u_int8_t *payload, +<a name="l00950"></a>00950 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00951"></a>00951 +<a name="l00961"></a>00961 libnet_ptag_t +<a name="l00962"></a>00962 <a class="code" href="libnet-functions_8h.html#f21186614be986ab83740275bb984426">libnet_autobuild_ipv6</a>(u_int16_t len, u_int8_t nh, <span class="keyword">struct</span> libnet_in6_addr dst, +<a name="l00963"></a>00963 libnet_t *l, libnet_ptag_t ptag); +<a name="l00964"></a>00964 +<a name="l00982"></a>00982 libnet_ptag_t +<a name="l00983"></a>00983 <a class="code" href="libnet-functions_8h.html#84a2f87c5188f95a73ab04e7bb8eebf3">libnet_build_isl</a>(u_int8_t *dhost, u_int8_t type, u_int8_t user, +<a name="l00984"></a>00984 u_int8_t *shost, u_int16_t len, u_int8_t *snap, u_int16_t vid, +<a name="l00985"></a>00985 u_int16_t portindex, u_int16_t reserved, u_int8_t *payload, +<a name="l00986"></a>00986 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l00987"></a>00987 +<a name="l00999"></a>00999 libnet_ptag_t +<a name="l01000"></a>01000 <a class="code" href="libnet-functions_8h.html#7080bea55af439f0e74031197bc0924c">libnet_build_ipsec_esp_hdr</a>(u_int32_t spi, u_int32_t seq, u_int32_t iv, +<a name="l01001"></a>01001 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01002"></a>01002 +<a name="l01014"></a>01014 libnet_ptag_t +<a name="l01015"></a>01015 <a class="code" href="libnet-functions_8h.html#47d4aa351486618f993ed6e2652681b1">libnet_build_ipsec_esp_ftr</a>(u_int8_t len, u_int8_t nh, int8_t *auth, +<a name="l01016"></a>01016 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01017"></a>01017 +<a name="l01032"></a>01032 libnet_ptag_t +<a name="l01033"></a>01033 <a class="code" href="libnet-functions_8h.html#ad130b6104956524af16fcb18fa759e9">libnet_build_ipsec_ah</a>(u_int8_t nh, u_int8_t len, u_int16_t res, +<a name="l01034"></a>01034 u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload, +<a name="l01035"></a>01035 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01036"></a>01036 +<a name="l01053"></a>01053 libnet_ptag_t +<a name="l01054"></a>01054 <a class="code" href="libnet-functions_8h.html#98bc91a6c39910ee6069d789d8dcd3e6">libnet_build_dnsv4</a>(u_int16_t h_len, u_int16_t <span class="keywordtype">id</span>, u_int16_t flags, +<a name="l01055"></a>01055 u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, +<a name="l01056"></a>01056 u_int16_t num_addi_rr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l01057"></a>01057 libnet_ptag_t ptag); +<a name="l01058"></a>01058 +<a name="l01076"></a>01076 libnet_ptag_t +<a name="l01077"></a>01077 <a class="code" href="libnet-functions_8h.html#c9549e65e228cdfa901fca9012f1b52f">libnet_build_rip</a>(u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, +<a name="l01078"></a>01078 u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, +<a name="l01079"></a>01079 u_int32_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l01080"></a>01080 libnet_ptag_t ptag); +<a name="l01081"></a>01081 +<a name="l01104"></a>01104 libnet_ptag_t +<a name="l01105"></a>01105 <a class="code" href="libnet-functions_8h.html#33bdb212c766a869a55560d523deb807">libnet_build_rpc_call</a>(u_int32_t rm, u_int32_t xid, u_int32_t prog_num, +<a name="l01106"></a>01106 u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, +<a name="l01107"></a>01107 u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata, +<a name="l01108"></a>01108 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01109"></a>01109 +<a name="l01132"></a>01132 libnet_ptag_t +<a name="l01133"></a>01133 <a class="code" href="libnet-functions_8h.html#0a3c886a4103e0a80aea25d6d326b6bf">libnet_build_stp_conf</a>(u_int16_t <span class="keywordtype">id</span>, u_int8_t version, u_int8_t bpdu_type, +<a name="l01134"></a>01134 u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id, +<a name="l01135"></a>01135 u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, +<a name="l01136"></a>01136 u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload, +<a name="l01137"></a>01137 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01138"></a>01138 +<a name="l01152"></a>01152 libnet_ptag_t +<a name="l01153"></a>01153 <a class="code" href="libnet-functions_8h.html#0d0bf94c6887aec7702cf9f4190a1e55">libnet_build_stp_tcn</a>(u_int16_t <span class="keywordtype">id</span>, u_int8_t version, u_int8_t bpdu_type, +<a name="l01154"></a>01154 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01155"></a>01155 +<a name="l01173"></a>01173 libnet_ptag_t +<a name="l01174"></a>01174 <a class="code" href="libnet-functions_8h.html#65635fcbae54edb768ed36e8ce3abca6">libnet_build_token_ring</a>(u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, +<a name="l01175"></a>01175 u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, +<a name="l01176"></a>01176 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01177"></a>01177 +<a name="l01191"></a>01191 libnet_ptag_t +<a name="l01192"></a>01192 <a class="code" href="libnet-functions_8h.html#e2962f923beabedfe761dcd97cf41e87">libnet_autobuild_token_ring</a>(u_int8_t ac, u_int8_t fc, u_int8_t *dst, +<a name="l01193"></a>01193 u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, +<a name="l01194"></a>01194 libnet_t *l); +<a name="l01195"></a>01195 +<a name="l01215"></a>01215 libnet_ptag_t +<a name="l01216"></a>01216 <a class="code" href="libnet-functions_8h.html#e94f381e758de9faf26920042a2830e0">libnet_build_vrrp</a>(u_int8_t version, u_int8_t type, u_int8_t vrouter_id, +<a name="l01217"></a>01217 u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, +<a name="l01218"></a>01218 u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l01219"></a>01219 libnet_ptag_t ptag); +<a name="l01220"></a>01220 +<a name="l01233"></a>01233 libnet_ptag_t +<a name="l01234"></a>01234 <a class="code" href="libnet-functions_8h.html#2be4c11b7a37ab8ad9d46e1ebf3b53db">libnet_build_mpls</a>(u_int32_t label, u_int8_t experimental, u_int8_t bos, +<a name="l01235"></a>01235 u_int8_t ttl, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l01236"></a>01236 libnet_ptag_t ptag); +<a name="l01237"></a>01237 +<a name="l01265"></a>01265 libnet_ptag_t +<a name="l01266"></a>01266 <a class="code" href="libnet-functions_8h.html#a18676bbed2910988a65ace745226301">libnet_build_ntp</a>(u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, +<a name="l01267"></a>01267 u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, +<a name="l01268"></a>01268 u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, +<a name="l01269"></a>01269 u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, +<a name="l01270"></a>01270 u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, +<a name="l01271"></a>01271 u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, +<a name="l01272"></a>01272 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01273"></a>01273 +<a name="l01287"></a>01287 libnet_ptag_t +<a name="l01288"></a>01288 <a class="code" href="libnet-functions_8h.html#40115f0c696b84e2f4f84c09e72f60dc">libnet_build_ospfv2</a>(u_int16_t len, u_int8_t type, u_int32_t rtr_id, +<a name="l01289"></a>01289 u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload, +<a name="l01290"></a>01290 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01291"></a>01291 +<a name="l01306"></a>01306 libnet_ptag_t +<a name="l01307"></a>01307 <a class="code" href="libnet-functions_8h.html#0f0d868bb17ff951305327becaec80e5">libnet_build_ospfv2_hello</a>(u_int32_t netmask, u_int16_t interval, u_int8_t opts, +<a name="l01308"></a>01308 u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, +<a name="l01309"></a>01309 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01310"></a>01310 +<a name="l01322"></a>01322 libnet_ptag_t +<a name="l01323"></a>01323 <a class="code" href="libnet-functions_8h.html#60b59bb26475cd0892299c4888454b3b">libnet_build_ospfv2_dbd</a>(u_int16_t dgram_len, u_int8_t opts, u_int8_t type, +<a name="l01324"></a>01324 u_int seqnum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l01325"></a>01325 libnet_ptag_t ptag); +<a name="l01326"></a>01326 +<a name="l01337"></a>01337 libnet_ptag_t +<a name="l01338"></a>01338 <a class="code" href="libnet-functions_8h.html#bd981b21f34c0efcdbd7123f9c6b1ab4">libnet_build_ospfv2_lsr</a>(u_int type, u_int lsid, u_int32_t advrtr, +<a name="l01339"></a>01339 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01340"></a>01340 +<a name="l01349"></a>01349 libnet_ptag_t +<a name="l01350"></a>01350 <a class="code" href="libnet-functions_8h.html#9460b64aba613d6e367a3a6d472ae5e6">libnet_build_ospfv2_lsu</a>(u_int num, u_int8_t *payload, u_int32_t payload_s, +<a name="l01351"></a>01351 libnet_t *l, libnet_ptag_t ptag); +<a name="l01352"></a>01352 +<a name="l01368"></a>01368 libnet_ptag_t +<a name="l01369"></a>01369 <a class="code" href="libnet-functions_8h.html#8884632ef2860b3b292188fcacf54cf8">libnet_build_ospfv2_lsa</a>(u_int16_t age, u_int8_t opts, u_int8_t type, +<a name="l01370"></a>01370 u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, +<a name="l01371"></a>01371 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01372"></a>01372 +<a name="l01387"></a>01387 libnet_ptag_t +<a name="l01388"></a>01388 <a class="code" href="libnet-functions_8h.html#8f27133661d6c10e3c776cfb7e24b8b6">libnet_build_ospfv2_lsa_rtr</a>(u_int16_t flags, u_int16_t num, u_int <span class="keywordtype">id</span>, +<a name="l01389"></a>01389 u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload, +<a name="l01390"></a>01390 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01391"></a>01391 +<a name="l01401"></a>01401 libnet_ptag_t +<a name="l01402"></a>01402 <a class="code" href="libnet-functions_8h.html#ae2ddd904b99753f88073c1525e9a08f">libnet_build_ospfv2_lsa_net</a>(u_int32_t nmask, u_int rtrid, u_int8_t *payload, +<a name="l01403"></a>01403 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01404"></a>01404 +<a name="l01415"></a>01415 libnet_ptag_t +<a name="l01416"></a>01416 <a class="code" href="libnet-functions_8h.html#b9d76074203ed1e92683a056b6f7b8ba">libnet_build_ospfv2_lsa_sum</a>(u_int32_t nmask, u_int metric, u_int tos, +<a name="l01417"></a>01417 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01418"></a>01418 +<a name="l01430"></a>01430 libnet_ptag_t +<a name="l01431"></a>01431 <a class="code" href="libnet-functions_8h.html#bcecd50e35e742531f59cce0b90b8b79">libnet_build_ospfv2_lsa_as</a>(u_int32_t nmask, u_int metric, u_int32_t fwdaddr, +<a name="l01432"></a>01432 u_int tag, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l01433"></a>01433 libnet_ptag_t ptag); +<a name="l01434"></a>01434 +<a name="l01445"></a>01445 libnet_ptag_t +<a name="l01446"></a>01446 <a class="code" href="libnet-functions_8h.html#cb56eccdd9d924cd3a81affdbef4cf30">libnet_build_data</a>(u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l01447"></a>01447 libnet_ptag_t ptag); +<a name="l01448"></a>01448 +<a name="l01470"></a>01470 libnet_ptag_t +<a name="l01471"></a>01471 <a class="code" href="libnet-functions_8h.html#20d397bac4d614e395878f239d26d4dc">libnet_build_dhcpv4</a>(u_int8_t opcode, u_int8_t htype, u_int8_t hlen, +<a name="l01472"></a>01472 u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, +<a name="l01473"></a>01473 u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, +<a name="l01474"></a>01474 u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, +<a name="l01475"></a>01475 libnet_t *l, libnet_ptag_t ptag); +<a name="l01476"></a>01476 +<a name="l01498"></a>01498 libnet_ptag_t +<a name="l01499"></a>01499 <a class="code" href="libnet-functions_8h.html#37164c33698bd0c59cd51393a1fdfae6">libnet_build_bootpv4</a>(u_int8_t opcode, u_int8_t htype, u_int8_t hlen, +<a name="l01500"></a>01500 u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, +<a name="l01501"></a>01501 u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, +<a name="l01502"></a>01502 u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, +<a name="l01503"></a>01503 libnet_t *l, libnet_ptag_t ptag); +<a name="l01504"></a>01504 +<a name="l01509"></a>01509 u_int32_t +<a name="l01510"></a>01510 <a class="code" href="libnet-functions_8h.html#0af792a7e4bc49bd252b062cd4f35af5">libnet_getgre_length</a>(u_int16_t fv); +<a name="l01511"></a>01511 +<a name="l01534"></a>01534 libnet_ptag_t +<a name="l01535"></a>01535 <a class="code" href="libnet-functions_8h.html#fff121ac7bc157e3df0eb1bd624263c1">libnet_build_gre</a>(u_int16_t fv, u_int16_t type, u_int16_t sum, +<a name="l01536"></a>01536 u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, +<a name="l01537"></a>01537 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01538"></a>01538 +<a name="l01560"></a>01560 libnet_ptag_t +<a name="l01561"></a>01561 <a class="code" href="libnet-functions_8h.html#e8c54127e49779805cedf46506f564d4">libnet_build_egre</a>(u_int16_t fv, u_int16_t type, u_int16_t sum, +<a name="l01562"></a>01562 u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, +<a name="l01563"></a>01563 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01564"></a>01564 +<a name="l01576"></a>01576 libnet_ptag_t +<a name="l01577"></a>01577 <a class="code" href="libnet-functions_8h.html#7cca16e4e1b5ca96a1b0a35a2b766710">libnet_build_gre_sre</a>(u_int16_t af, u_int8_t offset, u_int8_t length, +<a name="l01578"></a>01578 u_int8_t *routing, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +<a name="l01579"></a>01579 libnet_ptag_t ptag); +<a name="l01580"></a>01580 +<a name="l01586"></a>01586 libnet_ptag_t +<a name="l01587"></a>01587 <a class="code" href="libnet-functions_8h.html#578594ad820ae9d82fe3f9ea470f0b27">libnet_build_gre_last_sre</a>(libnet_t *l, libnet_ptag_t ptag); +<a name="l01588"></a>01588 +<a name="l01610"></a>01610 libnet_ptag_t +<a name="l01611"></a>01611 <a class="code" href="libnet-functions_8h.html#5d7fd09f44af695b543beaff7abd2c1c">libnet_build_bgp4_header</a>(u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], +<a name="l01612"></a>01612 u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_t payload_s, +<a name="l01613"></a>01613 libnet_t *l, libnet_ptag_t ptag); +<a name="l01614"></a>01614 +<a name="l01631"></a>01631 libnet_ptag_t +<a name="l01632"></a>01632 <a class="code" href="libnet-functions_8h.html#9f5e3e137a1290437eb54ead063821f8">libnet_build_bgp4_open</a>(u_int8_t version, u_int16_t src_as, u_int16_t hold_time, +<a name="l01633"></a>01633 u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_t payload_s, +<a name="l01634"></a>01634 libnet_t *l, libnet_ptag_t ptag); +<a name="l01635"></a>01635 +<a name="l01651"></a>01651 libnet_ptag_t +<a name="l01652"></a>01652 <a class="code" href="libnet-functions_8h.html#213d5a264ea39a17fc0fc9edb3aac30c">libnet_build_bgp4_update</a>(u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt, +<a name="l01653"></a>01653 u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len, +<a name="l01654"></a>01654 u_int8_t *reachability_info, u_int8_t *payload, u_int32_t payload_s, +<a name="l01655"></a>01655 libnet_t *l, libnet_ptag_t ptag); +<a name="l01656"></a>01656 +<a name="l01669"></a>01669 libnet_ptag_t +<a name="l01670"></a>01670 <a class="code" href="libnet-functions_8h.html#1ba1e13d1fc8cc089ddd7931a6890d2b">libnet_build_bgp4_notification</a>(u_int8_t err_code, u_int8_t err_subcode, +<a name="l01671"></a>01671 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01672"></a>01672 +<a name="l01694"></a>01694 libnet_ptag_t +<a name="l01695"></a>01695 <a class="code" href="libnet-functions_8h.html#d20d81e5ce0cd581ff374242fb30a089">libnet_build_sebek</a>(u_int32_t magic, u_int16_t version, u_int16_t type, +<a name="l01696"></a>01696 u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, +<a name="l01697"></a>01697 u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, +<a name="l01698"></a>01698 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01699"></a>01699 +<a name="l01719"></a>01719 libnet_ptag_t +<a name="l01720"></a>01720 <a class="code" href="libnet-functions_8h.html#69bf76db8b62ec812cb734965c31eb46">libnet_build_hsrp</a>(u_int8_t version, u_int8_t opcode, u_int8_t state, +<a name="l01721"></a>01721 u_int8_t hello_time, u_int8_t hold_time, u_int8_t priority, u_int8_t group, +<a name="l01722"></a>01722 u_int8_t reserved, u_int8_t authdata[HSRP_AUTHDATA_LENGTH], u_int32_t virtual_ip, +<a name="l01723"></a>01723 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01724"></a>01724 +<a name="l01739"></a>01739 libnet_ptag_t +<a name="l01740"></a>01740 <a class="code" href="libnet-functions_8h.html#71bc438f807ab7e84d424533e81e1693">libnet_build_link</a>(u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, +<a name="l01741"></a>01741 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); +<a name="l01742"></a>01742 +<a name="l01753"></a>01753 libnet_ptag_t +<a name="l01754"></a>01754 <a class="code" href="libnet-functions_8h.html#3e21b6aaf8a1c690b6dca96c410083ee">libnet_autobuild_link</a>(u_int8_t *dst, u_int8_t *oui, u_int16_t type, +<a name="l01755"></a>01755 libnet_t *l); +<a name="l01756"></a>01756 +<a name="l01769"></a>01769 <span class="keywordtype">int</span> +<a name="l01770"></a>01770 <a class="code" href="libnet-functions_8h.html#53375552efe95906e152152fc170cc0d">libnet_write</a>(libnet_t *l); +<a name="l01771"></a>01771 +<a name="l01781"></a>01781 u_int32_t +<a name="l01782"></a>01782 <a class="code" href="libnet-functions_8h.html#e5143c0ab5dc9e9fa817d865eac428b0">libnet_get_ipaddr4</a>(libnet_t *l); +<a name="l01783"></a>01783 +<a name="l01789"></a>01789 <span class="keyword">struct </span>libnet_in6_addr +<a name="l01790"></a>01790 <a class="code" href="libnet-functions_8h.html#3d7de8968c2087df7a22140d7993e267">libnet_get_ipaddr6</a>(libnet_t *l); +<a name="l01791"></a>01791 +<a name="l01800"></a>01800 <span class="keyword">struct </span>libnet_ether_addr * +<a name="l01801"></a>01801 <a class="code" href="libnet-functions_8h.html#6531e479687de8d195bd1605422735ca">libnet_get_hwaddr</a>(libnet_t *l); +<a name="l01802"></a>01802 +<a name="l01812"></a>01812 u_int8_t * +<a name="l01813"></a>01813 <a class="code" href="libnet-functions_8h.html#66bfbb546b4a9fd49d446870b3b30bb0">libnet_hex_aton</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s, <span class="keywordtype">int</span> *len); +<a name="l01814"></a>01814 +<a name="l01819"></a>01819 <span class="keyword">const</span> <span class="keywordtype">char</span> * +<a name="l01820"></a>01820 <a class="code" href="libnet-functions_8h.html#5264b060183d307688780bf862fae37c">libnet_version</a>(<span class="keywordtype">void</span>); +<a name="l01821"></a>01821 +<a name="l01837"></a>01837 <span class="keywordtype">int</span> +<a name="l01838"></a>01838 <a class="code" href="libnet-functions_8h.html#9040018e0c1b2c795066941c0ebfc015">libnet_adv_cull_packet</a>(libnet_t *l, u_int8_t **packet, u_int32_t *packet_s); +<a name="l01839"></a>01839 +<a name="l01852"></a>01852 <span class="keywordtype">int</span> +<a name="l01853"></a>01853 <a class="code" href="libnet-functions_8h.html#e804d72696e8e050bd0893b1869b3126">libnet_adv_cull_header</a>(libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, +<a name="l01854"></a>01854 u_int32_t *header_s); +<a name="l01855"></a>01855 +<a name="l01869"></a>01869 <span class="keywordtype">int</span> +<a name="l01870"></a>01870 <a class="code" href="libnet-functions_8h.html#f70276132971083dba940f40b1487434">libnet_adv_write_link</a>(libnet_t *l, u_int8_t *packet, u_int32_t packet_s); +<a name="l01871"></a>01871 +<a name="l01885"></a>01885 <span class="keywordtype">int</span> +<a name="l01886"></a>01886 <a class="code" href="libnet-functions_8h.html#fa26941a0155d45914003642c6976ff4">libnet_adv_write_raw_ipv4</a>(libnet_t *l, u_int8_t *packet, u_int32_t packet_s); +<a name="l01887"></a>01887 +<a name="l01894"></a>01894 <span class="keywordtype">void</span> +<a name="l01895"></a>01895 <a class="code" href="libnet-functions_8h.html#b73eb15623b02971e5a45d8bf82fb9e2">libnet_adv_free_packet</a>(libnet_t *l, u_int8_t *packet); +<a name="l01896"></a>01896 +<a name="l01910"></a>01910 <span class="keywordtype">int</span> +<a name="l01911"></a>01911 <a class="code" href="libnet-functions_8h.html#20887ffe940f1d2c5bcae79a188176c6">libnet_cq_add</a>(libnet_t *l, <span class="keywordtype">char</span> *label); +<a name="l01912"></a>01912 +<a name="l01927"></a>01927 libnet_t * +<a name="l01928"></a>01928 <a class="code" href="libnet-functions_8h.html#29f60504a0fe9b7bf6f5a962063118bb">libnet_cq_remove</a>(libnet_t *l); +<a name="l01929"></a>01929 +<a name="l01941"></a>01941 libnet_t * +<a name="l01942"></a>01942 <a class="code" href="libnet-functions_8h.html#4e972664a0d839eab039f8fb2379987a">libnet_cq_remove_by_label</a>(<span class="keywordtype">char</span> *label); +<a name="l01943"></a>01943 +<a name="l01950"></a>01950 <span class="keyword">const</span> <span class="keywordtype">char</span> * +<a name="l01951"></a>01951 <a class="code" href="libnet-functions_8h.html#bb1341d217de4d9c39ec484951e518b0">libnet_cq_getlabel</a>(libnet_t *l); +<a name="l01952"></a>01952 +<a name="l01959"></a>01959 libnet_t * +<a name="l01960"></a>01960 <a class="code" href="libnet-functions_8h.html#0cd216f0e5563ee06043a8ebfa16fe57">libnet_cq_find_by_label</a>(<span class="keywordtype">char</span> *label); +<a name="l01961"></a>01961 +<a name="l01967"></a>01967 <span class="keywordtype">void</span> +<a name="l01968"></a>01968 <a class="code" href="libnet-functions_8h.html#565d99e292980d5033bef2d186596217">libnet_cq_destroy</a>(<span class="keywordtype">void</span>); +<a name="l01969"></a>01969 +<a name="l01989"></a>01989 libnet_t * +<a name="l01990"></a>01990 <a class="code" href="libnet-functions_8h.html#7e98a045ac6e29ca421507d9a200b5aa">libnet_cq_head</a>(<span class="keywordtype">void</span>); +<a name="l01991"></a>01991 +<a name="l01997"></a>01997 <span class="keywordtype">int</span> +<a name="l01998"></a>01998 <a class="code" href="libnet-functions_8h.html#ab1eb1e3ae64cde579a5a6035d5406c8">libnet_cq_last</a>(<span class="keywordtype">void</span>); +<a name="l01999"></a>01999 +<a name="l02005"></a>02005 libnet_t * +<a name="l02006"></a>02006 <a class="code" href="libnet-functions_8h.html#d312f3182e3e5367db87fc6bab32604d">libnet_cq_next</a>(<span class="keywordtype">void</span>); +<a name="l02007"></a>02007 +<a name="l02013"></a>02013 u_int32_t +<a name="l02014"></a>02014 <a class="code" href="libnet-functions_8h.html#d2d4679155425c02822559bcb0caa275">libnet_cq_size</a>(<span class="keywordtype">void</span>); +<a name="l02015"></a>02015 +<a name="l02019"></a>02019 u_int32_t +<a name="l02020"></a>02020 <a class="code" href="libnet-functions_8h.html#4846c3ce22db19195b235ad11d7c60ce">libnet_cq_end_loop</a>(<span class="keywordtype">void</span>); +<a name="l02021"></a>02021 +<a name="l02027"></a>02027 <span class="keywordtype">void</span> +<a name="l02028"></a>02028 <a class="code" href="libnet-functions_8h.html#3aa6623246e13310dc6f9f9834e7313b">libnet_diag_dump_context</a>(libnet_t *l); +<a name="l02029"></a>02029 +<a name="l02035"></a>02035 <span class="keywordtype">void</span> +<a name="l02036"></a>02036 <a class="code" href="libnet-functions_8h.html#9825c6c69efd6ef24545d59177a333e6">libnet_diag_dump_pblock</a>(libnet_t *l); +<a name="l02037"></a>02037 +<a name="l02044"></a>02044 <span class="keywordtype">char</span> * +<a name="l02045"></a>02045 <a class="code" href="libnet-functions_8h.html#053bcb30c956b858db88b9a551e9360b">libnet_diag_dump_pblock_type</a>(u_int8_t type); +<a name="l02046"></a>02046 +<a name="l02060"></a>02060 <span class="keywordtype">void</span> +<a name="l02061"></a>02061 <a class="code" href="libnet-functions_8h.html#862af1289e6eb7a930e18bf1f3008cd4">libnet_diag_dump_hex</a>(u_int8_t *packet, u_int32_t len, <span class="keywordtype">int</span> swap, FILE *stream); +<a name="l02062"></a>02062 +<a name="l02063"></a>02063 <span class="comment">/*</span> +<a name="l02064"></a>02064 <span class="comment"> * [Internal] </span> +<a name="l02065"></a>02065 <span class="comment"> */</span> +<a name="l02066"></a>02066 <span class="keywordtype">int</span> +<a name="l02067"></a>02067 libnet_write_raw_ipv4(libnet_t *l, u_int8_t *packet, u_int32_t size); +<a name="l02068"></a>02068 +<a name="l02069"></a>02069 <span class="comment">/*</span> +<a name="l02070"></a>02070 <span class="comment"> * [Internal] </span> +<a name="l02071"></a>02071 <span class="comment"> */</span> +<a name="l02072"></a>02072 <span class="keywordtype">int</span> +<a name="l02073"></a>02073 libnet_write_raw_ipv6(libnet_t *l, u_int8_t *packet, u_int32_t size); +<a name="l02074"></a>02074 +<a name="l02075"></a>02075 <span class="comment">/*</span> +<a name="l02076"></a>02076 <span class="comment"> * [Internal] </span> +<a name="l02077"></a>02077 <span class="comment"> */</span> +<a name="l02078"></a>02078 <span class="keywordtype">int</span> +<a name="l02079"></a>02079 libnet_write_link(libnet_t *l, u_int8_t *packet, u_int32_t size); +<a name="l02080"></a>02080 +<a name="l02081"></a>02081 <span class="preprocessor">#if ((__WIN32__) && !(__CYGWIN__))</span> +<a name="l02082"></a>02082 <span class="preprocessor"></span><span class="comment">/*</span> +<a name="l02083"></a>02083 <span class="comment"> * [Internal] </span> +<a name="l02084"></a>02084 <span class="comment"> */</span> +<a name="l02085"></a>02085 SOCKET +<a name="l02086"></a>02086 libnet_open_raw4(libnet_t *l); +<a name="l02087"></a>02087 <span class="preprocessor">#else</span> +<a name="l02088"></a>02088 <span class="preprocessor"></span><span class="comment">/*</span> +<a name="l02089"></a>02089 <span class="comment"> * [Internal] </span> +<a name="l02090"></a>02090 <span class="comment"> */</span> +<a name="l02091"></a>02091 <span class="keywordtype">int</span> +<a name="l02092"></a>02092 libnet_open_raw4(libnet_t *l); +<a name="l02093"></a>02093 <span class="preprocessor">#endif</span> +<a name="l02094"></a>02094 <span class="preprocessor"></span> +<a name="l02095"></a>02095 <span class="comment">/*</span> +<a name="l02096"></a>02096 <span class="comment"> * [Internal] </span> +<a name="l02097"></a>02097 <span class="comment"> */</span> +<a name="l02098"></a>02098 <span class="keywordtype">int</span> +<a name="l02099"></a>02099 libnet_close_raw4(libnet_t *l); +<a name="l02100"></a>02100 +<a name="l02101"></a>02101 <span class="comment">/*</span> +<a name="l02102"></a>02102 <span class="comment"> * [Internal] </span> +<a name="l02103"></a>02103 <span class="comment"> */</span> +<a name="l02104"></a>02104 <span class="keywordtype">int</span> +<a name="l02105"></a>02105 libnet_open_raw6(libnet_t *l); +<a name="l02106"></a>02106 +<a name="l02107"></a>02107 <span class="comment">/*</span> +<a name="l02108"></a>02108 <span class="comment"> * [Internal] </span> +<a name="l02109"></a>02109 <span class="comment"> */</span> +<a name="l02110"></a>02110 <span class="keywordtype">int</span> +<a name="l02111"></a>02111 libnet_close_raw6(libnet_t *l); +<a name="l02112"></a>02112 +<a name="l02113"></a>02113 <span class="comment">/*</span> +<a name="l02114"></a>02114 <span class="comment"> * [Internal] </span> +<a name="l02115"></a>02115 <span class="comment"> */</span> +<a name="l02116"></a>02116 <span class="keywordtype">int</span> +<a name="l02117"></a>02117 libnet_select_device(libnet_t *l); +<a name="l02118"></a>02118 +<a name="l02119"></a>02119 <span class="comment">/*</span> +<a name="l02120"></a>02120 <span class="comment"> * [Internal] </span> +<a name="l02121"></a>02121 <span class="comment"> */</span> +<a name="l02122"></a>02122 <span class="keywordtype">int</span> +<a name="l02123"></a>02123 libnet_open_link(libnet_t *l); +<a name="l02124"></a>02124 +<a name="l02125"></a>02125 <span class="comment">/*</span> +<a name="l02126"></a>02126 <span class="comment"> * [Internal] </span> +<a name="l02127"></a>02127 <span class="comment"> */</span> +<a name="l02128"></a>02128 <span class="keywordtype">int</span> +<a name="l02129"></a>02129 libnet_close_link(libnet_t *l); +<a name="l02130"></a>02130 +<a name="l02131"></a>02131 <span class="comment">/*</span> +<a name="l02132"></a>02132 <span class="comment"> * [Internal] </span> +<a name="l02133"></a>02133 <span class="comment"> */</span> +<a name="l02134"></a>02134 <span class="keywordtype">int</span> +<a name="l02135"></a>02135 libnet_do_checksum(libnet_t *l, u_int8_t *packet, <span class="keywordtype">int</span> protocol, <span class="keywordtype">int</span> len); +<a name="l02136"></a>02136 +<a name="l02137"></a>02137 <span class="comment">/*</span> +<a name="l02138"></a>02138 <span class="comment"> * [Internal] </span> +<a name="l02139"></a>02139 <span class="comment"> */</span> +<a name="l02140"></a>02140 u_int32_t +<a name="l02141"></a>02141 libnet_compute_crc(u_int8_t *buf, u_int32_t len); +<a name="l02142"></a>02142 +<a name="l02143"></a>02143 <span class="comment">/*</span> +<a name="l02144"></a>02144 <span class="comment"> * [Internal] </span> +<a name="l02145"></a>02145 <span class="comment"> */</span> +<a name="l02146"></a>02146 u_int16_t +<a name="l02147"></a>02147 libnet_ip_check(u_int16_t *addr, <span class="keywordtype">int</span> len); +<a name="l02148"></a>02148 +<a name="l02149"></a>02149 <span class="comment">/*</span> +<a name="l02150"></a>02150 <span class="comment"> * [Internal] </span> +<a name="l02151"></a>02151 <span class="comment"> */</span> +<a name="l02152"></a>02152 <span class="keywordtype">int</span> +<a name="l02153"></a>02153 libnet_in_cksum(u_int16_t *addr, <span class="keywordtype">int</span> len); +<a name="l02154"></a>02154 +<a name="l02155"></a>02155 <span class="comment">/*</span> +<a name="l02156"></a>02156 <span class="comment"> * [Internal] </span> +<a name="l02157"></a>02157 <span class="comment"> * If ptag is 0, function will create a pblock for the protocol unit type,</span> +<a name="l02158"></a>02158 <span class="comment"> * append it to the list and return a pointer to it. If ptag is not 0,</span> +<a name="l02159"></a>02159 <span class="comment"> * function will search the pblock list for the specified protocol block </span> +<a name="l02160"></a>02160 <span class="comment"> * and return a pointer to it.</span> +<a name="l02161"></a>02161 <span class="comment"> */</span> +<a name="l02162"></a>02162 libnet_pblock_t * +<a name="l02163"></a>02163 libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, u_int32_t n, +<a name="l02164"></a>02164 u_int8_t type); +<a name="l02165"></a>02165 +<a name="l02166"></a>02166 <span class="comment">/*</span> +<a name="l02167"></a>02167 <span class="comment"> * [Internal] </span> +<a name="l02168"></a>02168 <span class="comment"> * Function creates the pblock list if l->protocol_blocks == NULL or appends</span> +<a name="l02169"></a>02169 <span class="comment"> * an entry to the doubly linked list.</span> +<a name="l02170"></a>02170 <span class="comment"> */</span> +<a name="l02171"></a>02171 libnet_pblock_t * +<a name="l02172"></a>02172 libnet_pblock_new(libnet_t *l, u_int32_t size); +<a name="l02173"></a>02173 +<a name="l02174"></a>02174 <span class="comment">/*</span> +<a name="l02175"></a>02175 <span class="comment"> * [Internal] </span> +<a name="l02176"></a>02176 <span class="comment"> * Function swaps two pblocks in memory.</span> +<a name="l02177"></a>02177 <span class="comment"> */</span> +<a name="l02178"></a>02178 <span class="keywordtype">int</span> +<a name="l02179"></a>02179 libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2); +<a name="l02180"></a>02180 +<a name="l02181"></a>02181 <span class="comment">/*</span> +<a name="l02182"></a>02182 <span class="comment"> * [Internal] </span> +<a name="l02183"></a>02183 <span class="comment"> * Function inserts a pblock into the doubly linked list.</span> +<a name="l02184"></a>02184 <span class="comment"> */</span> +<a name="l02185"></a>02185 <span class="keywordtype">int</span> +<a name="l02186"></a>02186 libnet_pblock_insert_before(libnet_t *l, libnet_ptag_t ptag1, +<a name="l02187"></a>02187 libnet_ptag_t ptag2); +<a name="l02188"></a>02188 +<a name="l02189"></a>02189 <span class="comment">/*</span> +<a name="l02190"></a>02190 <span class="comment"> * [Internal] </span> +<a name="l02191"></a>02191 <span class="comment"> * Function removes a pblock from context </span> +<a name="l02192"></a>02192 <span class="comment"> */</span> +<a name="l02193"></a>02193 <span class="keywordtype">void</span> +<a name="l02194"></a>02194 libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p); +<a name="l02195"></a>02195 +<a name="l02196"></a>02196 <span class="comment">/*</span> +<a name="l02197"></a>02197 <span class="comment"> * [Internal] </span> +<a name="l02198"></a>02198 <span class="comment"> * Function updates the pblock meta-inforation. Internally it updates the</span> +<a name="l02199"></a>02199 <span class="comment"> * ptag with a monotonically increasing variable kept in l. This way each</span> +<a name="l02200"></a>02200 <span class="comment"> * pblock has a succesively increasing ptag identifier.</span> +<a name="l02201"></a>02201 <span class="comment"> */</span> +<a name="l02202"></a>02202 libnet_ptag_t +<a name="l02203"></a>02203 libnet_pblock_update(libnet_t *l, libnet_pblock_t *p, u_int32_t h, +<a name="l02204"></a>02204 u_int8_t type); +<a name="l02205"></a>02205 +<a name="l02206"></a>02206 +<a name="l02207"></a>02207 <span class="comment">/*</span> +<a name="l02208"></a>02208 <span class="comment"> * [Internal]</span> +<a name="l02209"></a>02209 <span class="comment"> * Checksums are a real pain in the <beep>!!!</span> +<a name="l02210"></a>02210 <span class="comment"> * Function updates referer used to compute the checksum. All</span> +<a name="l02211"></a>02211 <span class="comment"> * pblock need to know where is their referer (ie IP header).</span> +<a name="l02212"></a>02212 <span class="comment"> * So, this function is called each time a new IP header is inserted.</span> +<a name="l02213"></a>02213 <span class="comment"> * It updates the ip_offset field (referer) of each previous pblock.</span> +<a name="l02214"></a>02214 <span class="comment"> */</span> +<a name="l02215"></a>02215 <span class="keywordtype">void</span> +<a name="l02216"></a>02216 libnet_pblock_record_ip_offset(libnet_t *l, libnet_pblock_t *p); +<a name="l02217"></a>02217 +<a name="l02218"></a>02218 <span class="comment">/*</span> +<a name="l02219"></a>02219 <span class="comment"> * [Internal] </span> +<a name="l02220"></a>02220 <span class="comment"> * Function locates a given block by it's ptag. </span> +<a name="l02221"></a>02221 <span class="comment"> */</span> +<a name="l02222"></a>02222 libnet_pblock_t * +<a name="l02223"></a>02223 libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag); +<a name="l02224"></a>02224 +<a name="l02225"></a>02225 <span class="comment">/*</span> +<a name="l02226"></a>02226 <span class="comment"> * [Internal] </span> +<a name="l02227"></a>02227 <span class="comment"> * Function copies protocol block data over.</span> +<a name="l02228"></a>02228 <span class="comment"> */</span> +<a name="l02229"></a>02229 <span class="keywordtype">int</span> +<a name="l02230"></a>02230 libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, +<a name="l02231"></a>02231 u_int32_t len); +<a name="l02232"></a>02232 +<a name="l02233"></a>02233 <span class="comment">/*</span> +<a name="l02234"></a>02234 <span class="comment"> * [Internal] </span> +<a name="l02235"></a>02235 <span class="comment"> * Function sets pblock flags.</span> +<a name="l02236"></a>02236 <span class="comment"> */</span> +<a name="l02237"></a>02237 <span class="keywordtype">void</span> +<a name="l02238"></a>02238 libnet_pblock_setflags(libnet_pblock_t *p, u_int8_t flags); +<a name="l02239"></a>02239 +<a name="l02240"></a>02240 <span class="comment">/*</span> +<a name="l02241"></a>02241 <span class="comment"> * [Internal] </span> +<a name="l02242"></a>02242 <span class="comment"> * Function returns the protocol number for the protocol block type. If</span> +<a name="l02243"></a>02243 <span class="comment"> * the type is unknown, the function defaults to returning IPPROTO_IP.</span> +<a name="l02244"></a>02244 <span class="comment"> */</span> +<a name="l02245"></a>02245 <span class="keywordtype">int</span> +<a name="l02246"></a>02246 libnet_pblock_p2p(u_int8_t type); +<a name="l02247"></a>02247 +<a name="l02248"></a>02248 <span class="comment">/*</span> +<a name="l02249"></a>02249 <span class="comment"> * [Internal] </span> +<a name="l02250"></a>02250 <span class="comment"> * Function assembles the packet for subsequent writing. Function makes two</span> +<a name="l02251"></a>02251 <span class="comment"> * passes through the pblock list:</span> +<a name="l02252"></a>02252 <span class="comment"> */</span> +<a name="l02253"></a>02253 <span class="keywordtype">int</span> +<a name="l02254"></a>02254 libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size); +<a name="l02255"></a>02255 +<a name="l02256"></a>02256 <span class="preprocessor">#if !(__WIN32__)</span> +<a name="l02257"></a>02257 <span class="preprocessor"></span><span class="comment">/*</span> +<a name="l02258"></a>02258 <span class="comment"> * [Internal] </span> +<a name="l02259"></a>02259 <span class="comment"> * By testing if we can retrieve the FLAGS of an iface</span> +<a name="l02260"></a>02260 <span class="comment"> * we can know if it exists or not and if it is up.</span> +<a name="l02261"></a>02261 <span class="comment"> */</span> +<a name="l02262"></a>02262 <span class="keywordtype">int</span> +<a name="l02263"></a>02263 libnet_check_iface(libnet_t *l); +<a name="l02264"></a>02264 <span class="preprocessor">#endif</span> +<a name="l02265"></a>02265 <span class="preprocessor"></span> +<a name="l02266"></a>02266 <span class="preprocessor">#if defined(__WIN32__)</span> +<a name="l02267"></a>02267 <span class="preprocessor"></span><span class="comment">/*</span> +<a name="l02268"></a>02268 <span class="comment"> * [Internal] </span> +<a name="l02269"></a>02269 <span class="comment"> */</span> +<a name="l02270"></a>02270 BYTE * +<a name="l02271"></a>02271 libnet_win32_get_remote_mac(libnet_t *l, DWORD IP); +<a name="l02272"></a>02272 +<a name="l02273"></a>02273 <span class="comment">/*</span> +<a name="l02274"></a>02274 <span class="comment"> * [Internal] </span> +<a name="l02275"></a>02275 <span class="comment"> */</span> +<a name="l02276"></a>02276 <span class="keywordtype">int</span> +<a name="l02277"></a>02277 libnet_close_link_interface(libnet_t *l); +<a name="l02278"></a>02278 +<a name="l02279"></a>02279 <span class="comment">/*</span> +<a name="l02280"></a>02280 <span class="comment"> * [Internal] </span> +<a name="l02281"></a>02281 <span class="comment"> */</span> +<a name="l02282"></a>02282 BYTE * +<a name="l02283"></a>02283 libnet_win32_read_arp_table(DWORD IP); +<a name="l02284"></a>02284 <span class="preprocessor">#endif</span> +<a name="l02285"></a>02285 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_FUNCTIONS_H */</span> +<a name="l02286"></a>02286 +<a name="l02287"></a>02287 <span class="comment">/* EOF */</span> +</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-functions_8h.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-functions_8h.html new file mode 100644 index 0000000..7fe89be --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-functions_8h.html @@ -0,0 +1,7942 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet-functions.h File Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet-functions.h File Reference</h1>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><table border="0" cellpadding="0" cellspacing="0"> +<tr><td></td></tr> +<tr><td colspan="2"><br><h2>Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#6a879b30d3e1864fd9bad33e195223b5">libnet_init</a> (int injection_type, char *device, char *err_buf)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#591804711cffa92582703a5aedbd9b25">libnet_destroy</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#b84889f7fe57a1801cf03eceac47463e">libnet_clear_packet</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#886dc359d6add4b0608e8611af7e1b35">libnet_stats</a> (libnet_t *l, struct libnet_stats *ls)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#b9b137f454b3da05d4ac5fe388c1f2b8">libnet_getfd</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#1e68365ece2c976a75bc50e91df40ea0">libnet_getdevice</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#8b784c9899c429dd0f4790a71bdf55a2">libnet_getpbuf</a> (libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#095de516e5b119d6e72fff4286157386">libnet_getpbuf_size</a> (libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a04f828cf6b7ade20204ec0e3dcbc778">libnet_getpacket_size</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#69470998be995ec8c5e11ecbb19137f5">libnet_seed_prand</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#453d816dc8adffaefc040a1bf5bd9b5f">libnet_get_prand</a> (int mod)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#d36144707ce7994c12ef9d87dc9a2edf">libnet_toggle_checksum</a> (libnet_t *l, libnet_ptag_t ptag, int mode)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#65cea3a63aac7a17f681ab15fcfd2947">libnet_addr2name4</a> (u_int32_t in, u_int8_t use_name)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#5042e4e9d37d9c1ab566b8d3b97e21a2">libnet_name2addr4</a> (libnet_t *l, char *host_name, u_int8_t use_name)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">struct libnet_in6_addr </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#6f3677b524c46fad4d185be9a3142099">libnet_name2addr6</a> (libnet_t *l, char *host_name, u_int8_t use_name)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#221ab1d86e36a0b1411eebdbea0cd012">libnet_addr2name6_r</a> (struct libnet_in6_addr addr, u_int8_t use_name, char *host_name, int host_name_len)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#aee8e5f54482bf3c9b7c5b101fa8f41f">libnet_plist_chain_new</a> (libnet_t *l, libnet_plist_t **plist, char *token_list)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#05ced873eacf4a000e4ce3a3ab635108">libnet_plist_chain_next_pair</a> (libnet_plist_t *plist, u_int16_t *bport, u_int16_t *eport)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#39e332daa771627372a01867818b4301">libnet_plist_chain_dump</a> (libnet_plist_t *plist)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#b854695d1306f9af440145fc6767d953">libnet_plist_chain_dump_string</a> (libnet_plist_t *plist)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#b5cb1d70164207a7c279a909576058be">libnet_plist_chain_free</a> (libnet_plist_t *plist)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#60a223766dc718c544ec500b0829d39e">libnet_build_802_1q</a> (u_int8_t *dst, u_int8_t *src, u_int16_t tpi, u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#2e2ba82d84c8af087e53c60cb2cf0f16">libnet_build_802_1x</a> (u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#df241a95102fc267d0a20a1a73f0c5f1">libnet_build_802_2</a> (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#997b6c996b95fbcb09f87a0caf12ffa0">libnet_build_802_2snap</a> (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#55367f2634cf6409bbda8bbf5b834877">libnet_build_802_3</a> (u_int8_t *dst, u_int8_t *src, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#b8a60ba5d3c669a1439ace4f91ee52e0">libnet_build_ethernet</a> (u_int8_t *dst, u_int8_t *src, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#0ab98b1c67ac61b39b646ecfd93d58e3">libnet_autobuild_ethernet</a> (u_int8_t *dst, u_int16_t type, libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#2fb726d9841fa180bd79ab0a6362f533">libnet_build_fddi</a> (u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#2a0f9f03a1c43253638ecb07dfc2bb62">libnet_autobuild_fddi</a> (u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#65c81208185c68937ef97c0203d3d924">libnet_build_arp</a> (u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#c2ac4909b3657c4ac34c80dbc9f91abe">libnet_autobuild_arp</a> (u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#24b1a32adad116ddc743482a229af490">libnet_build_tcp</a> (u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#316a2d08bdd3199b6b30fa446b48df51">libnet_build_tcp_options</a> (u_int8_t *options, u_int32_t options_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#6d3f91d01237eef2f82ffd322ecbc792">libnet_build_udp</a> (u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#e16743df24525d5ab9b4c1ef13e87423">libnet_build_cdp</a> (u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#b80f86d2cbf32126fe5952cc77d7c512">libnet_build_icmpv4_echo</a> (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#58605cfff0090e3cbf26abd5b7194c16">libnet_build_icmpv4_mask</a> (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#d8e682f057f00dc53fe82960d7893b3f">libnet_build_icmpv4_unreach</a> (u_int8_t type, u_int8_t code, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#973112121198b7151d21ab7285f6ae34">libnet_build_icmpv4_redirect</a> (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t gateway, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#87fd21c0e964dc0e2f8866178240db39">libnet_build_icmpv4_timeexceed</a> (u_int8_t type, u_int8_t code, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#512a61266327928df97b010bc3f821b6">libnet_build_icmpv4_timestamp</a> (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#d614cefecf7ffbabdf241e707c474575">libnet_build_igmp</a> (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ace7ef7ee9dab7064eafc703bbd51c02">libnet_build_ipv4</a> (u_int16_t ip_len, u_int8_t tos, u_int16_t id, u_int16_t frag, u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#f5a9b52bc56903e3c71b3ae155ffc1df">libnet_build_ipv4_options</a> (u_int8_t *options, u_int32_t options_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#bcef75c186b4db27f13a29c38b8f40ec">libnet_autobuild_ipv4</a> (u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#844fc0a5b0f5acf57cbe4c9f42a1125c">libnet_build_ipv6</a> (u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#6c65244937ef5bc8e84efa5fe54aaac9">libnet_build_ipv6_frag</a> (u_int8_t nh, u_int8_t reserved, u_int16_t frag, u_int32_t id, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ccf52055b316417674bfcb76f85d6227">libnet_build_ipv6_routing</a> (u_int8_t nh, u_int8_t len, u_int8_t rtype, u_int8_t segments, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a5695b5f8419b440d41bbac0aaa34564">libnet_build_ipv6_destopts</a> (u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#db7b7870cc626d8d67f723de286034a9">libnet_build_ipv6_hbhopts</a> (u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#f21186614be986ab83740275bb984426">libnet_autobuild_ipv6</a> (u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#84a2f87c5188f95a73ab04e7bb8eebf3">libnet_build_isl</a> (u_int8_t *dhost, u_int8_t type, u_int8_t user, u_int8_t *shost, u_int16_t len, u_int8_t *snap, u_int16_t vid, u_int16_t portindex, u_int16_t reserved, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#7080bea55af439f0e74031197bc0924c">libnet_build_ipsec_esp_hdr</a> (u_int32_t spi, u_int32_t seq, u_int32_t iv, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#47d4aa351486618f993ed6e2652681b1">libnet_build_ipsec_esp_ftr</a> (u_int8_t len, u_int8_t nh, int8_t *auth, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ad130b6104956524af16fcb18fa759e9">libnet_build_ipsec_ah</a> (u_int8_t nh, u_int8_t len, u_int16_t res, u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#98bc91a6c39910ee6069d789d8dcd3e6">libnet_build_dnsv4</a> (u_int16_t h_len, u_int16_t id, u_int16_t flags, u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, u_int16_t num_addi_rr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#c9549e65e228cdfa901fca9012f1b52f">libnet_build_rip</a> (u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, u_int32_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#33bdb212c766a869a55560d523deb807">libnet_build_rpc_call</a> (u_int32_t rm, u_int32_t xid, u_int32_t prog_num, u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#0a3c886a4103e0a80aea25d6d326b6bf">libnet_build_stp_conf</a> (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id, u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#0d0bf94c6887aec7702cf9f4190a1e55">libnet_build_stp_tcn</a> (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#65635fcbae54edb768ed36e8ce3abca6">libnet_build_token_ring</a> (u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#e2962f923beabedfe761dcd97cf41e87">libnet_autobuild_token_ring</a> (u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#e94f381e758de9faf26920042a2830e0">libnet_build_vrrp</a> (u_int8_t version, u_int8_t type, u_int8_t vrouter_id, u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#2be4c11b7a37ab8ad9d46e1ebf3b53db">libnet_build_mpls</a> (u_int32_t label, u_int8_t experimental, u_int8_t bos, u_int8_t ttl, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#a18676bbed2910988a65ace745226301">libnet_build_ntp</a> (u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#40115f0c696b84e2f4f84c09e72f60dc">libnet_build_ospfv2</a> (u_int16_t len, u_int8_t type, u_int32_t rtr_id, u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#0f0d868bb17ff951305327becaec80e5">libnet_build_ospfv2_hello</a> (u_int32_t netmask, u_int16_t interval, u_int8_t opts, u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#60b59bb26475cd0892299c4888454b3b">libnet_build_ospfv2_dbd</a> (u_int16_t dgram_len, u_int8_t opts, u_int8_t type, u_int seqnum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#bd981b21f34c0efcdbd7123f9c6b1ab4">libnet_build_ospfv2_lsr</a> (u_int type, u_int lsid, u_int32_t advrtr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#9460b64aba613d6e367a3a6d472ae5e6">libnet_build_ospfv2_lsu</a> (u_int num, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#8884632ef2860b3b292188fcacf54cf8">libnet_build_ospfv2_lsa</a> (u_int16_t age, u_int8_t opts, u_int8_t type, u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#8f27133661d6c10e3c776cfb7e24b8b6">libnet_build_ospfv2_lsa_rtr</a> (u_int16_t flags, u_int16_t num, u_int id, u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ae2ddd904b99753f88073c1525e9a08f">libnet_build_ospfv2_lsa_net</a> (u_int32_t nmask, u_int rtrid, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#b9d76074203ed1e92683a056b6f7b8ba">libnet_build_ospfv2_lsa_sum</a> (u_int32_t nmask, u_int metric, u_int tos, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#bcecd50e35e742531f59cce0b90b8b79">libnet_build_ospfv2_lsa_as</a> (u_int32_t nmask, u_int metric, u_int32_t fwdaddr, u_int tag, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#cb56eccdd9d924cd3a81affdbef4cf30">libnet_build_data</a> (u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#20d397bac4d614e395878f239d26d4dc">libnet_build_dhcpv4</a> (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#37164c33698bd0c59cd51393a1fdfae6">libnet_build_bootpv4</a> (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#0af792a7e4bc49bd252b062cd4f35af5">libnet_getgre_length</a> (u_int16_t fv)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#fff121ac7bc157e3df0eb1bd624263c1">libnet_build_gre</a> (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#e8c54127e49779805cedf46506f564d4">libnet_build_egre</a> (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#7cca16e4e1b5ca96a1b0a35a2b766710">libnet_build_gre_sre</a> (u_int16_t af, u_int8_t offset, u_int8_t length, u_int8_t *routing, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#578594ad820ae9d82fe3f9ea470f0b27">libnet_build_gre_last_sre</a> (libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#5d7fd09f44af695b543beaff7abd2c1c">libnet_build_bgp4_header</a> (u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#9f5e3e137a1290437eb54ead063821f8">libnet_build_bgp4_open</a> (u_int8_t version, u_int16_t src_as, u_int16_t hold_time, u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#213d5a264ea39a17fc0fc9edb3aac30c">libnet_build_bgp4_update</a> (u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt, u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len, u_int8_t *reachability_info, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#1ba1e13d1fc8cc089ddd7931a6890d2b">libnet_build_bgp4_notification</a> (u_int8_t err_code, u_int8_t err_subcode, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#d20d81e5ce0cd581ff374242fb30a089">libnet_build_sebek</a> (u_int32_t magic, u_int16_t version, u_int16_t type, u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#69bf76db8b62ec812cb734965c31eb46">libnet_build_hsrp</a> (u_int8_t version, u_int8_t opcode, u_int8_t state, u_int8_t hello_time, u_int8_t hold_time, u_int8_t priority, u_int8_t group, u_int8_t reserved, u_int8_t authdata[HSRP_AUTHDATA_LENGTH], u_int32_t virtual_ip, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#71bc438f807ab7e84d424533e81e1693">libnet_build_link</a> (u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_ptag_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#3e21b6aaf8a1c690b6dca96c410083ee">libnet_autobuild_link</a> (u_int8_t *dst, u_int8_t *oui, u_int16_t type, libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#53375552efe95906e152152fc170cc0d">libnet_write</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#e5143c0ab5dc9e9fa817d865eac428b0">libnet_get_ipaddr4</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">struct libnet_in6_addr </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#3d7de8968c2087df7a22140d7993e267">libnet_get_ipaddr6</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">struct <br> +libnet_ether_addr * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#6531e479687de8d195bd1605422735ca">libnet_get_hwaddr</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#66bfbb546b4a9fd49d446870b3b30bb0">libnet_hex_aton</a> (const char *s, int *len)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#5264b060183d307688780bf862fae37c">libnet_version</a> (void)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#9040018e0c1b2c795066941c0ebfc015">libnet_adv_cull_packet</a> (libnet_t *l, u_int8_t **packet, u_int32_t *packet_s)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#e804d72696e8e050bd0893b1869b3126">libnet_adv_cull_header</a> (libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, u_int32_t *header_s)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#f70276132971083dba940f40b1487434">libnet_adv_write_link</a> (libnet_t *l, u_int8_t *packet, u_int32_t packet_s)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#fa26941a0155d45914003642c6976ff4">libnet_adv_write_raw_ipv4</a> (libnet_t *l, u_int8_t *packet, u_int32_t packet_s)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#b73eb15623b02971e5a45d8bf82fb9e2">libnet_adv_free_packet</a> (libnet_t *l, u_int8_t *packet)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#20887ffe940f1d2c5bcae79a188176c6">libnet_cq_add</a> (libnet_t *l, char *label)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#29f60504a0fe9b7bf6f5a962063118bb">libnet_cq_remove</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#4e972664a0d839eab039f8fb2379987a">libnet_cq_remove_by_label</a> (char *label)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#bb1341d217de4d9c39ec484951e518b0">libnet_cq_getlabel</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#0cd216f0e5563ee06043a8ebfa16fe57">libnet_cq_find_by_label</a> (char *label)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#565d99e292980d5033bef2d186596217">libnet_cq_destroy</a> (void)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#7e98a045ac6e29ca421507d9a200b5aa">libnet_cq_head</a> (void)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#ab1eb1e3ae64cde579a5a6035d5406c8">libnet_cq_last</a> (void)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">libnet_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#d312f3182e3e5367db87fc6bab32604d">libnet_cq_next</a> (void)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#d2d4679155425c02822559bcb0caa275">libnet_cq_size</a> (void)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">u_int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#4846c3ce22db19195b235ad11d7c60ce">libnet_cq_end_loop</a> (void)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#3aa6623246e13310dc6f9f9834e7313b">libnet_diag_dump_context</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#9825c6c69efd6ef24545d59177a333e6">libnet_diag_dump_pblock</a> (libnet_t *l)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#053bcb30c956b858db88b9a551e9360b">libnet_diag_dump_pblock_type</a> (u_int8_t type)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-functions_8h.html#862af1289e6eb7a930e18bf1f3008cd4">libnet_diag_dump_hex</a> (u_int8_t *packet, u_int32_t len, int swap, FILE *stream)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c6291524f1b552189f7b9e4846b281b7"></a><!-- doxytag: member="libnet-functions.h::libnet_write_raw_ipv4" ref="c6291524f1b552189f7b9e4846b281b7" args="(libnet_t *l, u_int8_t *packet, u_int32_t size)" --> +int </td><td class="memItemRight" valign="bottom"><b>libnet_write_raw_ipv4</b> (libnet_t *l, u_int8_t *packet, u_int32_t size)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="87029099f6020c294b3cf068fc93aa83"></a><!-- doxytag: member="libnet-functions.h::libnet_write_raw_ipv6" ref="87029099f6020c294b3cf068fc93aa83" args="(libnet_t *l, u_int8_t *packet, u_int32_t size)" --> +int </td><td class="memItemRight" valign="bottom"><b>libnet_write_raw_ipv6</b> (libnet_t *l, u_int8_t *packet, u_int32_t size)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a57648d63d646ac12a11664bd2299f46"></a><!-- doxytag: member="libnet-functions.h::libnet_write_link" ref="a57648d63d646ac12a11664bd2299f46" args="(libnet_t *l, u_int8_t *packet, u_int32_t size)" --> +int </td><td class="memItemRight" valign="bottom"><b>libnet_write_link</b> (libnet_t *l, u_int8_t *packet, u_int32_t size)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9c939bfce1e95e6c4000543e4747bd25"></a><!-- doxytag: member="libnet-functions.h::libnet_open_raw4" ref="9c939bfce1e95e6c4000543e4747bd25" 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" nowrap align="right" valign="top"><a class="anchor" name="637b6c3d06ba0c7bb81641f95d9b9817"></a><!-- doxytag: member="libnet-functions.h::libnet_close_raw4" ref="637b6c3d06ba0c7bb81641f95d9b9817" 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" nowrap align="right" valign="top"><a class="anchor" name="cfa541f84cd8b66fbfe88684920621dc"></a><!-- doxytag: member="libnet-functions.h::libnet_open_raw6" ref="cfa541f84cd8b66fbfe88684920621dc" 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" nowrap align="right" valign="top"><a class="anchor" name="c26f71561c5a3069cb17681d02de15d2"></a><!-- doxytag: member="libnet-functions.h::libnet_close_raw6" ref="c26f71561c5a3069cb17681d02de15d2" 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" nowrap align="right" valign="top"><a class="anchor" name="848cce024af46ad0b283ae962379ee5c"></a><!-- doxytag: member="libnet-functions.h::libnet_select_device" ref="848cce024af46ad0b283ae962379ee5c" 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" nowrap align="right" valign="top"><a class="anchor" name="d924dd4bcaaa9d9f1638232d69ab1b3c"></a><!-- doxytag: member="libnet-functions.h::libnet_open_link" ref="d924dd4bcaaa9d9f1638232d69ab1b3c" 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" nowrap align="right" valign="top"><a class="anchor" name="14ba6b1f8e79d6c1e8d0d398aa2300a4"></a><!-- doxytag: member="libnet-functions.h::libnet_close_link" ref="14ba6b1f8e79d6c1e8d0d398aa2300a4" 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" nowrap align="right" valign="top"><a class="anchor" name="6b12d8cbea884d95f2412d575e621111"></a><!-- doxytag: member="libnet-functions.h::libnet_do_checksum" ref="6b12d8cbea884d95f2412d575e621111" args="(libnet_t *l, u_int8_t *packet, int protocol, int len)" --> +int </td><td class="memItemRight" valign="bottom"><b>libnet_do_checksum</b> (libnet_t *l, u_int8_t *packet, int protocol, int len)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b81e3002181cf2e8a51a671309b3d6d5"></a><!-- doxytag: member="libnet-functions.h::libnet_compute_crc" ref="b81e3002181cf2e8a51a671309b3d6d5" args="(u_int8_t *buf, u_int32_t len)" --> +u_int32_t </td><td class="memItemRight" valign="bottom"><b>libnet_compute_crc</b> (u_int8_t *buf, u_int32_t len)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ad68626b3bc0b50f65483b4619e5da8f"></a><!-- doxytag: member="libnet-functions.h::libnet_ip_check" ref="ad68626b3bc0b50f65483b4619e5da8f" args="(u_int16_t *addr, int len)" --> +u_int16_t </td><td class="memItemRight" valign="bottom"><b>libnet_ip_check</b> (u_int16_t *addr, int len)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2502a9891ac25d3c402cced8c5f0eedf"></a><!-- doxytag: member="libnet-functions.h::libnet_in_cksum" ref="2502a9891ac25d3c402cced8c5f0eedf" args="(u_int16_t *addr, int len)" --> +int </td><td class="memItemRight" valign="bottom"><b>libnet_in_cksum</b> (u_int16_t *addr, int len)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="054e1550e1d623fba97c726ec64859e3"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_probe" ref="054e1550e1d623fba97c726ec64859e3" args="(libnet_t *l, libnet_ptag_t ptag, u_int32_t n, u_int8_t type)" --> +libnet_pblock_t * </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_probe</b> (libnet_t *l, libnet_ptag_t ptag, u_int32_t n, u_int8_t type)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9d1e73c3c484d6d551a969adbbab930f"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_new" ref="9d1e73c3c484d6d551a969adbbab930f" args="(libnet_t *l, u_int32_t size)" --> +libnet_pblock_t * </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_new</b> (libnet_t *l, u_int32_t size)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d74cffce51462163ec68af50573148a8"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_swap" ref="d74cffce51462163ec68af50573148a8" 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" nowrap align="right" valign="top"><a class="anchor" name="0d9f18e13741c16a7b98fa5d8652995d"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_insert_before" ref="0d9f18e13741c16a7b98fa5d8652995d" 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" nowrap align="right" valign="top"><a class="anchor" name="f6cfc6d31463e8067908ea5dac698de8"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_delete" ref="f6cfc6d31463e8067908ea5dac698de8" 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" nowrap align="right" valign="top"><a class="anchor" name="7fcaeb7aff418b7bff40c215c14aea00"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_update" ref="7fcaeb7aff418b7bff40c215c14aea00" args="(libnet_t *l, libnet_pblock_t *p, u_int32_t h, u_int8_t type)" --> +libnet_ptag_t </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_update</b> (libnet_t *l, libnet_pblock_t *p, u_int32_t h, u_int8_t type)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b8e66057916f11f48370be045ec95298"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_record_ip_offset" ref="b8e66057916f11f48370be045ec95298" args="(libnet_t *l, libnet_pblock_t *p)" --> +void </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_record_ip_offset</b> (libnet_t *l, libnet_pblock_t *p)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6bcc33ff1096bb349c8ffb70953acded"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_find" ref="6bcc33ff1096bb349c8ffb70953acded" 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" nowrap align="right" valign="top"><a class="anchor" name="74401cb87d63f054d17c902b1f93f000"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_append" ref="74401cb87d63f054d17c902b1f93f000" args="(libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, u_int32_t len)" --> +int </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_append</b> (libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, u_int32_t len)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a6f13ca22a18895085a1d338f2a302b4"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_setflags" ref="a6f13ca22a18895085a1d338f2a302b4" args="(libnet_pblock_t *p, u_int8_t flags)" --> +void </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_setflags</b> (libnet_pblock_t *p, u_int8_t flags)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="90dfb2aae96e704a6960427737a749de"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_p2p" ref="90dfb2aae96e704a6960427737a749de" args="(u_int8_t type)" --> +int </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_p2p</b> (u_int8_t type)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="663b7e70c92a388ceac0c1bb16441182"></a><!-- doxytag: member="libnet-functions.h::libnet_pblock_coalesce" ref="663b7e70c92a388ceac0c1bb16441182" args="(libnet_t *l, u_int8_t **packet, u_int32_t *size)" --> +int </td><td class="memItemRight" valign="bottom"><b>libnet_pblock_coalesce</b> (libnet_t *l, u_int8_t **packet, u_int32_t *size)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d71dbbd506317e90548aa4600b5d62c4"></a><!-- doxytag: member="libnet-functions.h::libnet_check_iface" ref="d71dbbd506317e90548aa4600b5d62c4" 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"><br><h2>Variables</h2></td></tr> +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1dc04717e621f421d7edc848183f8549"></a><!-- doxytag: member="libnet-functions.h::in6addr_error" ref="1dc04717e621f421d7edc848183f8549" args="" --> +struct libnet_in6_addr </td><td class="memItemRight" valign="bottom"><b>in6addr_error</b></td></tr> + +</table> +<hr><a name="_details"></a><h2>Detailed Description</h2> +libnet exported function prototypes +<p> +<hr><h2>Function Documentation</h2> +<a class="anchor" name="65cea3a63aac7a17f681ab15fcfd2947"></a><!-- doxytag: member="libnet-functions.h::libnet_addr2name4" ref="65cea3a63aac7a17f681ab15fcfd2947" args="(u_int32_t in, u_int8_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">u_int32_t </td> + <td class="paramname"> <em>in</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>use_name</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>in</em> </td><td>network byte ordered IPv4 address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>use_name</em> </td><td>LIBNET_RESOLVE or LIBNET_DONT_RESOLVE </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>a pointer to presentation format string </dd></dl> + +</div> +</div><p> +<a class="anchor" name="221ab1d86e36a0b1411eebdbea0cd012"></a><!-- doxytag: member="libnet-functions.h::libnet_addr2name6_r" ref="221ab1d86e36a0b1411eebdbea0cd012" args="(struct libnet_in6_addr addr, u_int8_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">u_int8_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Should document this baby right here. +</div> +</div><p> +<a class="anchor" name="e804d72696e8e050bd0893b1869b3126"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_cull_header" ref="e804d72696e8e050bd0893b1869b3126" args="(libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, u_int32_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">u_int8_t ** </td> + <td class="paramname"> <em>header</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t * </td> + <td class="paramname"> <em>header_s</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>the ptag referencing the header to pull </td></tr> + <tr><td valign="top"></td><td valign="top"><em>header</em> </td><td>will contain the header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>header_s</em> </td><td>will contain the header size </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="9040018e0c1b2c795066941c0ebfc015"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_cull_packet" ref="9040018e0c1b2c795066941c0ebfc015" args="(libnet_t *l, u_int8_t **packet, u_int32_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">u_int8_t ** </td> + <td class="paramname"> <em>packet</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t * </td> + <td class="paramname"> <em>packet_s</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#b73eb15623b02971e5a45d8bf82fb9e2">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#36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>packet</em> </td><td>will contain the wire-ready packet </td></tr> + <tr><td valign="top"></td><td valign="top"><em>packet_s</em> </td><td>will contain the packet size </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="b73eb15623b02971e5a45d8bf82fb9e2"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_free_packet" ref="b73eb15623b02971e5a45d8bf82fb9e2" args="(libnet_t *l, u_int8_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">u_int8_t * </td> + <td class="paramname"> <em>packet</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Advanced Interface] Frees the memory allocated when <a class="el" href="libnet-functions_8h.html#9040018e0c1b2c795066941c0ebfc015">libnet_adv_cull_packet()</a> is called. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>packet</em> </td><td>a pointer to the packet to free </td></tr> + </table> +</dl> + +</div> +</div><p> +<a class="anchor" name="f70276132971083dba940f40b1487434"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_write_link" ref="f70276132971083dba940f40b1487434" args="(libnet_t *l, u_int8_t *packet, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>packet</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>packet_s</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#9040018e0c1b2c795066941c0ebfc015">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#36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>packet</em> </td><td>a pointer to the packet to inject </td></tr> + <tr><td valign="top"></td><td valign="top"><em>packet_s</em> </td><td>the size of the packet </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the number of bytes written, or -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="fa26941a0155d45914003642c6976ff4"></a><!-- doxytag: member="libnet-functions.h::libnet_adv_write_raw_ipv4" ref="fa26941a0155d45914003642c6976ff4" args="(libnet_t *l, u_int8_t *packet, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>packet</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>packet_s</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#9040018e0c1b2c795066941c0ebfc015">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#36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>packet</em> </td><td>a pointer to the packet to inject </td></tr> + <tr><td valign="top"></td><td valign="top"><em>packet_s</em> </td><td>the size of the packet </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the number of bytes written, or -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="c2ac4909b3657c4ac34c80dbc9f91abe"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_arp" ref="c2ac4909b3657c4ac34c80dbc9f91abe" args="(u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_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">u_int16_t </td> + <td class="paramname"> <em>op</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>sha</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>spa</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>tha</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>op</em> </td><td>ARP operation type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sha</em> </td><td>sender's hardware address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>spa</em> </td><td>sender's protocol address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>tha</em> </td><td>target hardware address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>tpa</em> </td><td>targer protocol address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="0ab98b1c67ac61b39b646ecfd93d58e3"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_ethernet" ref="0ab98b1c67ac61b39b646ecfd93d58e3" args="(u_int8_t *dst, u_int16_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">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination ethernet address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>upper layer protocol type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="2a0f9f03a1c43253638ecb07dfc2bb62"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_fddi" ref="2a0f9f03a1c43253638ecb07dfc2bb62" args="(u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_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">u_int8_t </td> + <td class="paramname"> <em>fc</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>dsap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ssap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>cf</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>oui</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Autobuilds a Fiber Distributed Data Interface (FDDI) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>fc</em> </td><td>class format and priority </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination fddi address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dsap</em> </td><td>destination service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ssap</em> </td><td>source service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>cf</em> </td><td>cf </td></tr> + <tr><td valign="top"></td><td valign="top"><em>oui</em> </td><td>IEEE organizational code </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>upper layer protocol </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="bcef75c186b4db27f13a29c38b8f40ec"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_ipv4" ref="bcef75c186b4db27f13a29c38b8f40ec" args="(u_int16_t len, u_int8_t prot, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>prot</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#ace7ef7ee9dab7064eafc703bbd51c02">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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>total length of the IP packet including all subsequent data </td></tr> + <tr><td valign="top"></td><td valign="top"><em>prot</em> </td><td>upper layer protocol </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination IPv4 address (little endian) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="f21186614be986ab83740275bb984426"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_ipv6" ref="f21186614be986ab83740275bb984426" args="(u_int16_t len, u_int8_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">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +This function is not yet implement and is a NOOP. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>nh</em> </td><td>next header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination IPv6 address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="3e21b6aaf8a1c690b6dca96c410083ee"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_link" ref="3e21b6aaf8a1c690b6dca96c410083ee" args="(u_int8_t *dst, u_int8_t *oui, u_int16_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">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>oui</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>the destination MAC address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>oui</em> </td><td>Organizationally Unique Identifier (unused for Ethernet) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>the upper layer protocol type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="e2962f923beabedfe761dcd97cf41e87"></a><!-- doxytag: member="libnet-functions.h::libnet_autobuild_token_ring" ref="e2962f923beabedfe761dcd97cf41e87" args="(u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_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">u_int8_t </td> + <td class="paramname"> <em>ac</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>fc</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>dsap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ssap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>cf</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>oui</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Auto-builds a token ring header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>ac</em> </td><td>access control </td></tr> + <tr><td valign="top"></td><td valign="top"><em>fc</em> </td><td>frame control </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dsap</em> </td><td>destination service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ssap</em> </td><td>source service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>cf</em> </td><td>control field </td></tr> + <tr><td valign="top"></td><td valign="top"><em>oui</em> </td><td>Organizationally Unique Identifier </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>upper layer protocol type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="60a223766dc718c544ec500b0829d39e"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_1q" ref="60a223766dc718c544ec500b0829d39e" args="(u_int8_t *dst, u_int8_t *src, u_int16_t tpi, u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" --> +<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">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>src</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>tpi</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>priority</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>cfi</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>vlan_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len_proto</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<h2><a class="anchor" name="PBF"> +Packet Builder Functions</a></h2> +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#a18676bbed2910988a65ace745226301">libnet_build_ntp()</a> 2. <a class="el" href="libnet-functions_8h.html#6d3f91d01237eef2f82ffd322ecbc792">libnet_build_udp()</a> 3. <a class="el" href="libnet-functions_8h.html#ace7ef7ee9dab7064eafc703bbd51c02">libnet_build_ipv4()</a> 4. <a class="el" href="libnet-functions_8h.html#b8a60ba5d3c669a1439ace4f91ee52e0">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).<h3><a class="anchor" name="TPI"> +The Payload Interface</a></h3> +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:<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 u_int8_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.<h3><a class="anchor" name="PT"> +Protocol Tags and Packet Builder Return Values</a></h3> +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#36c0b24a4926a8f5d9d392836e915f2e">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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>pointer to a six byte source ethernet address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>pointer to a six byte destination ethernet address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>tpi</em> </td><td>tag protocol identifier </td></tr> + <tr><td valign="top"></td><td valign="top"><em>priority</em> </td><td>priority </td></tr> + <tr><td valign="top"></td><td valign="top"><em>cfi</em> </td><td>canonical format indicator </td></tr> + <tr><td valign="top"></td><td valign="top"><em>vlan_id</em> </td><td>vlan identifier </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len_proto</em> </td><td>length (802.3) protocol (Ethernet II) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="2e2ba82d84c8af087e53c60cb2cf0f16"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_1x" ref="2e2ba82d84c8af087e53c60cb2cf0f16" args="(u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>eap_ver</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>eap_type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>length</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an IEEE 802.1x extended authentication protocol header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>eap_ver</em> </td><td>the EAP version </td></tr> + <tr><td valign="top"></td><td valign="top"><em>eap_type</em> </td><td>the EAP type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>length</em> </td><td>frame length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="df241a95102fc267d0a20a1a73f0c5f1"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_2" ref="df241a95102fc267d0a20a1a73f0c5f1" args="(u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>dsap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ssap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>control</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an IEEE 802.2 LLC header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dsap</em> </td><td>destination service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ssap</em> </td><td>source service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>control</em> </td><td>control field </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="997b6c996b95fbcb09f87a0caf12ffa0"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_2snap" ref="997b6c996b95fbcb09f87a0caf12ffa0" args="(u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>dsap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ssap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>control</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>oui</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an IEEE 802.2 LLC SNAP header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dsap</em> </td><td>destination service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ssap</em> </td><td>source service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>control</em> </td><td>control field </td></tr> + <tr><td valign="top"></td><td valign="top"><em>oui</em> </td><td>Organizationally Unique Identifier </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>upper layer protocol </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="55367f2634cf6409bbda8bbf5b834877"></a><!-- doxytag: member="libnet-functions.h::libnet_build_802_3" ref="55367f2634cf6409bbda8bbf5b834877" args="(u_int8_t *dst, u_int8_t *src, u_int16_t len, u_int8_t *payload, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>src</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination ethernet address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>source ethernet address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>frame length sans header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="65c81208185c68937ef97c0203d3d924"></a><!-- doxytag: member="libnet-functions.h::libnet_build_arp" ref="65c81208185c68937ef97c0203d3d924" args="(u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>hrd</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>pro</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>hln</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>pln</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>op</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>sha</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>spa</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>tha</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>tpa</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>hrd</em> </td><td>hardware address format </td></tr> + <tr><td valign="top"></td><td valign="top"><em>pro</em> </td><td>protocol address format </td></tr> + <tr><td valign="top"></td><td valign="top"><em>hln</em> </td><td>hardware address length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>pln</em> </td><td>protocol address length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>op</em> </td><td>ARP operation type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sha</em> </td><td>sender's hardware address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>spa</em> </td><td>sender's protocol address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>tha</em> </td><td>target hardware address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>tpa</em> </td><td>targer protocol address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="5d7fd09f44af695b543beaff7abd2c1c"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bgp4_header" ref="5d7fd09f44af695b543beaff7abd2c1c" args="(u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>marker</em>[LIBNET_BGP4_MARKER_SIZE], </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>marker</em> </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 valign="top"></td><td valign="top"><em>len</em> </td><td>total length of the BGP message, including the header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="1ba1e13d1fc8cc089ddd7931a6890d2b"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bgp4_notification" ref="1ba1e13d1fc8cc089ddd7931a6890d2b" args="(u_int8_t err_code, u_int8_t err_subcode, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>err_code</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>err_subcode</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>err_code</em> </td><td>type of notification </td></tr> + <tr><td valign="top"></td><td valign="top"><em>err_subcode</em> </td><td>more specific information about the reported error. </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="9f5e3e137a1290437eb54ead063821f8"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bgp4_open" ref="9f5e3e137a1290437eb54ead063821f8" args="(u_int8_t version, u_int16_t src_as, u_int16_t hold_time, u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>src_as</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>hold_time</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>bgp_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>opt_len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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). <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>protocol version (should be set to 4) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src_as</em> </td><td>Autonomous System of the sender </td></tr> + <tr><td valign="top"></td><td valign="top"><em>hold_time</em> </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 valign="top"></td><td valign="top"><em>bgp_id</em> </td><td>BGP identifier of the sender </td></tr> + <tr><td valign="top"></td><td valign="top"><em>opt_len</em> </td><td>total length of the optional parameters field in bytes </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="213d5a264ea39a17fc0fc9edb3aac30c"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bgp4_update" ref="213d5a264ea39a17fc0fc9edb3aac30c" args="(u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt, u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len, u_int8_t *reachability_info, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>unfeasible_rt_len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>withdrawn_rt</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>total_path_attr_len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>path_attributes</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>info_len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>reachability_info</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>unfeasible_rt_len</em> </td><td>indicates the length of the (next) "withdrawn routes" field in bytes </td></tr> + <tr><td valign="top"></td><td valign="top"><em>withdrawn_rt</em> </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 valign="top"></td><td valign="top"><em>total_path_attr_len</em> </td><td>indicates the length of the (next) "path attributes" field in bytes </td></tr> + <tr><td valign="top"></td><td valign="top"><em>path_attributes</em> </td><td>each attribute is a 3-tuple <type (2 bytes), length, value> </td></tr> + <tr><td valign="top"></td><td valign="top"><em>info_len</em> </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 valign="top"></td><td valign="top"><em>reachability_info</em> </td><td>2-tuples <length (1 byte), prefix (variable)>. </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="37164c33698bd0c59cd51393a1fdfae6"></a><!-- doxytag: member="libnet-functions.h::libnet_build_bootpv4" ref="37164c33698bd0c59cd51393a1fdfae6" args="(u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>opcode</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>htype</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>hlen</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>hopcount</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>xid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>secs</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>flags</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>cip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>yip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>sip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>gip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>chaddr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>sname</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>file</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>opcode</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>htype</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>hlen</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>hopcount</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>xid</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>secs</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>flags</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>cip</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>yip</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>sip</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>gip</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>chaddr</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>sname</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>file</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="e16743df24525d5ab9b4c1ef13e87423"></a><!-- doxytag: member="libnet-functions.h::libnet_build_cdp" ref="e16743df24525d5ab9b4c1ef13e87423" args="(u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ttl</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>value</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#cb56eccdd9d924cd3a81affdbef4cf30">libnet_build_data()</a> to construct them. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>CDP version </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ttl</em> </td><td>time to live (time information should be cached by recipient) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of data contained in value </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>length of value arugment </td></tr> + <tr><td valign="top"></td><td valign="top"><em>value</em> </td><td>the CDP information string </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="cb56eccdd9d924cd3a81affdbef4cf30"></a><!-- doxytag: member="libnet-functions.h::libnet_build_data" ref="cb56eccdd9d924cd3a81affdbef4cf30" args="(u_int8_t *payload, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="20d397bac4d614e395878f239d26d4dc"></a><!-- doxytag: member="libnet-functions.h::libnet_build_dhcpv4" ref="20d397bac4d614e395878f239d26d4dc" args="(u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>opcode</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>htype</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>hlen</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>hopcount</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>xid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>secs</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>flags</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>cip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>yip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>sip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>gip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>chaddr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>sname</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>file</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>opcode</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>htype</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>hlen</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>hopcount</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>xid</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>secs</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>flags</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>cip</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>yip</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>sip</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>gip</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>chaddr</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>sname</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>file</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="98bc91a6c39910ee6069d789d8dcd3e6"></a><!-- doxytag: member="libnet-functions.h::libnet_build_dnsv4" ref="98bc91a6c39910ee6069d789d8dcd3e6" args="(u_int16_t h_len, u_int16_t id, u_int16_t flags, u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, u_int16_t num_addi_rr, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>h_len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>flags</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>num_q</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>num_anws_rr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>num_auth_rr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>num_addi_rr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>h_len</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>DNS packet id </td></tr> + <tr><td valign="top"></td><td valign="top"><em>flags</em> </td><td>control flags </td></tr> + <tr><td valign="top"></td><td valign="top"><em>num_q</em> </td><td>number of questions </td></tr> + <tr><td valign="top"></td><td valign="top"><em>num_anws_rr</em> </td><td>number of answer resource records </td></tr> + <tr><td valign="top"></td><td valign="top"><em>num_auth_rr</em> </td><td>number of authority resource records </td></tr> + <tr><td valign="top"></td><td valign="top"><em>num_addi_rr</em> </td><td>number of additional resource records </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="e8c54127e49779805cedf46506f564d4"></a><!-- doxytag: member="libnet-functions.h::libnet_build_egre" ref="e8c54127e49779805cedf46506f564d4" args="(u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>fv</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>offset</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>key</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>seq</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>fv</em> </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 valign="top"></td><td valign="top"><em>type</em> </td><td>which protocol is encapsulated (PPP, IP, ...) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill). </td></tr> + <tr><td valign="top"></td><td valign="top"><em>offset</em> </td><td>byte offset from the start of the routing field to the first byte of the SRE </td></tr> + <tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>inserted by the encapsulator to authenticate the source </td></tr> + <tr><td valign="top"></td><td valign="top"><em>seq</em> </td><td>sequence number used by the receiver to sort the packets </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>size of the GRE packet </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="b8a60ba5d3c669a1439ace4f91ee52e0"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ethernet" ref="b8a60ba5d3c669a1439ace4f91ee52e0" args="(u_int8_t *dst, u_int8_t *src, u_int16_t type, u_int8_t *payload, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>src</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination ethernet address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>source ethernet address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>upper layer protocol type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="2fb726d9841fa180bd79ab0a6362f533"></a><!-- doxytag: member="libnet-functions.h::libnet_build_fddi" ref="2fb726d9841fa180bd79ab0a6362f533" args="(u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>fc</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>src</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>dsap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ssap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>cf</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>oui</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds a Fiber Distributed Data Interface (FDDI) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>fc</em> </td><td>class format and priority </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination fddi address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>source fddi address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dsap</em> </td><td>destination service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ssap</em> </td><td>source service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>cf</em> </td><td>cf </td></tr> + <tr><td valign="top"></td><td valign="top"><em>oui</em> </td><td>3 byte IEEE organizational code </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>upper layer protocol </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="fff121ac7bc157e3df0eb1bd624263c1"></a><!-- doxytag: member="libnet-functions.h::libnet_build_gre" ref="fff121ac7bc157e3df0eb1bd624263c1" args="(u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>fv</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>offset</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>key</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>seq</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>fv</em> </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 valign="top"></td><td valign="top"><em>type</em> </td><td>which protocol is encapsulated (PPP, IP, ...) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill). </td></tr> + <tr><td valign="top"></td><td valign="top"><em>offset</em> </td><td>byte offset from the start of the routing field to the first byte of the SRE </td></tr> + <tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>inserted by the encapsulator to authenticate the source </td></tr> + <tr><td valign="top"></td><td valign="top"><em>seq</em> </td><td>sequence number used by the receiver to sort the packets </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>size of the GRE packet </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="578594ad820ae9d82fe3f9ea470f0b27"></a><!-- doxytag: member="libnet-functions.h::libnet_build_gre_last_sre" ref="578594ad820ae9d82fe3f9ea470f0b27" 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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="7cca16e4e1b5ca96a1b0a35a2b766710"></a><!-- doxytag: member="libnet-functions.h::libnet_build_gre_sre" ref="7cca16e4e1b5ca96a1b0a35a2b766710" args="(u_int16_t af, u_int8_t offset, u_int8_t length, u_int8_t *routing, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>af</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>offset</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>length</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>routing</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>af</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>offset</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>length</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>routing</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="69bf76db8b62ec812cb734965c31eb46"></a><!-- doxytag: member="libnet-functions.h::libnet_build_hsrp" ref="69bf76db8b62ec812cb734965c31eb46" args="(u_int8_t version, u_int8_t opcode, u_int8_t state, u_int8_t hello_time, u_int8_t hold_time, u_int8_t priority, u_int8_t group, u_int8_t reserved, u_int8_t authdata[HSRP_AUTHDATA_LENGTH], u_int32_t virtual_ip, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>opcode</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>state</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>hello_time</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>hold_time</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>priority</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>group</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>reserved</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>authdata</em>[HSRP_AUTHDATA_LENGTH], </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>virtual_ip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds a HSRP header. HSRP is a Cisco propietary protocol defined in RFC 2281 <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>version of the HSRP messages </td></tr> + <tr><td valign="top"></td><td valign="top"><em>opcode</em> </td><td>type of message </td></tr> + <tr><td valign="top"></td><td valign="top"><em>state</em> </td><td>current state of the router </td></tr> + <tr><td valign="top"></td><td valign="top"><em>hello_time</em> </td><td>period in seconds between hello messages </td></tr> + <tr><td valign="top"></td><td valign="top"><em>hold_time</em> </td><td>seconds that the current hello message is valid </td></tr> + <tr><td valign="top"></td><td valign="top"><em>priority</em> </td><td>priority for the election proccess </td></tr> + <tr><td valign="top"></td><td valign="top"><em>group</em> </td><td>standby group </td></tr> + <tr><td valign="top"></td><td valign="top"><em>reserved</em> </td><td>reserved field </td></tr> + <tr><td valign="top"></td><td valign="top"><em>authdata</em> </td><td>password </td></tr> + <tr><td valign="top"></td><td valign="top"><em>virtual_ip</em> </td><td>virtual ip address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="b80f86d2cbf32126fe5952cc77d7c512"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_echo" ref="b80f86d2cbf32126fe5952cc77d7c512" args="(u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>code</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>seq</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>code</em> </td><td>code of ICMP packet (should be 0) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>identification number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>seq</em> </td><td>packet sequence number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="58605cfff0090e3cbf26abd5b7194c16"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_mask" ref="58605cfff0090e3cbf26abd5b7194c16" args="(u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>code</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>seq</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>mask</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>code</em> </td><td>code of ICMP packet (should be 0) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>identification number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>seq</em> </td><td>packet sequence number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>mask</em> </td><td>subnet mask </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="973112121198b7151d21ab7285f6ae34"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_redirect" ref="973112121198b7151d21ab7285f6ae34" args="(u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t gateway, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>code</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>gateway</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#ace7ef7ee9dab7064eafc703bbd51c02">libnet_build_ipv4()</a>. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of ICMP packet (should be ICMP_REDIRECT) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>code</em> </td><td>code of ICMP packet (should be one of the four redirect codes) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>gateway</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="87fd21c0e964dc0e2f8866178240db39"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_timeexceed" ref="87fd21c0e964dc0e2f8866178240db39" args="(u_int8_t type, u_int8_t code, u_int16_t sum, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>code</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#ace7ef7ee9dab7064eafc703bbd51c02">libnet_build_ipv4()</a>. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of ICMP packet (should be ICMP_TIMXCEED) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>code</em> </td><td>code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="512a61266327928df97b010bc3f821b6"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_timestamp" ref="512a61266327928df97b010bc3f821b6" args="(u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>code</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>seq</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">n_time </td> + <td class="paramname"> <em>otime</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">n_time </td> + <td class="paramname"> <em>rtime</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">n_time </td> + <td class="paramname"> <em>ttime</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>code</em> </td><td>code of ICMP packet (should be 0) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>identification number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>seq</em> </td><td>sequence number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>otime</em> </td><td>originate timestamp </td></tr> + <tr><td valign="top"></td><td valign="top"><em>rtime</em> </td><td>receive timestamp </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ttime</em> </td><td>transmit timestamp </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="d8e682f057f00dc53fe82960d7893b3f"></a><!-- doxytag: member="libnet-functions.h::libnet_build_icmpv4_unreach" ref="d8e682f057f00dc53fe82960d7893b3f" args="(u_int8_t type, u_int8_t code, u_int16_t sum, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>code</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#ace7ef7ee9dab7064eafc703bbd51c02">libnet_build_ipv4()</a>. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of ICMP packet (should be ICMP_UNREACH) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>code</em> </td><td>code of ICMP packet (should be one of the 16 unreachable codes) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="d614cefecf7ffbabdf241e707c474575"></a><!-- doxytag: member="libnet-functions.h::libnet_build_igmp" ref="d614cefecf7ffbabdf241e707c474575" args="(u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>code</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>ip</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>packet type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>code</em> </td><td>packet code (should be 0) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ip</em> </td><td>IPv4 address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="ad130b6104956524af16fcb18fa759e9"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipsec_ah" ref="ad130b6104956524af16fcb18fa759e9" args="(u_int8_t nh, u_int8_t len, u_int16_t res, u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>nh</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>res</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>spi</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>seq</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>auth</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an Internet Protocol Security Authentication header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>nh</em> </td><td>next header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>payload length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>res</em> </td><td>reserved </td></tr> + <tr><td valign="top"></td><td valign="top"><em>spi</em> </td><td>security parameter index </td></tr> + <tr><td valign="top"></td><td valign="top"><em>seq</em> </td><td>sequence number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>auth</em> </td><td>authentication data </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="47d4aa351486618f993ed6e2652681b1"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipsec_esp_ftr" ref="47d4aa351486618f993ed6e2652681b1" args="(u_int8_t len, u_int8_t nh, int8_t *auth, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_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">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an Internet Protocol Security Encapsulating Security Payload footer. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>padding length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>nh</em> </td><td>next header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>auth</em> </td><td>authentication data </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="7080bea55af439f0e74031197bc0924c"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipsec_esp_hdr" ref="7080bea55af439f0e74031197bc0924c" args="(u_int32_t spi, u_int32_t seq, u_int32_t iv, u_int8_t *payload, u_int32_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">u_int32_t </td> + <td class="paramname"> <em>spi</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>seq</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>iv</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an Internet Protocol Security Encapsulating Security Payload header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>spi</em> </td><td>security parameter index </td></tr> + <tr><td valign="top"></td><td valign="top"><em>seq</em> </td><td>ESP sequence number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>iv</em> </td><td>initialization vector </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="ace7ef7ee9dab7064eafc703bbd51c02"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv4" ref="ace7ef7ee9dab7064eafc703bbd51c02" args="(u_int16_t ip_len, u_int8_t tos, u_int16_t id, u_int16_t frag, u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>ip_len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>tos</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>frag</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ttl</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>prot</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>src</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds a version 4 RFC 791 Internet Protocol (IP) header.<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>ip_len</em> </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 valign="top"></td><td valign="top"><em>tos</em> </td><td>type of service bits </td></tr> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>IP identification number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>frag</em> </td><td>fragmentation bits and offset </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ttl</em> </td><td>time to live in the network </td></tr> + <tr><td valign="top"></td><td valign="top"><em>prot</em> </td><td>upper layer protocol </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>source IPv4 address (little endian) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination IPv4 address (little endian) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="f5a9b52bc56903e3c71b3ae155ffc1df"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv4_options" ref="f5a9b52bc56903e3c71b3ae155ffc1df" args="(u_int8_t *options, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>options</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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> +When building a chain, the options must be built, then the IPv4 header.<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 compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>options</em> </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 valign="top"></td><td valign="top"><em>options_s</em> </td><td>length of options string </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="844fc0a5b0f5acf57cbe4c9f42a1125c"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6" ref="844fc0a5b0f5acf57cbe4c9f42a1125c" args="(u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>tc</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>fl</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>nh</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_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">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds a version 6 RFC 2460 Internet Protocol (IP) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>tc</em> </td><td>traffic class </td></tr> + <tr><td valign="top"></td><td valign="top"><em>fl</em> </td><td>flow label </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>total length of the IP packet </td></tr> + <tr><td valign="top"></td><td valign="top"><em>nh</em> </td><td>next header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>hl</em> </td><td>hop limit </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>source IPv6 address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination IPv6 address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="a5695b5f8419b440d41bbac0aaa34564"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6_destopts" ref="a5695b5f8419b440d41bbac0aaa34564" args="(u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>nh</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>nh</em> </td><td>next header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>length of the header in 8-byte octets not including the first 8 octets </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>options payload </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="6c65244937ef5bc8e84efa5fe54aaac9"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6_frag" ref="6c65244937ef5bc8e84efa5fe54aaac9" args="(u_int8_t nh, u_int8_t reserved, u_int16_t frag, u_int32_t id, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>nh</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>reserved</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>frag</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>nh</em> </td><td>next header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>reserved</em> </td><td>unused value... OR IS IT! </td></tr> + <tr><td valign="top"></td><td valign="top"><em>frag</em> </td><td>fragmentation bits (ala ipv4) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>packet identification </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="db7b7870cc626d8d67f723de286034a9"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6_hbhopts" ref="db7b7870cc626d8d67f723de286034a9" args="(u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>nh</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>nh</em> </td><td>next header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>length of the header in 8-byte octets not including the first 8 octets </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>options payload </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="ccf52055b316417674bfcb76f85d6227"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ipv6_routing" ref="ccf52055b316417674bfcb76f85d6227" args="(u_int8_t nh, u_int8_t len, u_int8_t rtype, u_int8_t segments, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>nh</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>rtype</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>segments</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>nh</em> </td><td>next header </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>length of the header in 8-byte octets not including the first 8 octets </td></tr> + <tr><td valign="top"></td><td valign="top"><em>rtype</em> </td><td>routing header type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>segments</em> </td><td>number of routing segments that follow </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload of routing information </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="84a2f87c5188f95a73ab04e7bb8eebf3"></a><!-- doxytag: member="libnet-functions.h::libnet_build_isl" ref="84a2f87c5188f95a73ab04e7bb8eebf3" args="(u_int8_t *dhost, u_int8_t type, u_int8_t user, u_int8_t *shost, u_int16_t len, u_int8_t *snap, u_int16_t vid, u_int16_t portindex, u_int16_t reserved, u_int8_t *payload, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>dhost</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>user</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>shost</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>snap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>vid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>portindex</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>reserved</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds a Cisco Inter-Switch Link (ISL) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dhost</em> </td><td>destination address (should be 01:00:0c:00:00) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of frame </td></tr> + <tr><td valign="top"></td><td valign="top"><em>user</em> </td><td>user defined data </td></tr> + <tr><td valign="top"></td><td valign="top"><em>shost</em> </td><td>source mac address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>total length of the encapuslated packet less 18 bytes </td></tr> + <tr><td valign="top"></td><td valign="top"><em>snap</em> </td><td>SNAP information (0xaaaa03 + vendor code) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>vid</em> </td><td>15 bit VLAN ID, 1 bit BPDU or CDP indicator </td></tr> + <tr><td valign="top"></td><td valign="top"><em>portindex</em> </td><td>port index </td></tr> + <tr><td valign="top"></td><td valign="top"><em>reserved</em> </td><td>used for FDDI and token ring </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="71bc438f807ab7e84d424533e81e1693"></a><!-- doxytag: member="libnet-functions.h::libnet_build_link" ref="71bc438f807ab7e84d424533e81e1693" args="(u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>src</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>oui</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>the destination MAC address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>the source MAC address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>oui</em> </td><td>Organizationally Unique Identifier (unused for Ethernet) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>the upper layer protocol type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="2be4c11b7a37ab8ad9d46e1ebf3b53db"></a><!-- doxytag: member="libnet-functions.h::libnet_build_mpls" ref="2be4c11b7a37ab8ad9d46e1ebf3b53db" args="(u_int32_t label, u_int8_t experimental, u_int8_t bos, u_int8_t ttl, u_int8_t *payload, u_int32_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">u_int32_t </td> + <td class="paramname"> <em>label</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>experimental</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>bos</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ttl</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>label</em> </td><td>20-bit label value </td></tr> + <tr><td valign="top"></td><td valign="top"><em>experimental</em> </td><td>3-bit reserved field </td></tr> + <tr><td valign="top"></td><td valign="top"><em>bos</em> </td><td>1-bit bottom of stack identifier </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ttl</em> </td><td>time to live </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="a18676bbed2910988a65ace745226301"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ntp" ref="a18676bbed2910988a65ace745226301" args="(u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>leap_indicator</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>mode</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>stratum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>poll</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>precision</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>delay_int</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>delay_frac</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>dispersion_int</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>dispersion_frac</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>reference_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>ref_ts_int</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>ref_ts_frac</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>orig_ts_int</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>orig_ts_frac</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>rec_ts_int</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>rec_ts_frac</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>xmt_ts_int</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>xmt_ts_frac</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an RFC 958 Network Time Protocol (NTP) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>leap_indicator</em> </td><td>the leap indicator </td></tr> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>NTP protocol version </td></tr> + <tr><td valign="top"></td><td valign="top"><em>mode</em> </td><td>NTP mode </td></tr> + <tr><td valign="top"></td><td valign="top"><em>stratum</em> </td><td>stratum </td></tr> + <tr><td valign="top"></td><td valign="top"><em>poll</em> </td><td>polling interval </td></tr> + <tr><td valign="top"></td><td valign="top"><em>precision</em> </td><td>precision </td></tr> + <tr><td valign="top"></td><td valign="top"><em>delay_int</em> </td><td>delay interval </td></tr> + <tr><td valign="top"></td><td valign="top"><em>delay_frac</em> </td><td>delay fraction </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dispersion_int</em> </td><td>dispersion interval </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dispersion_frac</em> </td><td>dispersion fraction </td></tr> + <tr><td valign="top"></td><td valign="top"><em>reference_id</em> </td><td>reference id </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ref_ts_int</em> </td><td>reference timestamp integer </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ref_ts_frac</em> </td><td>reference timestamp fraction </td></tr> + <tr><td valign="top"></td><td valign="top"><em>orig_ts_int</em> </td><td>original timestamp integer </td></tr> + <tr><td valign="top"></td><td valign="top"><em>orig_ts_frac</em> </td><td>original timestamp fraction </td></tr> + <tr><td valign="top"></td><td valign="top"><em>rec_ts_int</em> </td><td>receiver timestamp integer </td></tr> + <tr><td valign="top"></td><td valign="top"><em>rec_ts_frac</em> </td><td>reciever timestamp fraction </td></tr> + <tr><td valign="top"></td><td valign="top"><em>xmt_ts_int</em> </td><td>transmit timestamp integer </td></tr> + <tr><td valign="top"></td><td valign="top"><em>xmt_ts_frac</em> </td><td>transmit timestamp integer </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="40115f0c696b84e2f4f84c09e72f60dc"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2" ref="40115f0c696b84e2f4f84c09e72f60dc" args="(u_int16_t len, u_int8_t type, u_int32_t rtr_id, u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>rtr_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>area_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>autype</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>rtr_id</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>area_id</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>autype</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="60b59bb26475cd0892299c4888454b3b"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_dbd" ref="60b59bb26475cd0892299c4888454b3b" args="(u_int16_t dgram_len, u_int8_t opts, u_int8_t type, u_int seqnum, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>dgram_len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>opts</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>seqnum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>dgram_len</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>opts</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>seqnum</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="0f0d868bb17ff951305327becaec80e5"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_hello" ref="0f0d868bb17ff951305327becaec80e5" args="(u_int32_t netmask, u_int16_t interval, u_int8_t opts, u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, u_int8_t *payload, u_int32_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">u_int32_t </td> + <td class="paramname"> <em>netmask</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>interval</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>opts</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>priority</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>dead_int</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>des_rtr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>bkup_rtr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>netmask</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>interval</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>opts</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>priority</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>dead_int</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>des_rtr</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>bkup_rtr</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="8884632ef2860b3b292188fcacf54cf8"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa" ref="8884632ef2860b3b292188fcacf54cf8" args="(u_int16_t age, u_int8_t opts, u_int8_t type, u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>age</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>opts</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>lsid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>advrtr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>seqnum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>age</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>opts</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>lsid</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>advrtr</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>seqnum</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="bcecd50e35e742531f59cce0b90b8b79"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa_as" ref="bcecd50e35e742531f59cce0b90b8b79" args="(u_int32_t nmask, u_int metric, u_int32_t fwdaddr, u_int tag, u_int8_t *payload, u_int32_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">u_int32_t </td> + <td class="paramname"> <em>nmask</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>metric</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>fwdaddr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>tag</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>nmask</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>metric</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>fwdaddr</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>tag</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="ae2ddd904b99753f88073c1525e9a08f"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa_net" ref="ae2ddd904b99753f88073c1525e9a08f" args="(u_int32_t nmask, u_int rtrid, u_int8_t *payload, u_int32_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">u_int32_t </td> + <td class="paramname"> <em>nmask</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>rtrid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>nmask</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>rtrid</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="8f27133661d6c10e3c776cfb7e24b8b6"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa_rtr" ref="8f27133661d6c10e3c776cfb7e24b8b6" args="(u_int16_t flags, u_int16_t num, u_int id, u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>flags</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>num</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>data</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>tos</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>metric</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>flags</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>num</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>data</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>tos</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>metric</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="b9d76074203ed1e92683a056b6f7b8ba"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsa_sum" ref="b9d76074203ed1e92683a056b6f7b8ba" args="(u_int32_t nmask, u_int metric, u_int tos, u_int8_t *payload, u_int32_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">u_int32_t </td> + <td class="paramname"> <em>nmask</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>metric</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>tos</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>nmask</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>metric</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>tos</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="bd981b21f34c0efcdbd7123f9c6b1ab4"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsr" ref="bd981b21f34c0efcdbd7123f9c6b1ab4" args="(u_int type, u_int lsid, u_int32_t advrtr, u_int8_t *payload, u_int32_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">u_int </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int </td> + <td class="paramname"> <em>lsid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>advrtr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>lsid</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>advrtr</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="9460b64aba613d6e367a3a6d472ae5e6"></a><!-- doxytag: member="libnet-functions.h::libnet_build_ospfv2_lsu" ref="9460b64aba613d6e367a3a6d472ae5e6" args="(u_int num, u_int8_t *payload, u_int32_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">u_int </td> + <td class="paramname"> <em>num</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>num</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="c9549e65e228cdfa901fca9012f1b52f"></a><!-- doxytag: member="libnet-functions.h::libnet_build_rip" ref="c9549e65e228cdfa901fca9012f1b52f" args="(u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, u_int32_t metric, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>cmd</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>rd</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>af</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>rt</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>addr</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>mask</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>next_hop</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>metric</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds a Routing Information Protocol header (RFCs 1058 and 2453). <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>cmd</em> </td><td>command </td></tr> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>protocol version </td></tr> + <tr><td valign="top"></td><td valign="top"><em>rd</em> </td><td>version one: 0, version two: routing domain </td></tr> + <tr><td valign="top"></td><td valign="top"><em>af</em> </td><td>address family </td></tr> + <tr><td valign="top"></td><td valign="top"><em>rt</em> </td><td>version one: 0, version two: route tag </td></tr> + <tr><td valign="top"></td><td valign="top"><em>addr</em> </td><td>IPv4 address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>mask</em> </td><td>version one: 0, version two: subnet mask </td></tr> + <tr><td valign="top"></td><td valign="top"><em>next_hop</em> </td><td>version one: 0, version two: next hop address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>metric</em> </td><td>routing metric </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="33bdb212c766a869a55560d523deb807"></a><!-- doxytag: member="libnet-functions.h::libnet_build_rpc_call" ref="33bdb212c766a869a55560d523deb807" args="(u_int32_t rm, u_int32_t xid, u_int32_t prog_num, u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata, u_int8_t *payload, u_int32_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">u_int32_t </td> + <td class="paramname"> <em>rm</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>xid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>prog_num</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>prog_vers</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>procedure</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>cflavor</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>clength</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>cdata</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>vflavor</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>vlength</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>vdata</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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). <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>rm</em> </td><td>record marking indicating the position in a stream, 0 otherwise </td></tr> + <tr><td valign="top"></td><td valign="top"><em>xid</em> </td><td>transaction identifier used to link calls and replies </td></tr> + <tr><td valign="top"></td><td valign="top"><em>prog_num</em> </td><td>remote program specification typically between 0 - 1fffffff </td></tr> + <tr><td valign="top"></td><td valign="top"><em>prog_vers</em> </td><td>remote program version specification </td></tr> + <tr><td valign="top"></td><td valign="top"><em>procedure</em> </td><td>procedure to be performed by remote program </td></tr> + <tr><td valign="top"></td><td valign="top"><em>cflavor</em> </td><td>authentication credential type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>clength</em> </td><td>credential length (should be 0) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>cdata</em> </td><td>opaque credential data (currently unused) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>vflavor</em> </td><td>authentication verifier type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>vlength</em> </td><td>verifier length (should be 0) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>vdata</em> </td><td>opaque verifier data (currently unused) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="d20d81e5ce0cd581ff374242fb30a089"></a><!-- doxytag: member="libnet-functions.h::libnet_build_sebek" ref="d20d81e5ce0cd581ff374242fb30a089" args="(u_int32_t magic, u_int16_t version, u_int16_t type, u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, u_int8_t *payload, u_int32_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">u_int32_t </td> + <td class="paramname"> <em>magic</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>counter</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>time_sec</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>time_usec</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>pid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>uid</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>fd</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>cmd</em>[SEBEK_CMD_LENGTH], </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>length</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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> <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>magic</em> </td><td>identify packets that should be hidden </td></tr> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>protocol version, currently 1 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>type of record (read data is type 0, write data is type 1) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>counter</em> </td><td>PDU counter used to identify when packet are lost </td></tr> + <tr><td valign="top"></td><td valign="top"><em>time_sec</em> </td><td>seconds since EPOCH according to the honeypot </td></tr> + <tr><td valign="top"></td><td valign="top"><em>time_usec</em> </td><td>residual microseconds </td></tr> + <tr><td valign="top"></td><td valign="top"><em>pid</em> </td><td>PID </td></tr> + <tr><td valign="top"></td><td valign="top"><em>uid</em> </td><td>UID </td></tr> + <tr><td valign="top"></td><td valign="top"><em>fd</em> </td><td>FD </td></tr> + <tr><td valign="top"></td><td valign="top"><em>cmd</em> </td><td>12 first characters of the command </td></tr> + <tr><td valign="top"></td><td valign="top"><em>length</em> </td><td>length in bytes of the PDU's body </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="0a3c886a4103e0a80aea25d6d326b6bf"></a><!-- doxytag: member="libnet-functions.h::libnet_build_stp_conf" ref="0a3c886a4103e0a80aea25d6d326b6bf" args="(u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id, u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>bpdu_type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>flags</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>root_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>root_pc</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>bridge_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>port_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>message_age</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>max_age</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>hello_time</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>f_delay</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>protocol id </td></tr> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>protocol version </td></tr> + <tr><td valign="top"></td><td valign="top"><em>bpdu_type</em> </td><td>bridge protocol data unit type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>flags</em> </td><td>flags </td></tr> + <tr><td valign="top"></td><td valign="top"><em>root_id</em> </td><td>root id </td></tr> + <tr><td valign="top"></td><td valign="top"><em>root_pc</em> </td><td>root path cost </td></tr> + <tr><td valign="top"></td><td valign="top"><em>bridge_id</em> </td><td>bridge id </td></tr> + <tr><td valign="top"></td><td valign="top"><em>port_id</em> </td><td>port id </td></tr> + <tr><td valign="top"></td><td valign="top"><em>message_age</em> </td><td>message age </td></tr> + <tr><td valign="top"></td><td valign="top"><em>max_age</em> </td><td>max age </td></tr> + <tr><td valign="top"></td><td valign="top"><em>hello_time</em> </td><td>hello time </td></tr> + <tr><td valign="top"></td><td valign="top"><em>f_delay</em> </td><td>forward delay </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="0d0bf94c6887aec7702cf9f4190a1e55"></a><!-- doxytag: member="libnet-functions.h::libnet_build_stp_tcn" ref="0d0bf94c6887aec7702cf9f4190a1e55" args="(u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>bpdu_type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>protocol id </td></tr> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>protocol version </td></tr> + <tr><td valign="top"></td><td valign="top"><em>bpdu_type</em> </td><td>bridge protocol data unit type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="24b1a32adad116ddc743482a229af490"></a><!-- doxytag: member="libnet-functions.h::libnet_build_tcp" ref="24b1a32adad116ddc743482a229af490" args="(u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>sp</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>dp</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>seq</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_t </td> + <td class="paramname"> <em>ack</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>control</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>win</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>urg</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an RFC 793 Transmission Control Protocol (TCP) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>sp</em> </td><td>source port </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dp</em> </td><td>destination port </td></tr> + <tr><td valign="top"></td><td valign="top"><em>seq</em> </td><td>sequence number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ack</em> </td><td>acknowledgement number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>control</em> </td><td>control flags </td></tr> + <tr><td valign="top"></td><td valign="top"><em>win</em> </td><td>window size </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>urg</em> </td><td>urgent pointer </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>total length of the TCP packet (for checksum calculation) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td></td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="316a2d08bdd3199b6b30fa446b48df51"></a><!-- doxytag: member="libnet-functions.h::libnet_build_tcp_options" ref="316a2d08bdd3199b6b30fa446b48df51" args="(u_int8_t *options, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>options</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>options</em> </td><td>byte string of TCP options </td></tr> + <tr><td valign="top"></td><td valign="top"><em>options_s</em> </td><td>length of options string </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="65635fcbae54edb768ed36e8ce3abca6"></a><!-- doxytag: member="libnet-functions.h::libnet_build_token_ring" ref="65635fcbae54edb768ed36e8ce3abca6" args="(u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>ac</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>fc</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>dst</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>src</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>dsap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ssap</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>cf</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>oui</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds a token ring header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>ac</em> </td><td>access control </td></tr> + <tr><td valign="top"></td><td valign="top"><em>fc</em> </td><td>frame control </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dst</em> </td><td>destination address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>source address </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dsap</em> </td><td>destination service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ssap</em> </td><td>source service access point </td></tr> + <tr><td valign="top"></td><td valign="top"><em>cf</em> </td><td>control field </td></tr> + <tr><td valign="top"></td><td valign="top"><em>oui</em> </td><td>Organizationally Unique Identifier </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>upper layer protocol type </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="6d3f91d01237eef2f82ffd322ecbc792"></a><!-- doxytag: member="libnet-functions.h::libnet_build_udp" ref="6d3f91d01237eef2f82ffd322ecbc792" args="(u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, u_int8_t *payload, u_int32_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">u_int16_t </td> + <td class="paramname"> <em>sp</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>dp</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>len</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Builds an RFC 768 User Datagram Protocol (UDP) header. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>sp</em> </td><td>source port </td></tr> + <tr><td valign="top"></td><td valign="top"><em>dp</em> </td><td>destination port </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>total length of the UDP packet </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="e94f381e758de9faf26920042a2830e0"></a><!-- doxytag: member="libnet-functions.h::libnet_build_vrrp" ref="e94f381e758de9faf26920042a2830e0" args="(u_int8_t version, u_int8_t type, u_int8_t vrouter_id, u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, u_int16_t sum, u_int8_t *payload, u_int32_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">u_int8_t </td> + <td class="paramname"> <em>version</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>vrouter_id</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>priority</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>ip_count</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>auth_type</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>advert_int</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>sum</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t * </td> + <td class="paramname"> <em>payload</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>version</em> </td><td>VRRP version (should be 2) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>VRRP packet type (should be 1 -- ADVERTISEMENT) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>vrouter_id</em> </td><td>virtual router identification </td></tr> + <tr><td valign="top"></td><td valign="top"><em>priority</em> </td><td>priority (higher numbers indicate higher priority) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ip_count</em> </td><td>number of IPv4 addresses contained in this advertisement </td></tr> + <tr><td valign="top"></td><td valign="top"><em>auth_type</em> </td><td>type of authentication (0, 1, 2 -- see RFC) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>advert_int</em> </td><td>interval between advertisements </td></tr> + <tr><td valign="top"></td><td valign="top"><em>sum</em> </td><td>checksum (0 for libnet to autofill) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload</em> </td><td>optional payload or NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>payload_s</em> </td><td>payload length or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>protocol tag to modify an existing header, 0 to build a new one </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>protocol tag value on success, -1 on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="b84889f7fe57a1801cf03eceac47463e"></a><!-- doxytag: member="libnet-functions.h::libnet_clear_packet" ref="b84889f7fe57a1801cf03eceac47463e" 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 width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> + +</div> +</div><p> +<a class="anchor" name="20887ffe940f1d2c5bcae79a188176c6"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_add" ref="20887ffe940f1d2c5bcae79a188176c6" 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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#6a879b30d3e1864fd9bad33e195223b5">libnet_init()</a>. If the context queue in write locked, this function will fail. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>label</em> </td><td>a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="565d99e292980d5033bef2d186596217"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_destroy" ref="565d99e292980d5033bef2d186596217" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Context Queue] Destroys the entire context queue, calling <a class="el" href="libnet-functions_8h.html#591804711cffa92582703a5aedbd9b25">libnet_destroy()</a> on each member context. +</div> +</div><p> +<a class="anchor" name="4846c3ce22db19195b235ad11d7c60ce"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_end_loop" ref="4846c3ce22db19195b235ad11d7c60ce" args="(void)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int32_t libnet_cq_end_loop </td> + <td>(</td> + <td class="paramtype">void </td> + <td class="paramname"> </td> + <td> ) </td> + <td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Context Queue] +</div> +</div><p> +<a class="anchor" name="0cd216f0e5563ee06043a8ebfa16fe57"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_find_by_label" ref="0cd216f0e5563ee06043a8ebfa16fe57" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Context Queue] Locates a libnet context from the queue, indexed by a canonical label. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>label</em> </td><td>canonical label of the libnet context to retrieve </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the expected libnet context, NULL on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="bb1341d217de4d9c39ec484951e518b0"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_getlabel" ref="bb1341d217de4d9c39ec484951e518b0" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Context Queue] Returns the canonical label associated with the context. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to the libnet context's label </dd></dl> + +</div> +</div><p> +<a class="anchor" name="7e98a045ac6e29ca421507d9a200b5aa"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_head" ref="7e98a045ac6e29ca421507d9a200b5aa" 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 width="100%"></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> +for (l = <a class="el" href="libnet-functions_8h.html#7e98a045ac6e29ca421507d9a200b5aa">libnet_cq_head()</a>; <a class="el" href="libnet-functions_8h.html#ab1eb1e3ae64cde579a5a6035d5406c8">libnet_cq_last()</a>; l = <a class="el" href="libnet-functions_8h.html#d312f3182e3e5367db87fc6bab32604d">libnet_cq_next()</a>) { ... }<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#f36eb84eee10c525720134cfadb50a3e">for_each_context_in_cq(l)</a>. Warning: do not call the iterator more than once in a single loop. <dl class="return" compact><dt><b>Returns:</b></dt><dd>the head of the context queue </dd></dl> + +</div> +</div><p> +<a class="anchor" name="ab1eb1e3ae64cde579a5a6035d5406c8"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_last" ref="ab1eb1e3ae64cde579a5a6035d5406c8" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Context Queue] Check whether the iterator is at the last context in the queue. <dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if at the end of the context queue, 0 otherwise </dd></dl> + +</div> +</div><p> +<a class="anchor" name="d312f3182e3e5367db87fc6bab32604d"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_next" ref="d312f3182e3e5367db87fc6bab32604d" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Context Queue] Get next context from the context queue. <dl class="return" compact><dt><b>Returns:</b></dt><dd>the next context from the context queue </dd></dl> + +</div> +</div><p> +<a class="anchor" name="29f60504a0fe9b7bf6f5a962063118bb"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_remove" ref="29f60504a0fe9b7bf6f5a962063118bb" 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 width="100%"></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#591804711cffa92582703a5aedbd9b25">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#4e972664a0d839eab039f8fb2379987a">libnet_cq_remove_by_label()</a>. If the context queue is write locked, this function will fail. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the pointer to the removed libnet context, NULL on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="4e972664a0d839eab039f8fb2379987a"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_remove_by_label" ref="4e972664a0d839eab039f8fb2379987a" 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 width="100%"></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#591804711cffa92582703a5aedbd9b25">libnet_destroy()</a>. If the context queue is write locked, this function will fail. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>label</em> </td><td>canonical name of the context to remove </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the pointer to the removed libnet context, NULL on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="d2d4679155425c02822559bcb0caa275"></a><!-- doxytag: member="libnet-functions.h::libnet_cq_size" ref="d2d4679155425c02822559bcb0caa275" args="(void)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int32_t libnet_cq_size </td> + <td>(</td> + <td class="paramtype">void </td> + <td class="paramname"> </td> + <td> ) </td> + <td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Context Queue] Function returns the number of libnet contexts that are in the queue. <dl class="return" compact><dt><b>Returns:</b></dt><dd>the number of libnet contexts currently in the queue </dd></dl> + +</div> +</div><p> +<a class="anchor" name="591804711cffa92582703a5aedbd9b25"></a><!-- doxytag: member="libnet-functions.h::libnet_destroy" ref="591804711cffa92582703a5aedbd9b25" 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 width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> + +</div> +</div><p> +<a class="anchor" name="3aa6623246e13310dc6f9f9834e7313b"></a><!-- doxytag: member="libnet-functions.h::libnet_diag_dump_context" ref="3aa6623246e13310dc6f9f9834e7313b" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Diagnostic] Prints the contents of the given context. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> + +</div> +</div><p> +<a class="anchor" name="862af1289e6eb7a930e18bf1f3008cd4"></a><!-- doxytag: member="libnet-functions.h::libnet_diag_dump_hex" ref="862af1289e6eb7a930e18bf1f3008cd4" args="(u_int8_t *packet, u_int32_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">u_int8_t * </td> + <td class="paramname"> <em>packet</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>packet</em> </td><td>the packet to print </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>length of the packet in bytes </td></tr> + <tr><td valign="top"></td><td valign="top"><em>swap</em> </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 valign="top"></td><td valign="top"><em>stream</em> </td><td>a stream pointer to print to </td></tr> + </table> +</dl> + +</div> +</div><p> +<a class="anchor" name="9825c6c69efd6ef24545d59177a333e6"></a><!-- doxytag: member="libnet-functions.h::libnet_diag_dump_pblock" ref="9825c6c69efd6ef24545d59177a333e6" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Diagnostic] Prints the contents of every pblock. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> + +</div> +</div><p> +<a class="anchor" name="053bcb30c956b858db88b9a551e9360b"></a><!-- doxytag: member="libnet-functions.h::libnet_diag_dump_pblock_type" ref="053bcb30c956b858db88b9a551e9360b" args="(u_int8_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">u_int8_t </td> + <td class="paramname"> <em>type</em> </td> + <td> ) </td> + <td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +[Diagnostic] Returns the canonical name of the pblock type. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>pblock type </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>a string representing the pblock type type or "unknown" for an unknown value </dd></dl> + +</div> +</div><p> +<a class="anchor" name="6531e479687de8d195bd1605422735ca"></a><!-- doxytag: member="libnet-functions.h::libnet_get_hwaddr" ref="6531e479687de8d195bd1605422735ca" 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 width="100%"><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#36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> will tell you why. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>a pointer to the MAC address or NULL </dd></dl> + +</div> +</div><p> +<a class="anchor" name="e5143c0ab5dc9e9fa817d865eac428b0"></a><!-- doxytag: member="libnet-functions.h::libnet_get_ipaddr4" ref="e5143c0ab5dc9e9fa817d865eac428b0" args="(libnet_t *l)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int32_t libnet_get_ipaddr4 </td> + <td>(</td> + <td class="paramtype">libnet_t * </td> + <td class="paramname"> <em>l</em> </td> + <td> ) </td> + <td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><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><p> +<a class="anchor" name="3d7de8968c2087df7a22140d7993e267"></a><!-- doxytag: member="libnet-functions.h::libnet_get_ipaddr6" ref="3d7de8968c2087df7a22140d7993e267" 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 width="100%"><code> [read]</code></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +This function is not yet implemented under IPv6. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>well, nothing yet </dd></dl> + +</div> +</div><p> +<a class="anchor" name="453d816dc8adffaefc040a1bf5bd9b5f"></a><!-- doxytag: member="libnet-functions.h::libnet_get_prand" ref="453d816dc8adffaefc040a1bf5bd9b5f" args="(int mod)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int32_t libnet_get_prand </td> + <td>(</td> + <td class="paramtype">int </td> + <td class="paramname"> <em>mod</em> </td> + <td> ) </td> + <td width="100%"></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 compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>mod</em> </td><td>one the of LIBNET_PR* constants </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="1e68365ece2c976a75bc50e91df40ea0"></a><!-- doxytag: member="libnet-functions.h::libnet_getdevice" ref="1e68365ece2c976a75bc50e91df40ea0" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Returns the canonical name of the device used for packet injection. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><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><p> +<a class="anchor" name="36c0b24a4926a8f5d9d392836e915f2e"></a><!-- doxytag: member="libnet-functions.h::libnet_geterror" ref="36c0b24a4926a8f5d9d392836e915f2e" 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 width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>an error string or NULL if no error has occured </dd></dl> + +</div> +</div><p> +<a class="anchor" name="b9b137f454b3da05d4ac5fe388c1f2b8"></a><!-- doxytag: member="libnet-functions.h::libnet_getfd" ref="b9b137f454b3da05d4ac5fe388c1f2b8" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Returns the FILENO of the file descriptor used for packet injection. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the file number of the file descriptor used for packet injection </dd></dl> + +</div> +</div><p> +<a class="anchor" name="0af792a7e4bc49bd252b062cd4f35af5"></a><!-- doxytag: member="libnet-functions.h::libnet_getgre_length" ref="0af792a7e4bc49bd252b062cd4f35af5" args="(u_int16_t fv)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int32_t libnet_getgre_length </td> + <td>(</td> + <td class="paramtype">u_int16_t </td> + <td class="paramname"> <em>fv</em> </td> + <td> ) </td> + <td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>fv</em> </td><td>see <a class="el" href="libnet-functions_8h.html#fff121ac7bc157e3df0eb1bd624263c1">libnet_build_gre()</a>. </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>size, see <a class="el" href="libnet-functions_8h.html#fff121ac7bc157e3df0eb1bd624263c1">libnet_build_gre()</a>. </dd></dl> + +</div> +</div><p> +<a class="anchor" name="a04f828cf6b7ade20204ec0e3dcbc778"></a><!-- doxytag: member="libnet-functions.h::libnet_getpacket_size" ref="a04f828cf6b7ade20204ec0e3dcbc778" args="(libnet_t *l)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int32_t libnet_getpacket_size </td> + <td>(</td> + <td class="paramtype">libnet_t * </td> + <td class="paramname"> <em>l</em> </td> + <td> ) </td> + <td width="100%"></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). <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the size of the packet in l </dd></dl> + +</div> +</div><p> +<a class="anchor" name="8b784c9899c429dd0f4790a71bdf55a2"></a><!-- doxytag: member="libnet-functions.h::libnet_getpbuf" ref="8b784c9899c429dd0f4790a71bdf55a2" args="(libnet_t *l, libnet_ptag_t ptag)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int8_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#095de516e5b119d6e72fff4286157386">libnet_getpbuf_size()</a> should be made to determine the size of the buffer. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>the ptag reference number </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>a pointer to the pblock buffer or NULL on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="095de516e5b119d6e72fff4286157386"></a><!-- doxytag: member="libnet-functions.h::libnet_getpbuf_size" ref="095de516e5b119d6e72fff4286157386" args="(libnet_t *l, libnet_ptag_t ptag)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int32_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#8b784c9899c429dd0f4790a71bdf55a2">libnet_getpbuf()</a> should be made to pull the actual buffer contents. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>the ptag reference number </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the size of the pblock buffer </dd></dl> + +</div> +</div><p> +<a class="anchor" name="66bfbb546b4a9fd49d446870b3b30bb0"></a><!-- doxytag: member="libnet-functions.h::libnet_hex_aton" ref="66bfbb546b4a9fd49d446870b3b30bb0" args="(const char *s, int *len)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int8_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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>s</em> </td><td>the string to be parsed </td></tr> + <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>the resulting size of the returned byte string </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>a byte string or NULL on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="6a879b30d3e1864fd9bad33e195223b5"></a><!-- doxytag: member="libnet-functions.h::libnet_init" ref="6a879b30d3e1864fd9bad33e195223b5" args="(int injection_type, 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">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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>injection_type</em> </td><td>packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>device</em> </td><td>the interface to use (NULL and libnet will choose one) </td></tr> + <tr><td valign="top"></td><td valign="top"><em>err_buf</em> </td><td>will contain an error message on failure </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>libnet context ready for use or NULL on error. </dd></dl> + +</div> +</div><p> +<a class="anchor" name="5042e4e9d37d9c1ab566b8d3b97e21a2"></a><!-- doxytag: member="libnet-functions.h::libnet_name2addr4" ref="5042e4e9d37d9c1ab566b8d3b97e21a2" args="(libnet_t *l, char *host_name, u_int8_t use_name)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">u_int32_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">u_int8_t </td> + <td class="paramname"> <em>use_name</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>host_name</em> </td><td>pointer to a string containing a presentation format host name </td></tr> + <tr><td valign="top"></td><td valign="top"><em>use_name</em> </td><td>LIBNET_RESOLVE or LIBNET_DONT_RESOLVE </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>network byte ordered IPv4 address or -1 (2^32 - 1) on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="6f3677b524c46fad4d185be9a3142099"></a><!-- doxytag: member="libnet-functions.h::libnet_name2addr6" ref="6f3677b524c46fad4d185be9a3142099" args="(libnet_t *l, char *host_name, u_int8_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">char * </td> + <td class="paramname"> <em>host_name</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int8_t </td> + <td class="paramname"> <em>use_name</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"><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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>host_name</em> </td><td>pointer to a string containing a presentation format host name </td></tr> + <tr><td valign="top"></td><td valign="top"><em>use_name</em> </td><td>LIBNET_RESOLVE or LIBNET_DONT_RESOLVE </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>network byte ordered IPv6 address structure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="39e332daa771627372a01867818b4301"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_dump" ref="39e332daa771627372a01867818b4301" 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 width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>plist</em> </td><td>previously created portlist </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="b854695d1306f9af440145fc6767d953"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_dump_string" ref="b854695d1306f9af440145fc6767d953" 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 width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>plist</em> </td><td>previously created portlist </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>a printable string containing the port list contents on success NULL on error </dd></dl> + +</div> +</div><p> +<a class="anchor" name="b5cb1d70164207a7c279a909576058be"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_free" ref="b5cb1d70164207a7c279a909576058be" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Frees all memory associated with port list chain. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>plist</em> </td><td>previously created portlist </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="aee8e5f54482bf3c9b7c5b101fa8f41f"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_new" ref="aee8e5f54482bf3c9b7c5b101fa8f41f" 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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#36c0b24a4926a8f5d9d392836e915f2e">libnet_geterror()</a> can tell you why. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>plist</em> </td><td>if successful, will refer to the portlist, if not, NULL </td></tr> + <tr><td valign="top"></td><td valign="top"><em>token_list</em> </td><td>string containing the port list primitive </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="05ced873eacf4a000e4ce3a3ab635108"></a><!-- doxytag: member="libnet-functions.h::libnet_plist_chain_next_pair" ref="05ced873eacf4a000e4ce3a3ab635108" args="(libnet_plist_t *plist, u_int16_t *bport, u_int16_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">u_int16_t * </td> + <td class="paramname"> <em>bport</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">u_int16_t * </td> + <td class="paramname"> <em>eport</em></td><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>plist</em> </td><td>previously created portlist </td></tr> + <tr><td valign="top"></td><td valign="top"><em>bport</em> </td><td>will contain the beginning port number or 0 </td></tr> + <tr><td valign="top"></td><td valign="top"><em>eport</em> </td><td>will contain the ending port number or 0 </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, 0 if empty, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="69470998be995ec8c5e11ecbb19137f5"></a><!-- doxytag: member="libnet-functions.h::libnet_seed_prand" ref="69470998be995ec8c5e11ecbb19137f5" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Seeds the psuedo-random number generator. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="886dc359d6add4b0608e8611af7e1b35"></a><!-- doxytag: member="libnet-functions.h::libnet_stats" ref="886dc359d6add4b0608e8611af7e1b35" 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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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). <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ls</em> </td><td>pointer to a libnet statistics structure </td></tr> + </table> +</dl> + +</div> +</div><p> +<a class="anchor" name="d36144707ce7994c12ef9d87dc9a2edf"></a><!-- doxytag: member="libnet-functions.h::libnet_toggle_checksum" ref="d36144707ce7994c12ef9d87dc9a2edf" 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><td> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td><td width="100%"></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#d36144707ce7994c12ef9d87dc9a2edf">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. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + <tr><td valign="top"></td><td valign="top"><em>ptag</em> </td><td>the ptag reference number </td></tr> + <tr><td valign="top"></td><td valign="top"><em>mode</em> </td><td>LIBNET_ON or LIBNET_OFF </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 on success, -1 on failure </dd></dl> + +</div> +</div><p> +<a class="anchor" name="5264b060183d307688780bf862fae37c"></a><!-- doxytag: member="libnet-functions.h::libnet_version" ref="5264b060183d307688780bf862fae37c" 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 width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Returns the version of libnet. <dl class="return" compact><dt><b>Returns:</b></dt><dd>the libnet version </dd></dl> + +</div> +</div><p> +<a class="anchor" name="53375552efe95906e152152fc170cc0d"></a><!-- doxytag: member="libnet-functions.h::libnet_write" ref="53375552efe95906e152152fc170cc0d" 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 width="100%"></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#6a879b30d3e1864fd9bad33e195223b5">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#886dc359d6add4b0608e8611af7e1b35">libnet_stats()</a>. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign="top"></td><td valign="top"><em>l</em> </td><td>pointer to a libnet context </td></tr> + </table> +</dl> +<dl class="return" compact><dt><b>Returns:</b></dt><dd>the number of bytes written, -1 on error </dd></dl> + +</div> +</div><p> +<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-headers_8h-source.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-headers_8h-source.html new file mode 100644 index 0000000..c65c8a7 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-headers_8h-source.html @@ -0,0 +1,1721 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet-headers.h Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet-headers.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> +<a name="l00002"></a>00002 <span class="comment"> * $Id: libnet-headers.h,v 1.15 2004/11/09 07:05:07 mike Exp $</span> +<a name="l00003"></a>00003 <span class="comment"> *</span> +<a name="l00004"></a>00004 <span class="comment"> * libnet-headers.h - Network routine library headers header file</span> +<a name="l00005"></a>00005 <span class="comment"> *</span> +<a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com></span> +<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span> +<a name="l00008"></a>00008 <span class="comment"> *</span> +<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span> +<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span> +<a name="l00011"></a>00011 <span class="comment"> * are met:</span> +<a name="l00012"></a>00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span> +<a name="l00013"></a>00013 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span> +<a name="l00014"></a>00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span> +<a name="l00015"></a>00015 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span> +<a name="l00016"></a>00016 <span class="comment"> * documentation and/or other materials provided with the distribution.</span> +<a name="l00017"></a>00017 <span class="comment"> *</span> +<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span> +<a name="l00019"></a>00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> +<a name="l00020"></a>00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> +<a name="l00021"></a>00021 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span> +<a name="l00022"></a>00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span> +<a name="l00023"></a>00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span> +<a name="l00024"></a>00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> +<a name="l00025"></a>00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span> +<a name="l00026"></a>00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span> +<a name="l00027"></a>00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span> +<a name="l00028"></a>00028 <span class="comment"> * SUCH DAMAGE.</span> +<a name="l00029"></a>00029 <span class="comment"> *</span> +<a name="l00030"></a>00030 <span class="comment"> */</span> +<a name="l00031"></a>00031 +<a name="l00032"></a>00032 <span class="preprocessor">#ifndef __LIBNET_HEADERS_H</span> +<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_HEADERS_H</span> +<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="comment">/*</span> +<a name="l00035"></a>00035 <span class="comment"> * @file libnet-headers.h</span> +<a name="l00036"></a>00036 <span class="comment"> * @brief libnet header information</span> +<a name="l00037"></a>00037 <span class="comment"> */</span> +<a name="l00038"></a>00038 +<a name="l00039"></a>00039 <span class="comment">/*</span> +<a name="l00040"></a>00040 <span class="comment"> * Libnet defines header sizes for every builder function exported.</span> +<a name="l00041"></a>00041 <span class="comment"> */</span> +<a name="l00042"></a>00042 <span class="preprocessor">#define LIBNET_802_1Q_H 0x12 </span> +<a name="l00043"></a>00043 <span class="preprocessor">#define LIBNET_802_1X_H 0x04 </span> +<a name="l00044"></a>00044 <span class="preprocessor">#define LIBNET_802_2_H 0x03 </span> +<a name="l00045"></a>00045 <span class="preprocessor">#define LIBNET_802_2SNAP_H 0x08 </span> +<a name="l00046"></a>00046 <span class="preprocessor">#define LIBNET_802_3_H 0x0e </span> +<a name="l00047"></a>00047 <span class="preprocessor">#define LIBNET_ARP_H 0x08 </span> +<a name="l00048"></a>00048 <span class="preprocessor">#define LIBNET_ARP_ETH_IP_H 0x1c </span> +<a name="l00049"></a>00049 <span class="preprocessor">#define LIBNET_BGP4_HEADER_H 0x13 </span> +<a name="l00050"></a>00050 <span class="preprocessor">#define LIBNET_BGP4_OPEN_H 0x0a </span> +<a name="l00051"></a>00051 <span class="preprocessor">#define LIBNET_BGP4_UPDATE_H 0x04 </span> +<a name="l00052"></a>00052 <span class="preprocessor">#define LIBNET_BGP4_NOTIFICATION_H 0x02 </span> +<a name="l00053"></a>00053 <span class="preprocessor">#define LIBNET_CDP_H 0x08 </span> +<a name="l00054"></a>00054 <span class="preprocessor">#define LIBNET_DHCPV4_H 0xf0 </span> +<a name="l00055"></a>00055 <span class="preprocessor">#define LIBNET_UDP_DNSV4_H 0x0c </span> +<a name="l00056"></a>00056 <span class="preprocessor">#define LIBNET_TCP_DNSV4_H 0x0e </span> +<a name="l00057"></a>00057 <span class="preprocessor">#define LIBNET_ETH_H 0x0e </span> +<a name="l00058"></a>00058 <span class="preprocessor">#define LIBNET_FDDI_H 0x15 </span> +<a name="l00059"></a>00059 <span class="preprocessor">#define LIBNET_ICMPV4_H 0x04 </span> +<a name="l00060"></a>00060 <span class="preprocessor">#define LIBNET_ICMPV4_ECHO_H 0x08 </span> +<a name="l00061"></a>00061 <span class="preprocessor">#define LIBNET_ICMPV4_MASK_H 0x0c </span> +<a name="l00062"></a>00062 <span class="preprocessor">#define LIBNET_ICMPV4_UNREACH_H 0x08 </span> +<a name="l00063"></a>00063 <span class="preprocessor">#define LIBNET_ICMPV4_TIMXCEED_H 0x08 </span> +<a name="l00064"></a>00064 <span class="preprocessor">#define LIBNET_ICMPV4_REDIRECT_H 0x08 </span> +<a name="l00065"></a>00065 <span class="preprocessor">#define LIBNET_ICMPV4_TS_H 0x14 </span> +<a name="l00066"></a>00066 <span class="preprocessor">#define LIBNET_ICMPV6_H 0x08 </span> +<a name="l00067"></a>00067 <span class="preprocessor">#define LIBNET_IGMP_H 0x08 </span> +<a name="l00068"></a>00068 <span class="preprocessor">#define LIBNET_IPV4_H 0x14 </span> +<a name="l00069"></a>00069 <span class="preprocessor">#define LIBNET_IPV6_H 0x28 </span> +<a name="l00070"></a>00070 <span class="preprocessor">#define LIBNET_IPV6_FRAG_H 0x08 </span> +<a name="l00071"></a>00071 <span class="preprocessor">#define LIBNET_IPV6_ROUTING_H 0x04 </span> +<a name="l00072"></a>00072 <span class="preprocessor">#define LIBNET_IPV6_DESTOPTS_H 0x02 </span> +<a name="l00073"></a>00073 <span class="preprocessor">#define LIBNET_IPV6_HBHOPTS_H 0x02 </span> +<a name="l00074"></a>00074 <span class="preprocessor">#define LIBNET_IPSEC_ESP_HDR_H 0x0c </span> +<a name="l00075"></a>00075 <span class="preprocessor">#define LIBNET_IPSEC_ESP_FTR_H 0x02 </span> +<a name="l00076"></a>00076 <span class="preprocessor">#define LIBNET_IPSEC_AH_H 0x10 </span> +<a name="l00077"></a>00077 <span class="preprocessor">#define LIBNET_ISL_H 0x1a </span> +<a name="l00078"></a>00078 <span class="preprocessor">#define LIBNET_GRE_H 0x04 </span> +<a name="l00079"></a>00079 <span class="preprocessor">#define LIBNET_GRE_SRE_H 0x04 </span> +<a name="l00080"></a>00080 <span class="preprocessor">#define LIBNET_MPLS_H 0x04 </span> +<a name="l00081"></a>00081 <span class="preprocessor">#define LIBNET_OSPF_H 0x10 </span> +<a name="l00082"></a>00082 <span class="preprocessor">#define LIBNET_OSPF_HELLO_H 0x18 </span> +<a name="l00083"></a>00083 <span class="preprocessor">#define LIBNET_OSPF_DBD_H 0x08 </span> +<a name="l00084"></a>00084 <span class="preprocessor">#define LIBNET_OSPF_LSR_H 0x0c </span> +<a name="l00085"></a>00085 <span class="preprocessor">#define LIBNET_OSPF_LSU_H 0x04 </span> +<a name="l00086"></a>00086 <span class="preprocessor">#define LIBNET_OSPF_LSA_H 0x14 </span> +<a name="l00087"></a>00087 <span class="preprocessor">#define LIBNET_OSPF_AUTH_H 0x08 </span> +<a name="l00088"></a>00088 <span class="preprocessor">#define LIBNET_OSPF_CKSUM 0x10 </span> +<a name="l00089"></a>00089 <span class="preprocessor">#define LIBNET_OSPF_LS_RTR_H 0x10 </span> +<a name="l00090"></a>00090 <span class="preprocessor">#define LIBNET_OSPF_LS_NET_H 0x08 </span> +<a name="l00091"></a>00091 <span class="preprocessor">#define LIBNET_OSPF_LS_SUM_H 0x0c </span> +<a name="l00092"></a>00092 <span class="preprocessor">#define LIBNET_OSPF_LS_AS_EXT_H 0x10 </span> +<a name="l00093"></a>00093 <span class="preprocessor">#define LIBNET_NTP_H 0x30 </span> +<a name="l00094"></a>00094 <span class="preprocessor">#define LIBNET_RIP_H 0x18 </span> +<a name="l00095"></a>00095 <span class="preprocessor">#define LIBNET_RPC_CALL_H 0x28 </span> +<a name="l00098"></a>00098 <span class="preprocessor">#define LIBNET_RPC_CALL_TCP_H 0x2c </span> +<a name="l00101"></a>00101 <span class="preprocessor">#define LIBNET_SEBEK_H 0x30 </span><span class="comment">/* sebek header: 48 bytes */</span> +<a name="l00102"></a>00102 <span class="preprocessor">#define LIBNET_STP_CONF_H 0x23 </span> +<a name="l00103"></a>00103 <span class="preprocessor">#define LIBNET_STP_TCN_H 0x04 </span> +<a name="l00104"></a>00104 <span class="preprocessor">#define LIBNET_TOKEN_RING_H 0x16 </span> +<a name="l00105"></a>00105 <span class="preprocessor">#define LIBNET_TCP_H 0x14 </span> +<a name="l00106"></a>00106 <span class="preprocessor">#define LIBNET_UDP_H 0x08 </span> +<a name="l00107"></a>00107 <span class="preprocessor">#define LIBNET_VRRP_H 0x08 </span> +<a name="l00108"></a>00108 <span class="preprocessor">#define LIBNET_HSRP_H 0x14 </span> +<a name="l00110"></a>00110 <span class="preprocessor"></span><span class="comment">/*</span> +<a name="l00111"></a>00111 <span class="comment"> * IEEE 802.1Q (Virtual Local Area Network) VLAN header, static header </span> +<a name="l00112"></a>00112 <span class="comment"> * size: 18 bytes</span> +<a name="l00113"></a>00113 <span class="comment"> */</span> +<a name="l00114"></a>00114 <span class="keyword">struct </span>libnet_802_1q_hdr +<a name="l00115"></a>00115 { +<a name="l00116"></a>00116 u_int8_t vlan_dhost[ETHER_ADDR_LEN]; +<a name="l00117"></a>00117 u_int8_t vlan_shost[ETHER_ADDR_LEN]; +<a name="l00118"></a>00118 u_int16_t vlan_tpi; +<a name="l00119"></a>00119 u_int16_t vlan_priority_c_vid; +<a name="l00120"></a>00120 <span class="preprocessor">#define LIBNET_802_1Q_PRIMASK 0x0007 </span> +<a name="l00121"></a>00121 <span class="preprocessor">#define LIBNET_802_1Q_CFIMASK 0x0001 </span> +<a name="l00122"></a>00122 <span class="preprocessor">#define LIBNET_802_1Q_VIDMASK 0x0fff </span> +<a name="l00123"></a>00123 <span class="preprocessor"> u_int16_t vlan_len; </span> +<a name="l00124"></a>00124 <span class="preprocessor">}; </span> +<a name="l00125"></a>00125 <span class="preprocessor"></span> +<a name="l00126"></a>00126 <span class="comment">/*</span> +<a name="l00127"></a>00127 <span class="comment"> * IEEE 802.1X EAP (Extensible Authentication Protocol) header, static header</span> +<a name="l00128"></a>00128 <span class="comment"> * size: 4 bytes</span> +<a name="l00129"></a>00129 <span class="comment"> */</span> +<a name="l00130"></a>00130 <span class="keyword">struct </span>libnet_802_1x_hdr +<a name="l00131"></a>00131 { +<a name="l00132"></a>00132 u_int8_t dot1x_version; +<a name="l00133"></a>00133 u_int8_t dot1x_type; +<a name="l00134"></a>00134 <span class="preprocessor">#define LIBNET_802_1X_PACKET 0x00 </span> +<a name="l00135"></a>00135 <span class="preprocessor">#define LIBNET_802_1X_START 0x01 </span> +<a name="l00136"></a>00136 <span class="preprocessor">#define LIBNET_802_1X_LOGOFF 0x02 </span> +<a name="l00137"></a>00137 <span class="preprocessor">#define LIBNET_802_1X_KEY 0x03 </span> +<a name="l00138"></a>00138 <span class="preprocessor">#define LIBNET_802_1X_ENCASFAL 0x04 </span> +<a name="l00139"></a>00139 <span class="preprocessor"> u_int16_t dot1x_length; </span> +<a name="l00140"></a>00140 <span class="preprocessor">}; </span> +<a name="l00141"></a>00141 <span class="preprocessor"></span> +<a name="l00142"></a>00142 <span class="comment">/*</span> +<a name="l00143"></a>00143 <span class="comment"> * IEEE 802.2 LLC header</span> +<a name="l00144"></a>00144 <span class="comment"> * Link Layer Control</span> +<a name="l00145"></a>00145 <span class="comment"> * static header size: 3 bytes</span> +<a name="l00146"></a>00146 <span class="comment"> */</span> +<a name="l00147"></a>00147 <span class="keyword">struct </span>libnet_802_2_hdr +<a name="l00148"></a>00148 { +<a name="l00149"></a>00149 u_int8_t llc_dsap; <span class="comment">/* destination service access point */</span> +<a name="l00150"></a>00150 u_int8_t llc_ssap; <span class="comment">/* source service access point */</span> +<a name="l00151"></a>00151 <span class="preprocessor">#define LIBNET_SAP_STP 0x42</span> +<a name="l00152"></a>00152 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_SAP_SNAP 0xaa</span> +<a name="l00153"></a>00153 <span class="preprocessor"></span> u_int8_t llc_control; <span class="comment">/* control field */</span> +<a name="l00154"></a>00154 }; +<a name="l00155"></a>00155 +<a name="l00156"></a>00156 +<a name="l00157"></a>00157 <span class="comment">/*</span> +<a name="l00158"></a>00158 <span class="comment"> * IEEE 802.2 LLC/SNAP header</span> +<a name="l00159"></a>00159 <span class="comment"> * SubNetwork Attachment Point</span> +<a name="l00160"></a>00160 <span class="comment"> * static header size: 8 bytes</span> +<a name="l00161"></a>00161 <span class="comment"> */</span> +<a name="l00162"></a>00162 <span class="keyword">struct </span>libnet_802_2snap_hdr +<a name="l00163"></a>00163 { +<a name="l00164"></a>00164 u_int8_t snap_dsap; <span class="comment">/* destination service access point */</span> +<a name="l00165"></a>00165 u_int8_t snap_ssap; <span class="comment">/* destination service access point */</span> +<a name="l00166"></a>00166 u_int8_t snap_control; <span class="comment">/* control field */</span> +<a name="l00167"></a>00167 u_int8_t snap_oui[3]; <span class="comment">/* OUI */</span> +<a name="l00168"></a>00168 u_int16_t snap_type; <span class="comment">/* type */</span> +<a name="l00169"></a>00169 }; +<a name="l00170"></a>00170 +<a name="l00171"></a>00171 +<a name="l00172"></a>00172 <span class="comment">/*</span> +<a name="l00173"></a>00173 <span class="comment"> * 802.3 header</span> +<a name="l00174"></a>00174 <span class="comment"> * IEEE Ethernet</span> +<a name="l00175"></a>00175 <span class="comment"> * Static header size: 14 bytes</span> +<a name="l00176"></a>00176 <span class="comment"> */</span> +<a name="l00177"></a>00177 <span class="keyword">struct </span>libnet_802_3_hdr +<a name="l00178"></a>00178 { +<a name="l00179"></a>00179 u_int8_t _802_3_dhost[ETHER_ADDR_LEN];<span class="comment">/* destination ethernet address */</span> +<a name="l00180"></a>00180 u_int8_t _802_3_shost[ETHER_ADDR_LEN];<span class="comment">/* source ethernet address */</span> +<a name="l00181"></a>00181 u_int16_t _802_3_len; <span class="comment">/* packet type ID */</span> +<a name="l00182"></a>00182 }; +<a name="l00183"></a>00183 +<a name="l00184"></a>00184 +<a name="l00185"></a>00185 <span class="comment">/* </span> +<a name="l00186"></a>00186 <span class="comment"> * ARP header</span> +<a name="l00187"></a>00187 <span class="comment"> * Address Resolution Protocol</span> +<a name="l00188"></a>00188 <span class="comment"> * Base header size: 8 bytes</span> +<a name="l00189"></a>00189 <span class="comment"> */</span> +<a name="l00190"></a>00190 <span class="keyword">struct </span>libnet_arp_hdr +<a name="l00191"></a>00191 { +<a name="l00192"></a>00192 u_int16_t ar_hrd; <span class="comment">/* format of hardware address */</span> +<a name="l00193"></a>00193 <span class="preprocessor">#define ARPHRD_NETROM 0 </span><span class="comment">/* from KA9Q: NET/ROM pseudo */</span> +<a name="l00194"></a>00194 <span class="preprocessor">#define ARPHRD_ETHER 1 </span><span class="comment">/* Ethernet 10Mbps */</span> +<a name="l00195"></a>00195 <span class="preprocessor">#define ARPHRD_EETHER 2 </span><span class="comment">/* Experimental Ethernet */</span> +<a name="l00196"></a>00196 <span class="preprocessor">#define ARPHRD_AX25 3 </span><span class="comment">/* AX.25 Level 2 */</span> +<a name="l00197"></a>00197 <span class="preprocessor">#define ARPHRD_PRONET 4 </span><span class="comment">/* PROnet token ring */</span> +<a name="l00198"></a>00198 <span class="preprocessor">#define ARPHRD_CHAOS 5 </span><span class="comment">/* Chaosnet */</span> +<a name="l00199"></a>00199 <span class="preprocessor">#define ARPHRD_IEEE802 6 </span><span class="comment">/* IEEE 802.2 Ethernet/TR/TB */</span> +<a name="l00200"></a>00200 <span class="preprocessor">#define ARPHRD_ARCNET 7 </span><span class="comment">/* ARCnet */</span> +<a name="l00201"></a>00201 <span class="preprocessor">#define ARPHRD_APPLETLK 8 </span><span class="comment">/* APPLEtalk */</span> +<a name="l00202"></a>00202 <span class="preprocessor">#define ARPHRD_LANSTAR 9 </span><span class="comment">/* Lanstar */</span> +<a name="l00203"></a>00203 <span class="preprocessor">#define ARPHRD_DLCI 15 </span><span class="comment">/* Frame Relay DLCI */</span> +<a name="l00204"></a>00204 <span class="preprocessor">#define ARPHRD_ATM 19 </span><span class="comment">/* ATM */</span> +<a name="l00205"></a>00205 <span class="preprocessor">#define ARPHRD_METRICOM 23 </span><span class="comment">/* Metricom STRIP (new IANA id) */</span> +<a name="l00206"></a>00206 <span class="preprocessor">#define ARPHRD_IPSEC 31 </span><span class="comment">/* IPsec tunnel */</span> +<a name="l00207"></a>00207 u_int16_t ar_pro; <span class="comment">/* format of protocol address */</span> +<a name="l00208"></a>00208 u_int8_t ar_hln; <span class="comment">/* length of hardware address */</span> +<a name="l00209"></a>00209 u_int8_t ar_pln; <span class="comment">/* length of protocol addres */</span> +<a name="l00210"></a>00210 u_int16_t ar_op; <span class="comment">/* operation type */</span> +<a name="l00211"></a>00211 <span class="preprocessor">#define ARPOP_REQUEST 1 </span><span class="comment">/* req to resolve address */</span> +<a name="l00212"></a>00212 <span class="preprocessor">#define ARPOP_REPLY 2 </span><span class="comment">/* resp to previous request */</span> +<a name="l00213"></a>00213 <span class="preprocessor">#define ARPOP_REVREQUEST 3 </span><span class="comment">/* req protocol address given hardware */</span> +<a name="l00214"></a>00214 <span class="preprocessor">#define ARPOP_REVREPLY 4 </span><span class="comment">/* resp giving protocol address */</span> +<a name="l00215"></a>00215 <span class="preprocessor">#define ARPOP_INVREQUEST 8 </span><span class="comment">/* req to identify peer */</span> +<a name="l00216"></a>00216 <span class="preprocessor">#define ARPOP_INVREPLY 9 </span><span class="comment">/* resp identifying peer */</span> +<a name="l00217"></a>00217 <span class="comment">/* address information allocated dynamically */</span> +<a name="l00218"></a>00218 }; +<a name="l00219"></a>00219 +<a name="l00220"></a>00220 <span class="comment">/*</span> +<a name="l00221"></a>00221 <span class="comment"> * BGP4 header</span> +<a name="l00222"></a>00222 <span class="comment"> * Border Gateway Protocol 4</span> +<a name="l00223"></a>00223 <span class="comment"> * Base header size : 19 bytes</span> +<a name="l00224"></a>00224 <span class="comment"> */</span> +<a name="l00225"></a>00225 <span class="keyword">struct </span>libnet_bgp4_header_hdr +<a name="l00226"></a>00226 { +<a name="l00227"></a>00227 <span class="preprocessor">#define LIBNET_BGP4_MARKER_SIZE 16</span> +<a name="l00228"></a>00228 <span class="preprocessor"></span> u_int8_t marker[LIBNET_BGP4_MARKER_SIZE]; +<a name="l00229"></a>00229 u_int16_t len; +<a name="l00230"></a>00230 u_int8_t type; +<a name="l00231"></a>00231 <span class="preprocessor">#define LIBNET_BGP4_OPEN 1</span> +<a name="l00232"></a>00232 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UPDATE 2</span> +<a name="l00233"></a>00233 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_NOTIFICATION 3</span> +<a name="l00234"></a>00234 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_KEEPALIVE 4</span> +<a name="l00235"></a>00235 <span class="preprocessor"></span>}; +<a name="l00236"></a>00236 +<a name="l00237"></a>00237 <span class="comment">/*</span> +<a name="l00238"></a>00238 <span class="comment"> * BGP4 open header</span> +<a name="l00239"></a>00239 <span class="comment"> * Border Gateway Protocol 4</span> +<a name="l00240"></a>00240 <span class="comment"> * Base header size : 10 bytes</span> +<a name="l00241"></a>00241 <span class="comment"> */</span> +<a name="l00242"></a>00242 <span class="keyword">struct </span>libnet_bgp4_open_hdr +<a name="l00243"></a>00243 { +<a name="l00244"></a>00244 u_int8_t version; +<a name="l00245"></a>00245 u_int16_t src_as; +<a name="l00246"></a>00246 u_int16_t hold_time; +<a name="l00247"></a>00247 u_int32_t bgp_id; +<a name="l00248"></a>00248 u_int8_t opt_len; +<a name="l00249"></a>00249 }; +<a name="l00250"></a>00250 +<a name="l00251"></a>00251 <span class="comment">/*</span> +<a name="l00252"></a>00252 <span class="comment"> * BGP4 notification message</span> +<a name="l00253"></a>00253 <span class="comment"> *</span> +<a name="l00254"></a>00254 <span class="comment"> * Border Gateway Protocol 4</span> +<a name="l00255"></a>00255 <span class="comment"> * Base header size : 2 bytes</span> +<a name="l00256"></a>00256 <span class="comment"> *</span> +<a name="l00257"></a>00257 <span class="comment"> * Use payload if you need data</span> +<a name="l00258"></a>00258 <span class="comment"> */</span> +<a name="l00259"></a>00259 <span class="keyword">struct </span>libnet_bgp4_notification_hdr +<a name="l00260"></a>00260 { +<a name="l00261"></a>00261 <span class="preprocessor">#define LIBNET_BGP4_MESSAGE_HEADER_ERROR 1</span> +<a name="l00262"></a>00262 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_OPEN_MESSAGE_ERROR 2</span> +<a name="l00263"></a>00263 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UPDATE_MESSAGE_ERROR 3</span> +<a name="l00264"></a>00264 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_HOLD_TIMER_EXPIRED 4</span> +<a name="l00265"></a>00265 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_FINITE_STATE__ERROR 5</span> +<a name="l00266"></a>00266 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_CEASE 6</span> +<a name="l00267"></a>00267 <span class="preprocessor"></span> u_int8_t err_code; +<a name="l00268"></a>00268 +<a name="l00269"></a>00269 <span class="comment">/* Message Header Error subcodes */</span> +<a name="l00270"></a>00270 <span class="preprocessor">#define LIBNET_BGP4_CONNECTION_NOT_SYNCHRONIZED 1</span> +<a name="l00271"></a>00271 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_MESSAGE_LENGTH 2</span> +<a name="l00272"></a>00272 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_MESSAGE_TYPE 3</span> +<a name="l00273"></a>00273 <span class="preprocessor"></span><span class="comment">/* OPEN Message Error subcodes */</span> +<a name="l00274"></a>00274 <span class="preprocessor">#define LIBNET_BGP4_UNSUPPORTED_VERSION_NUMBER 1</span> +<a name="l00275"></a>00275 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_PEER_AS 2</span> +<a name="l00276"></a>00276 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_BGP_IDENTIFIER 3</span> +<a name="l00277"></a>00277 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNSUPPORTED_OPTIONAL_PARAMETER 4</span> +<a name="l00278"></a>00278 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_AUTHENTICATION_FAILURE 5</span> +<a name="l00279"></a>00279 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNACCEPTABLE_HOLD_TIME 6</span> +<a name="l00280"></a>00280 <span class="preprocessor"></span><span class="comment">/* UPDATE Message Error subcodes */</span> +<a name="l00281"></a>00281 <span class="preprocessor">#define LIBNET_BGP4_MALFORMED_ATTRIBUTE_LIST</span> +<a name="l00282"></a>00282 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE</span> +<a name="l00283"></a>00283 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_MISSING_WELL_KNOWN_ATTRIBUTE</span> +<a name="l00284"></a>00284 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_ATTRIBUTE_FLAGS_ERROR</span> +<a name="l00285"></a>00285 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_ATTRIBUTE_LENGTH_ERROR</span> +<a name="l00286"></a>00286 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_ORIGIN_ATTRIBUTE</span> +<a name="l00287"></a>00287 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_AS_ROUTING_LOOP</span> +<a name="l00288"></a>00288 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_NEXT_HOP_ATTRIBUTE</span> +<a name="l00289"></a>00289 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_OPTIONAL_ATTRIBUTE_ERROR</span> +<a name="l00290"></a>00290 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_NETWORK_FIELD</span> +<a name="l00291"></a>00291 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_MALFORMED_AS_PATH</span> +<a name="l00292"></a>00292 <span class="preprocessor"></span> u_int8_t err_subcode; +<a name="l00293"></a>00293 }; +<a name="l00294"></a>00294 +<a name="l00295"></a>00295 +<a name="l00296"></a>00296 +<a name="l00297"></a>00297 <span class="comment">/*</span> +<a name="l00298"></a>00298 <span class="comment"> * For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001.</span> +<a name="l00299"></a>00299 <span class="comment"> * Let's hope this one stays that way for a while!</span> +<a name="l00300"></a>00300 <span class="comment"> */</span> +<a name="l00301"></a>00301 <span class="preprocessor">#define LIBNET_PROTO_CDP 200</span> +<a name="l00302"></a>00302 <span class="preprocessor"></span> +<a name="l00303"></a>00303 <span class="comment">/*</span> +<a name="l00304"></a>00304 <span class="comment"> * CDP header</span> +<a name="l00305"></a>00305 <span class="comment"> * Cisco Discovery Protocol</span> +<a name="l00306"></a>00306 <span class="comment"> * Base header size: 8 bytes</span> +<a name="l00307"></a>00307 <span class="comment"> */</span> +<a name="l00308"></a>00308 <span class="keyword">struct </span>libnet_cdp_hdr +<a name="l00309"></a>00309 { +<a name="l00310"></a>00310 u_int8_t cdp_version; <span class="comment">/* version (should always be 0x01) */</span> +<a name="l00311"></a>00311 u_int8_t cdp_ttl; <span class="comment">/* time reciever should hold info in this packet */</span> +<a name="l00312"></a>00312 u_int16_t cdp_sum; <span class="comment">/* checksum */</span> +<a name="l00313"></a>00313 u_int16_t cdp_type; <span class="comment">/* type */</span> +<a name="l00314"></a>00314 <span class="preprocessor">#define LIBNET_CDP_DEVID 0x1 </span><span class="comment">/* device id */</span> +<a name="l00315"></a>00315 <span class="preprocessor">#define LIBNET_CDP_ADDRESS 0x2 </span><span class="comment">/* address */</span> +<a name="l00316"></a>00316 <span class="preprocessor">#define LIBNET_CDP_PORTID 0x3 </span><span class="comment">/* port id */</span> +<a name="l00317"></a>00317 <span class="preprocessor">#define LIBNET_CDP_CAPABIL 0x4 </span><span class="comment">/* capabilities */</span> +<a name="l00318"></a>00318 <span class="preprocessor">#define LIBNET_CDP_VERSION 0x5 </span><span class="comment">/* version */</span> +<a name="l00319"></a>00319 <span class="preprocessor">#define LIBNET_CDP_PLATFORM 0x6 </span><span class="comment">/* platform */</span> +<a name="l00320"></a>00320 <span class="preprocessor">#define LIBNET_CDP_IPPREFIX 0x7 </span><span class="comment">/* ip prefix */</span> +<a name="l00321"></a>00321 u_int16_t cdp_len; <span class="comment">/* type + length + value */</span> +<a name="l00322"></a>00322 <span class="comment">/* value information done dynamically */</span> +<a name="l00323"></a>00323 +<a name="l00324"></a>00324 <span class="comment">/* CDP capabilities */</span> +<a name="l00325"></a>00325 <span class="preprocessor">#define LIBNET_CDP_CAP_L3R 0x01</span><span class="comment">/* performs level 3 routing */</span> +<a name="l00326"></a>00326 <span class="preprocessor">#define LIBNET_CDP_CAP_L2B 0x02</span><span class="comment">/* performs level 2 transparent bridging */</span> +<a name="l00327"></a>00327 <span class="preprocessor">#define LIBNET_CDP_CAP_L2SRB 0x04</span><span class="comment">/* performs level 2 sourceroute bridging */</span> +<a name="l00328"></a>00328 <span class="preprocessor">#define LIBNET_CDP_CAP_L2S 0x08</span><span class="comment">/* performs level 2 switching */</span> +<a name="l00329"></a>00329 <span class="preprocessor">#define LIBNET_CDP_CAP_SR 0x10</span><span class="comment">/* sends and recieves packets on a network */</span> +<a name="l00330"></a>00330 <span class="preprocessor">#define LIBNET_CDP_CAP_NOI 0x20</span><span class="comment">/* does not forward IGMP on non-router ports */</span> +<a name="l00331"></a>00331 <span class="preprocessor">#define LIBNET_CDP_CAP_L1F 0x40</span><span class="comment">/* provides level 1 functionality */</span> +<a name="l00332"></a>00332 }; +<a name="l00333"></a>00333 +<a name="l00334"></a>00334 +<a name="l00335"></a>00335 <span class="comment">/*</span> +<a name="l00336"></a>00336 <span class="comment"> * Used as an overlay for type/len/values</span> +<a name="l00337"></a>00337 <span class="comment"> */</span> +<a name="l00338"></a>00338 <span class="keyword">struct </span>libnet_cdp_value_hdr +<a name="l00339"></a>00339 { +<a name="l00340"></a>00340 u_int16_t cdp_type; +<a name="l00341"></a>00341 u_int16_t cdp_len; +<a name="l00342"></a>00342 }; +<a name="l00343"></a>00343 +<a name="l00344"></a>00344 +<a name="l00345"></a>00345 <span class="comment">/*</span> +<a name="l00346"></a>00346 <span class="comment"> * DHCP header</span> +<a name="l00347"></a>00347 <span class="comment"> * Dynamic Host Configuration Protocol</span> +<a name="l00348"></a>00348 <span class="comment"> * Static header size: f0 bytes</span> +<a name="l00349"></a>00349 <span class="comment"> */</span> +<a name="l00350"></a>00350 <span class="keyword">struct </span>libnet_dhcpv4_hdr +<a name="l00351"></a>00351 { +<a name="l00352"></a>00352 u_int8_t dhcp_opcode; <span class="comment">/* opcode */</span> +<a name="l00353"></a>00353 <span class="preprocessor">#define LIBNET_DHCP_REQUEST 0x1</span> +<a name="l00354"></a>00354 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_REPLY 0x2</span> +<a name="l00355"></a>00355 <span class="preprocessor"></span> u_int8_t dhcp_htype; <span class="comment">/* hardware address type */</span> +<a name="l00356"></a>00356 u_int8_t dhcp_hlen; <span class="comment">/* hardware address length */</span> +<a name="l00357"></a>00357 u_int8_t dhcp_hopcount; <span class="comment">/* used by proxy servers */</span> +<a name="l00358"></a>00358 u_int32_t dhcp_xid; <span class="comment">/* transaction ID */</span> +<a name="l00359"></a>00359 u_int16_t dhcp_secs; <span class="comment">/* number of seconds since trying to bootstrap */</span> +<a name="l00360"></a>00360 u_int16_t dhcp_flags; <span class="comment">/* flags for DHCP, unused for BOOTP */</span> +<a name="l00361"></a>00361 u_int32_t dhcp_cip; <span class="comment">/* client's IP */</span> +<a name="l00362"></a>00362 u_int32_t dhcp_yip; <span class="comment">/* your IP */</span> +<a name="l00363"></a>00363 u_int32_t dhcp_sip; <span class="comment">/* server's IP */</span> +<a name="l00364"></a>00364 u_int32_t dhcp_gip; <span class="comment">/* gateway IP */</span> +<a name="l00365"></a>00365 u_int8_t dhcp_chaddr[16]; <span class="comment">/* client hardware address */</span> +<a name="l00366"></a>00366 u_int8_t dhcp_sname[64]; <span class="comment">/* server host name */</span> +<a name="l00367"></a>00367 u_int8_t dhcp_file[128]; <span class="comment">/* boot file name */</span> +<a name="l00368"></a>00368 u_int32_t dhcp_magic; <span class="comment">/* BOOTP magic header */</span> +<a name="l00369"></a>00369 <span class="preprocessor">#define DHCP_MAGIC 0x63825363</span> +<a name="l00370"></a>00370 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BOOTP_MIN_LEN 0x12c</span> +<a name="l00371"></a>00371 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_PAD 0x00</span> +<a name="l00372"></a>00372 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SUBNETMASK 0x01</span> +<a name="l00373"></a>00373 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TIMEOFFSET 0x02</span> +<a name="l00374"></a>00374 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROUTER 0x03</span> +<a name="l00375"></a>00375 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TIMESERVER 0x04</span> +<a name="l00376"></a>00376 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NAMESERVER 0x05</span> +<a name="l00377"></a>00377 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DNS 0x06</span> +<a name="l00378"></a>00378 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LOGSERV 0x07</span> +<a name="l00379"></a>00379 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_COOKIESERV 0x08</span> +<a name="l00380"></a>00380 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LPRSERV 0x09</span> +<a name="l00381"></a>00381 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IMPSERV 0x0a</span> +<a name="l00382"></a>00382 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_RESSERV 0x0b</span> +<a name="l00383"></a>00383 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_HOSTNAME 0x0c</span> +<a name="l00384"></a>00384 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_BOOTFILESIZE 0x0d</span> +<a name="l00385"></a>00385 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DUMPFILE 0x0e</span> +<a name="l00386"></a>00386 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOMAINNAME 0x0f</span> +<a name="l00387"></a>00387 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SWAPSERV 0x10</span> +<a name="l00388"></a>00388 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROOTPATH 0x11</span> +<a name="l00389"></a>00389 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_EXTENPATH 0x12</span> +<a name="l00390"></a>00390 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IPFORWARD 0x13</span> +<a name="l00391"></a>00391 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SRCROUTE 0x14</span> +<a name="l00392"></a>00392 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_POLICYFILTER 0x15</span> +<a name="l00393"></a>00393 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MAXASMSIZE 0x16</span> +<a name="l00394"></a>00394 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IPTTL 0x17</span> +<a name="l00395"></a>00395 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUTIMEOUT 0x18</span> +<a name="l00396"></a>00396 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUTABLE 0x19</span> +<a name="l00397"></a>00397 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUSIZE 0x1a</span> +<a name="l00398"></a>00398 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LOCALSUBNETS 0x1b</span> +<a name="l00399"></a>00399 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_BROADCASTADDR 0x1c</span> +<a name="l00400"></a>00400 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOMASKDISCOV 0x1d</span> +<a name="l00401"></a>00401 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MASKSUPPLY 0x1e</span> +<a name="l00402"></a>00402 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOROUTEDISC 0x1f</span> +<a name="l00403"></a>00403 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROUTERSOLICIT 0x20</span> +<a name="l00404"></a>00404 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STATICROUTE 0x21</span> +<a name="l00405"></a>00405 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TRAILERENCAP 0x22</span> +<a name="l00406"></a>00406 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ARPTIMEOUT 0x23</span> +<a name="l00407"></a>00407 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ETHERENCAP 0x24</span> +<a name="l00408"></a>00408 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPTTL 0x25</span> +<a name="l00409"></a>00409 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPKEEPALIVE 0x26</span> +<a name="l00410"></a>00410 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPALIVEGARBAGE 0x27</span> +<a name="l00411"></a>00411 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISDOMAIN 0x28</span> +<a name="l00412"></a>00412 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISSERVERS 0x29</span> +<a name="l00413"></a>00413 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISTIMESERV 0x2a</span> +<a name="l00414"></a>00414 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_VENDSPECIFIC 0x2b</span> +<a name="l00415"></a>00415 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBNS 0x2c</span> +<a name="l00416"></a>00416 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBDD 0x2d</span> +<a name="l00417"></a>00417 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBTCPIP 0x2e</span> +<a name="l00418"></a>00418 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBTCPSCOPE 0x2f</span> +<a name="l00419"></a>00419 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_XFONT 0x30</span> +<a name="l00420"></a>00420 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_XDISPLAYMGR 0x31</span> +<a name="l00421"></a>00421 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DISCOVERADDR 0x32</span> +<a name="l00422"></a>00422 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LEASETIME 0x33</span> +<a name="l00423"></a>00423 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_OPTIONOVERLOAD 0x34</span> +<a name="l00424"></a>00424 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MESSAGETYPE 0x35</span> +<a name="l00425"></a>00425 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SERVIDENT 0x36</span> +<a name="l00426"></a>00426 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_PARAMREQUEST 0x37</span> +<a name="l00427"></a>00427 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MESSAGE 0x38</span> +<a name="l00428"></a>00428 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MAXMSGSIZE 0x39</span> +<a name="l00429"></a>00429 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_RENEWTIME 0x3a</span> +<a name="l00430"></a>00430 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_REBINDTIME 0x3b</span> +<a name="l00431"></a>00431 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_CLASSSID 0x3c</span> +<a name="l00432"></a>00432 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_CLIENTID 0x3d</span> +<a name="l00433"></a>00433 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISPLUSDOMAIN 0x40</span> +<a name="l00434"></a>00434 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISPLUSSERVERS 0x41</span> +<a name="l00435"></a>00435 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MOBILEIPAGENT 0x44</span> +<a name="l00436"></a>00436 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SMTPSERVER 0x45</span> +<a name="l00437"></a>00437 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_POP3SERVER 0x46</span> +<a name="l00438"></a>00438 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NNTPSERVER 0x47</span> +<a name="l00439"></a>00439 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_WWWSERVER 0x48</span> +<a name="l00440"></a>00440 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_FINGERSERVER 0x49</span> +<a name="l00441"></a>00441 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IRCSERVER 0x4a</span> +<a name="l00442"></a>00442 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STSERVER 0x4b</span> +<a name="l00443"></a>00443 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STDASERVER 0x4c</span> +<a name="l00444"></a>00444 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_END 0xff</span> +<a name="l00445"></a>00445 <span class="preprocessor"></span> +<a name="l00446"></a>00446 <span class="preprocessor">#define LIBNET_DHCP_MSGDISCOVER 0x01</span> +<a name="l00447"></a>00447 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGOFFER 0x02</span> +<a name="l00448"></a>00448 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGREQUEST 0x03</span> +<a name="l00449"></a>00449 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGDECLINE 0x04</span> +<a name="l00450"></a>00450 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGACK 0x05</span> +<a name="l00451"></a>00451 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGNACK 0x06</span> +<a name="l00452"></a>00452 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGRELEASE 0x07</span> +<a name="l00453"></a>00453 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGINFORM 0x08</span> +<a name="l00454"></a>00454 <span class="preprocessor"></span>}; +<a name="l00455"></a>00455 +<a name="l00456"></a>00456 +<a name="l00457"></a>00457 <span class="comment">/* this little guy got left out in the cold */</span> +<a name="l00458"></a>00458 <span class="preprocessor">#define LIBNET_DNS_H LIBNET_UDP_DNSV4_H</span> +<a name="l00459"></a>00459 <span class="preprocessor"></span><span class="comment">/*</span> +<a name="l00460"></a>00460 <span class="comment"> * Base DNSv4 header</span> +<a name="l00461"></a>00461 <span class="comment"> * Domain Name System</span> +<a name="l00462"></a>00462 <span class="comment"> * Base header size: 12/14 bytes</span> +<a name="l00463"></a>00463 <span class="comment"> */</span> +<a name="l00464"></a>00464 <span class="keyword">struct </span>libnet_dnsv4_hdr +<a name="l00465"></a>00465 { +<a name="l00466"></a>00466 u_int16_t h_len; <span class="comment">/* length of the packet - only used with TCP */</span> +<a name="l00467"></a>00467 u_int16_t id; <span class="comment">/* DNS packet ID */</span> +<a name="l00468"></a>00468 u_int16_t flags; <span class="comment">/* DNS flags */</span> +<a name="l00469"></a>00469 u_int16_t num_q; <span class="comment">/* Number of questions */</span> +<a name="l00470"></a>00470 u_int16_t num_answ_rr; <span class="comment">/* Number of answer resource records */</span> +<a name="l00471"></a>00471 u_int16_t num_auth_rr; <span class="comment">/* Number of authority resource records */</span> +<a name="l00472"></a>00472 u_int16_t num_addi_rr; <span class="comment">/* Number of additional resource records */</span> +<a name="l00473"></a>00473 }; +<a name="l00474"></a>00474 +<a name="l00475"></a>00475 <span class="preprocessor">#define LIBNET_DNS_H LIBNET_UDP_DNSV4_H</span> +<a name="l00476"></a>00476 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_dnsv4udp_hdr +<a name="l00477"></a>00477 { +<a name="l00478"></a>00478 u_int16_t id; <span class="comment">/* DNS packet ID */</span> +<a name="l00479"></a>00479 u_int16_t flags; <span class="comment">/* DNS flags */</span> +<a name="l00480"></a>00480 u_int16_t num_q; <span class="comment">/* Number of questions */</span> +<a name="l00481"></a>00481 u_int16_t num_answ_rr; <span class="comment">/* Number of answer resource records */</span> +<a name="l00482"></a>00482 u_int16_t num_auth_rr; <span class="comment">/* Number of authority resource records */</span> +<a name="l00483"></a>00483 u_int16_t num_addi_rr; <span class="comment">/* Number of additional resource records */</span> +<a name="l00484"></a>00484 }; +<a name="l00485"></a>00485 +<a name="l00486"></a>00486 <span class="comment">/*</span> +<a name="l00487"></a>00487 <span class="comment"> * Ethernet II header</span> +<a name="l00488"></a>00488 <span class="comment"> * Static header size: 14 bytes</span> +<a name="l00489"></a>00489 <span class="comment"> */</span> +<a name="l00490"></a>00490 <span class="keyword">struct </span>libnet_ethernet_hdr +<a name="l00491"></a>00491 { +<a name="l00492"></a>00492 u_int8_t ether_dhost[ETHER_ADDR_LEN];<span class="comment">/* destination ethernet address */</span> +<a name="l00493"></a>00493 u_int8_t ether_shost[ETHER_ADDR_LEN];<span class="comment">/* source ethernet address */</span> +<a name="l00494"></a>00494 u_int16_t ether_type; <span class="comment">/* protocol */</span> +<a name="l00495"></a>00495 }; +<a name="l00496"></a>00496 +<a name="l00497"></a>00497 <span class="preprocessor">#ifndef ETHERTYPE_PUP</span> +<a name="l00498"></a>00498 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_PUP 0x0200 </span><span class="comment">/* PUP protocol */</span> +<a name="l00499"></a>00499 <span class="preprocessor">#endif</span> +<a name="l00500"></a>00500 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_IP</span> +<a name="l00501"></a>00501 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_IP 0x0800 </span><span class="comment">/* IP protocol */</span> +<a name="l00502"></a>00502 <span class="preprocessor">#endif</span> +<a name="l00503"></a>00503 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_ARP</span> +<a name="l00504"></a>00504 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_ARP 0x0806 </span><span class="comment">/* addr. resolution protocol */</span> +<a name="l00505"></a>00505 <span class="preprocessor">#endif</span> +<a name="l00506"></a>00506 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_REVARP</span> +<a name="l00507"></a>00507 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_REVARP 0x8035 </span><span class="comment">/* reverse addr. resolution protocol */</span> +<a name="l00508"></a>00508 <span class="preprocessor">#endif</span> +<a name="l00509"></a>00509 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_VLAN</span> +<a name="l00510"></a>00510 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_VLAN 0x8100 </span><span class="comment">/* IEEE 802.1Q VLAN tagging */</span> +<a name="l00511"></a>00511 <span class="preprocessor">#endif</span> +<a name="l00512"></a>00512 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_EAP</span> +<a name="l00513"></a>00513 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_EAP 0x888e </span><span class="comment">/* IEEE 802.1X EAP authentication */</span> +<a name="l00514"></a>00514 <span class="preprocessor">#endif</span> +<a name="l00515"></a>00515 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_MPLS</span> +<a name="l00516"></a>00516 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_MPLS 0x8847 </span><span class="comment">/* MPLS */</span> +<a name="l00517"></a>00517 <span class="preprocessor">#endif</span> +<a name="l00518"></a>00518 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_LOOPBACK</span> +<a name="l00519"></a>00519 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_LOOPBACK 0x9000 </span><span class="comment">/* used to test interfaces */</span> +<a name="l00520"></a>00520 <span class="preprocessor">#endif</span> +<a name="l00521"></a>00521 <span class="preprocessor"></span> +<a name="l00522"></a>00522 <span class="keyword">struct </span>libnet_ether_addr +<a name="l00523"></a>00523 { +<a name="l00524"></a>00524 u_int8_t ether_addr_octet[6]; <span class="comment">/* Ethernet address */</span> +<a name="l00525"></a>00525 }; +<a name="l00526"></a>00526 +<a name="l00527"></a>00527 <span class="comment">/*</span> +<a name="l00528"></a>00528 <span class="comment"> * Fiber Distributed Data Interface header</span> +<a name="l00529"></a>00529 <span class="comment"> *</span> +<a name="l00530"></a>00530 <span class="comment"> * Static header size: 21 bytes (LLC and 48-bit address addr only)</span> +<a name="l00531"></a>00531 <span class="comment"> *</span> +<a name="l00532"></a>00532 <span class="comment"> * Note: Organization field is 3 bytes which throws off the</span> +<a name="l00533"></a>00533 <span class="comment"> * alignment of type. Therefore fddi_type (19 bytes in) </span> +<a name="l00534"></a>00534 <span class="comment"> * is specified as two u_int8_ts.</span> +<a name="l00535"></a>00535 <span class="comment"> */</span> +<a name="l00536"></a>00536 <span class="keyword">struct </span>libnet_fddi_hdr +<a name="l00537"></a>00537 { +<a name="l00538"></a>00538 u_int8_t fddi_frame_control; <span class="comment">/* Class/Format/Priority */</span> +<a name="l00539"></a>00539 <span class="preprocessor">#define LIBNET_FDDI_LLC_FRAME 0x10</span> +<a name="l00540"></a>00540 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_FDDI_48BIT_ADDR 0x40</span> +<a name="l00541"></a>00541 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_FDDI_FC_REQD LIBNET_FDDI_LLC_FRAME | LIBNET_FDDI_48BIT_ADDR </span> +<a name="l00542"></a>00542 <span class="preprocessor"></span> u_int8_t fddi_dhost[FDDI_ADDR_LEN]; <span class="comment">/* destination fddi address */</span> +<a name="l00543"></a>00543 u_int8_t fddi_shost[FDDI_ADDR_LEN]; <span class="comment">/* source fddi address */</span> +<a name="l00544"></a>00544 u_int8_t fddi_llc_dsap; <span class="comment">/* DSAP */</span> +<a name="l00545"></a>00545 u_int8_t fddi_llc_ssap; <span class="comment">/* SSAP */</span> +<a name="l00546"></a>00546 u_int8_t fddi_llc_control_field; <span class="comment">/* Class/Format/Priority */</span> +<a name="l00547"></a>00547 u_int8_t fddi_llc_org_code[LIBNET_ORG_CODE_SIZE]; <span class="comment">/* Organization Code 3-bytes */</span> +<a name="l00548"></a>00548 u_int8_t fddi_type; <span class="comment">/* Protocol Type */</span> +<a name="l00549"></a>00549 u_int8_t fddi_type1; <span class="comment">/* see note above. */</span> +<a name="l00550"></a>00550 <span class="preprocessor">#define FDDI_TYPE_IP 0x0800 </span><span class="comment">/* IP protocol */</span> +<a name="l00551"></a>00551 <span class="preprocessor">#define FDDI_TYPE_ARP 0x0806 </span><span class="comment">/* addr. resolution protocol */</span> +<a name="l00552"></a>00552 <span class="preprocessor">#define FDDI_TYPE_REVARP 0x8035 </span><span class="comment">/* reverse addr. resolution protocol */</span> +<a name="l00553"></a>00553 }; +<a name="l00554"></a>00554 +<a name="l00555"></a>00555 +<a name="l00556"></a>00556 <span class="keyword">struct </span>libnet_fddi_addr +<a name="l00557"></a>00557 { +<a name="l00558"></a>00558 u_int8_t fddi_addr_octet[6]; <span class="comment">/* FDDI address */</span> +<a name="l00559"></a>00559 }; +<a name="l00560"></a>00560 +<a name="l00561"></a>00561 +<a name="l00562"></a>00562 <span class="comment">/*</span> +<a name="l00563"></a>00563 <span class="comment"> * GRE header - RFC 1701 & 2637</span> +<a name="l00564"></a>00564 <span class="comment"> * Generic Routing Encapsulation (GRE) </span> +<a name="l00565"></a>00565 <span class="comment"> * Base header size: 4 bytes</span> +<a name="l00566"></a>00566 <span class="comment"> */</span> +<a name="l00567"></a>00567 <span class="keyword">struct </span>libnet_gre_hdr +<a name="l00568"></a>00568 { +<a name="l00569"></a>00569 u_int16_t flags_ver; +<a name="l00570"></a>00570 <span class="preprocessor">#define GRE_CSUM 0x8000</span> +<a name="l00571"></a>00571 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ROUTING 0x4000</span> +<a name="l00572"></a>00572 <span class="preprocessor"></span><span class="preprocessor">#define GRE_KEY 0x2000</span> +<a name="l00573"></a>00573 <span class="preprocessor"></span><span class="preprocessor">#define GRE_SEQ 0x1000</span> +<a name="l00574"></a>00574 <span class="preprocessor"></span><span class="preprocessor">#define GRE_STRICT 0x0800</span> +<a name="l00575"></a>00575 <span class="preprocessor"></span><span class="preprocessor">#define GRE_REC 0x0700</span> +<a name="l00576"></a>00576 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ACK 0x0080</span> +<a name="l00577"></a>00577 <span class="preprocessor"></span> +<a name="l00578"></a>00578 <span class="preprocessor">#define GRE_FLAGS_MASK 0x00F8</span> +<a name="l00579"></a>00579 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VERSION_MASK 0x0007</span> +<a name="l00580"></a>00580 <span class="preprocessor"></span> +<a name="l00581"></a>00581 <span class="preprocessor">#define GRE_VERSION_0 0x0000</span> +<a name="l00582"></a>00582 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VERSION_1 0x0001</span> +<a name="l00583"></a>00583 <span class="preprocessor"></span> +<a name="l00584"></a>00584 u_int16_t type; +<a name="l00585"></a>00585 <span class="preprocessor">#define GRE_SNA 0x0004</span> +<a name="l00586"></a>00586 <span class="preprocessor"></span><span class="preprocessor">#define GRE_OSI_NETWORK_LAYER 0x00FE</span> +<a name="l00587"></a>00587 <span class="preprocessor"></span><span class="preprocessor">#define GRE_PUP 0x0200</span> +<a name="l00588"></a>00588 <span class="preprocessor"></span><span class="preprocessor">#define GRE_XNS 0x0600</span> +<a name="l00589"></a>00589 <span class="preprocessor"></span><span class="preprocessor">#define GRE_IP 0x0800</span> +<a name="l00590"></a>00590 <span class="preprocessor"></span><span class="preprocessor">#define GRE_CHAOS 0x0804</span> +<a name="l00591"></a>00591 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RFC_826_ARP 0x0806</span> +<a name="l00592"></a>00592 <span class="preprocessor"></span><span class="preprocessor">#define GRE_FRAME_RELAY_ARP 0x0808</span> +<a name="l00593"></a>00593 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES 0x0BAD</span> +<a name="l00594"></a>00594 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES_ECHO 0x0BAE</span> +<a name="l00595"></a>00595 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES_LOOPBACK 0x0BAF</span> +<a name="l00596"></a>00596 <span class="preprocessor"></span><span class="preprocessor">#define GRE_DECNET 0x6003</span> +<a name="l00597"></a>00597 <span class="preprocessor"></span><span class="preprocessor">#define GRE_TRANSPARENT_ETHERNET_BRIDGING 0x6558</span> +<a name="l00598"></a>00598 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RAW_FRAME_RELAY 0x6559</span> +<a name="l00599"></a>00599 <span class="preprocessor"></span><span class="preprocessor">#define GRE_APOLLO_DOMAIN 0x8019</span> +<a name="l00600"></a>00600 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ETHERTALK 0x809B</span> +<a name="l00601"></a>00601 <span class="preprocessor"></span><span class="preprocessor">#define GRE_NOVELL_IPX 0x8137</span> +<a name="l00602"></a>00602 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RFC_1144_TCP_IP_COMPRESSION 0x876B</span> +<a name="l00603"></a>00603 <span class="preprocessor"></span><span class="preprocessor">#define GRE_IP_AUTONOMOUS_SYSTEMS 0x876C</span> +<a name="l00604"></a>00604 <span class="preprocessor"></span><span class="preprocessor">#define GRE_SECURE_DATA 0x876D</span> +<a name="l00605"></a>00605 <span class="preprocessor"></span><span class="preprocessor">#define GRE_PPP 0x880b </span><span class="comment">/* taken from RFC 2637 */</span> +<a name="l00606"></a>00606 +<a name="l00607"></a>00607 <span class="keyword">union </span>{ +<a name="l00608"></a>00608 <span class="keyword">struct </span>{ +<a name="l00609"></a>00609 u_int16_t sum; <span class="comment">/* optional */</span> +<a name="l00610"></a>00610 u_int16_t offset; <span class="comment">/* optional */</span> +<a name="l00611"></a>00611 u_int32_t key; <span class="comment">/* optional */</span> +<a name="l00612"></a>00612 u_int32_t seq; <span class="comment">/* optional */</span> +<a name="l00613"></a>00613 } _gre; +<a name="l00614"></a>00614 +<a name="l00615"></a>00615 <span class="keyword">struct </span>{ +<a name="l00616"></a>00616 u_int16_t payload_s; <span class="comment">/* optional */</span> +<a name="l00617"></a>00617 u_int16_t callID; <span class="comment">/* optional */</span> +<a name="l00618"></a>00618 u_int32_t seq; <span class="comment">/* optional */</span> +<a name="l00619"></a>00619 u_int32_t ack; <span class="comment">/* optional */</span> +<a name="l00620"></a>00620 } _egre; +<a name="l00621"></a>00621 }_data; +<a name="l00622"></a>00622 +<a name="l00623"></a>00623 <span class="preprocessor">#define gre_sum _data._gre.sum</span> +<a name="l00624"></a>00624 <span class="preprocessor"></span><span class="preprocessor">#define gre_offset _data._gre.offset</span> +<a name="l00625"></a>00625 <span class="preprocessor"></span><span class="preprocessor">#define gre_key _data._gre.key</span> +<a name="l00626"></a>00626 <span class="preprocessor"></span><span class="preprocessor">#define gre_seq _data._gre.seq</span> +<a name="l00627"></a>00627 <span class="preprocessor"></span> +<a name="l00628"></a>00628 <span class="preprocessor">#define egre_payload_s _data._egre.payload_s</span> +<a name="l00629"></a>00629 <span class="preprocessor"></span><span class="preprocessor">#define egre_callID _data._egre.callID</span> +<a name="l00630"></a>00630 <span class="preprocessor"></span><span class="preprocessor">#define egre_seq _data._egre.seq</span> +<a name="l00631"></a>00631 <span class="preprocessor"></span><span class="preprocessor">#define egre_ack _data._egre.ack</span> +<a name="l00632"></a>00632 <span class="preprocessor"></span>}; +<a name="l00633"></a>00633 +<a name="l00634"></a>00634 +<a name="l00635"></a>00635 <span class="preprocessor">#ifndef IPPROTO_GRE</span> +<a name="l00636"></a>00636 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_GRE 47</span> +<a name="l00637"></a>00637 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00638"></a>00638 <span class="preprocessor"></span> +<a name="l00639"></a>00639 <span class="comment">/*</span> +<a name="l00640"></a>00640 <span class="comment"> * Source Route Entries (SRE)</span> +<a name="l00641"></a>00641 <span class="comment"> * This is used for GRE as the Routing field is a list of SREs - RFC 1701</span> +<a name="l00642"></a>00642 <span class="comment"> * Base header size: 4 bytes</span> +<a name="l00643"></a>00643 <span class="comment"> */</span> +<a name="l00644"></a>00644 <span class="keyword">struct </span>libnet_gre_sre_hdr +<a name="l00645"></a>00645 { +<a name="l00646"></a>00646 u_int16_t af; <span class="comment">/* address familly */</span> +<a name="l00647"></a>00647 u_int8_t sre_offset; +<a name="l00648"></a>00648 u_int8_t sre_length; +<a name="l00649"></a>00649 u_int8_t *routing; +<a name="l00650"></a>00650 }; +<a name="l00651"></a>00651 +<a name="l00652"></a>00652 +<a name="l00653"></a>00653 <span class="comment">/*</span> +<a name="l00654"></a>00654 <span class="comment"> * IPv4 header</span> +<a name="l00655"></a>00655 <span class="comment"> * Internet Protocol, version 4</span> +<a name="l00656"></a>00656 <span class="comment"> * Static header size: 20 bytes</span> +<a name="l00657"></a>00657 <span class="comment"> */</span> +<a name="l00658"></a>00658 <span class="keyword">struct </span>libnet_ipv4_hdr +<a name="l00659"></a>00659 { +<a name="l00660"></a>00660 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span> +<a name="l00661"></a>00661 <span class="preprocessor"></span> u_int8_t ip_hl:4, <span class="comment">/* header length */</span> +<a name="l00662"></a>00662 ip_v:4; <span class="comment">/* version */</span> +<a name="l00663"></a>00663 <span class="preprocessor">#endif</span> +<a name="l00664"></a>00664 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span> +<a name="l00665"></a>00665 <span class="preprocessor"></span> u_int8_t ip_v:4, <span class="comment">/* version */</span> +<a name="l00666"></a>00666 ip_hl:4; <span class="comment">/* header length */</span> +<a name="l00667"></a>00667 <span class="preprocessor">#endif</span> +<a name="l00668"></a>00668 <span class="preprocessor"></span> u_int8_t ip_tos; <span class="comment">/* type of service */</span> +<a name="l00669"></a>00669 <span class="preprocessor">#ifndef IPTOS_LOWDELAY</span> +<a name="l00670"></a>00670 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_LOWDELAY 0x10</span> +<a name="l00671"></a>00671 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00672"></a>00672 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_THROUGHPUT</span> +<a name="l00673"></a>00673 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_THROUGHPUT 0x08</span> +<a name="l00674"></a>00674 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00675"></a>00675 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_RELIABILITY</span> +<a name="l00676"></a>00676 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_RELIABILITY 0x04</span> +<a name="l00677"></a>00677 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00678"></a>00678 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_LOWCOST</span> +<a name="l00679"></a>00679 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_LOWCOST 0x02</span> +<a name="l00680"></a>00680 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00681"></a>00681 <span class="preprocessor"></span> u_int16_t ip_len; <span class="comment">/* total length */</span> +<a name="l00682"></a>00682 u_int16_t ip_id; <span class="comment">/* identification */</span> +<a name="l00683"></a>00683 u_int16_t ip_off; +<a name="l00684"></a>00684 <span class="preprocessor">#ifndef IP_RF</span> +<a name="l00685"></a>00685 <span class="preprocessor"></span><span class="preprocessor">#define IP_RF 0x8000 </span><span class="comment">/* reserved fragment flag */</span> +<a name="l00686"></a>00686 <span class="preprocessor">#endif</span> +<a name="l00687"></a>00687 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_DF</span> +<a name="l00688"></a>00688 <span class="preprocessor"></span><span class="preprocessor">#define IP_DF 0x4000 </span><span class="comment">/* dont fragment flag */</span> +<a name="l00689"></a>00689 <span class="preprocessor">#endif</span> +<a name="l00690"></a>00690 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_MF</span> +<a name="l00691"></a>00691 <span class="preprocessor"></span><span class="preprocessor">#define IP_MF 0x2000 </span><span class="comment">/* more fragments flag */</span> +<a name="l00692"></a>00692 <span class="preprocessor">#endif </span> +<a name="l00693"></a>00693 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_OFFMASK</span> +<a name="l00694"></a>00694 <span class="preprocessor"></span><span class="preprocessor">#define IP_OFFMASK 0x1fff </span><span class="comment">/* mask for fragmenting bits */</span> +<a name="l00695"></a>00695 <span class="preprocessor">#endif</span> +<a name="l00696"></a>00696 <span class="preprocessor"></span> u_int8_t ip_ttl; <span class="comment">/* time to live */</span> +<a name="l00697"></a>00697 u_int8_t ip_p; <span class="comment">/* protocol */</span> +<a name="l00698"></a>00698 u_int16_t ip_sum; <span class="comment">/* checksum */</span> +<a name="l00699"></a>00699 <span class="keyword">struct </span>in_addr ip_src, ip_dst; <span class="comment">/* source and dest address */</span> +<a name="l00700"></a>00700 }; +<a name="l00701"></a>00701 +<a name="l00702"></a>00702 <span class="comment">/*</span> +<a name="l00703"></a>00703 <span class="comment"> * IP options</span> +<a name="l00704"></a>00704 <span class="comment"> */</span> +<a name="l00705"></a>00705 <span class="preprocessor">#ifndef IPOPT_EOL</span> +<a name="l00706"></a>00706 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_EOL 0 </span><span class="comment">/* end of option list */</span> +<a name="l00707"></a>00707 <span class="preprocessor">#endif</span> +<a name="l00708"></a>00708 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_NOP</span> +<a name="l00709"></a>00709 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_NOP 1 </span><span class="comment">/* no operation */</span> +<a name="l00710"></a>00710 <span class="preprocessor">#endif </span> +<a name="l00711"></a>00711 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_RR</span> +<a name="l00712"></a>00712 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_RR 7 </span><span class="comment">/* record packet route */</span> +<a name="l00713"></a>00713 <span class="preprocessor">#endif</span> +<a name="l00714"></a>00714 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_TS</span> +<a name="l00715"></a>00715 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_TS 68 </span><span class="comment">/* timestamp */</span> +<a name="l00716"></a>00716 <span class="preprocessor">#endif</span> +<a name="l00717"></a>00717 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SECURITY</span> +<a name="l00718"></a>00718 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SECURITY 130 </span><span class="comment">/* provide s,c,h,tcc */</span> +<a name="l00719"></a>00719 <span class="preprocessor">#endif</span> +<a name="l00720"></a>00720 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_LSRR</span> +<a name="l00721"></a>00721 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_LSRR 131 </span><span class="comment">/* loose source route */</span> +<a name="l00722"></a>00722 <span class="preprocessor">#endif</span> +<a name="l00723"></a>00723 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SATID</span> +<a name="l00724"></a>00724 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SATID 136 </span><span class="comment">/* satnet id */</span> +<a name="l00725"></a>00725 <span class="preprocessor">#endif</span> +<a name="l00726"></a>00726 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SSRR</span> +<a name="l00727"></a>00727 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SSRR 137 </span><span class="comment">/* strict source route */</span> +<a name="l00728"></a>00728 <span class="preprocessor">#endif</span> +<a name="l00729"></a>00729 <span class="preprocessor"></span> +<a name="l00730"></a>00730 <span class="comment">/*</span> +<a name="l00731"></a>00731 <span class="comment"> * IPv6 address</span> +<a name="l00732"></a>00732 <span class="comment"> */</span> +<a name="l00733"></a>00733 <span class="keyword">struct </span>libnet_in6_addr +<a name="l00734"></a>00734 { +<a name="l00735"></a>00735 <span class="keyword">union</span> +<a name="l00736"></a>00736 { +<a name="l00737"></a>00737 u_int8_t __u6_addr8[16]; +<a name="l00738"></a>00738 u_int16_t __u6_addr16[8]; +<a name="l00739"></a>00739 u_int32_t __u6_addr32[4]; +<a name="l00740"></a>00740 } __u6_addr; <span class="comment">/* 128-bit IP6 address */</span> +<a name="l00741"></a>00741 }; +<a name="l00742"></a>00742 <span class="preprocessor">#define libnet_s6_addr __u6_addr.__u6_addr8</span> +<a name="l00743"></a>00743 <span class="preprocessor"></span> +<a name="l00744"></a>00744 <span class="comment">/*</span> +<a name="l00745"></a>00745 <span class="comment"> * IPv6 header</span> +<a name="l00746"></a>00746 <span class="comment"> * Internet Protocol, version 6</span> +<a name="l00747"></a>00747 <span class="comment"> * Static header size: 40 bytes</span> +<a name="l00748"></a>00748 <span class="comment"> */</span> +<a name="l00749"></a>00749 <span class="keyword">struct </span>libnet_ipv6_hdr +<a name="l00750"></a>00750 { +<a name="l00751"></a>00751 u_int8_t ip_flags[4]; <span class="comment">/* version, traffic class, flow label */</span> +<a name="l00752"></a>00752 u_int16_t ip_len; <span class="comment">/* total length */</span> +<a name="l00753"></a>00753 u_int8_t ip_nh; <span class="comment">/* next header */</span> +<a name="l00754"></a>00754 u_int8_t ip_hl; <span class="comment">/* hop limit */</span> +<a name="l00755"></a>00755 <span class="keyword">struct </span>libnet_in6_addr ip_src, ip_dst; <span class="comment">/* source and dest address */</span> +<a name="l00756"></a>00756 +<a name="l00757"></a>00757 }; +<a name="l00758"></a>00758 +<a name="l00759"></a>00759 <span class="comment">/*</span> +<a name="l00760"></a>00760 <span class="comment"> * IPv6 frag header</span> +<a name="l00761"></a>00761 <span class="comment"> * Internet Protocol, version 6</span> +<a name="l00762"></a>00762 <span class="comment"> * Static header size: 8 bytes</span> +<a name="l00763"></a>00763 <span class="comment"> */</span> +<a name="l00764"></a>00764 <span class="preprocessor">#define LIBNET_IPV6_NH_FRAGMENT 44</span> +<a name="l00765"></a>00765 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_frag_hdr +<a name="l00766"></a>00766 { +<a name="l00767"></a>00767 u_int8_t ip_nh; <span class="comment">/* next header */</span> +<a name="l00768"></a>00768 u_int8_t ip_reserved; <span class="comment">/* reserved */</span> +<a name="l00769"></a>00769 u_int16_t ip_frag; <span class="comment">/* fragmentation stuff */</span> +<a name="l00770"></a>00770 u_int32_t ip_id; <span class="comment">/* id */</span> +<a name="l00771"></a>00771 }; +<a name="l00772"></a>00772 +<a name="l00773"></a>00773 <span class="comment">/*</span> +<a name="l00774"></a>00774 <span class="comment"> * IPv6 routing header</span> +<a name="l00775"></a>00775 <span class="comment"> * Internet Protocol, version 6</span> +<a name="l00776"></a>00776 <span class="comment"> * Base header size: 4 bytes</span> +<a name="l00777"></a>00777 <span class="comment"> */</span> +<a name="l00778"></a>00778 <span class="preprocessor">#define LIBNET_IPV6_NH_ROUTING 43</span> +<a name="l00779"></a>00779 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_routing_hdr +<a name="l00780"></a>00780 { +<a name="l00781"></a>00781 u_int8_t ip_nh; <span class="comment">/* next header */</span> +<a name="l00782"></a>00782 u_int8_t ip_len; <span class="comment">/* length of header in 8 octet units (sans 1st) */</span> +<a name="l00783"></a>00783 u_int8_t ip_rtype; <span class="comment">/* routing type */</span> +<a name="l00784"></a>00784 u_int8_t ip_segments; <span class="comment">/* segments left */</span> +<a name="l00785"></a>00785 <span class="comment">/* routing information allocated dynamically */</span> +<a name="l00786"></a>00786 }; +<a name="l00787"></a>00787 +<a name="l00788"></a>00788 <span class="comment">/*</span> +<a name="l00789"></a>00789 <span class="comment"> * IPv6 destination options header</span> +<a name="l00790"></a>00790 <span class="comment"> * Internet Protocol, version 6</span> +<a name="l00791"></a>00791 <span class="comment"> * Base header size: 2 bytes</span> +<a name="l00792"></a>00792 <span class="comment"> */</span> +<a name="l00793"></a>00793 <span class="preprocessor">#define LIBNET_IPV6_NH_DESTOPTS 60</span> +<a name="l00794"></a>00794 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_destopts_hdr +<a name="l00795"></a>00795 { +<a name="l00796"></a>00796 u_int8_t ip_nh; <span class="comment">/* next header */</span> +<a name="l00797"></a>00797 u_int8_t ip_len; <span class="comment">/* length of header in 8 octet units (sans 1st) */</span> +<a name="l00798"></a>00798 <span class="comment">/* destination options information allocated dynamically */</span> +<a name="l00799"></a>00799 }; +<a name="l00800"></a>00800 +<a name="l00801"></a>00801 <span class="comment">/*</span> +<a name="l00802"></a>00802 <span class="comment"> * IPv6 hop by hop options header</span> +<a name="l00803"></a>00803 <span class="comment"> * Internet Protocol, version 6</span> +<a name="l00804"></a>00804 <span class="comment"> * Base header size: 2 bytes</span> +<a name="l00805"></a>00805 <span class="comment"> */</span> +<a name="l00806"></a>00806 <span class="preprocessor">#define LIBNET_IPV6_NH_HBH 0</span> +<a name="l00807"></a>00807 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_hbhopts_hdr +<a name="l00808"></a>00808 { +<a name="l00809"></a>00809 u_int8_t ip_nh; <span class="comment">/* next header */</span> +<a name="l00810"></a>00810 u_int8_t ip_len; <span class="comment">/* length of header in 8 octet units (sans 1st) */</span> +<a name="l00811"></a>00811 <span class="comment">/* destination options information allocated dynamically */</span> +<a name="l00812"></a>00812 }; +<a name="l00813"></a>00813 +<a name="l00814"></a>00814 <span class="comment">/*</span> +<a name="l00815"></a>00815 <span class="comment"> * ICMP6 header</span> +<a name="l00816"></a>00816 <span class="comment"> * Internet Control Message Protocol v6</span> +<a name="l00817"></a>00817 <span class="comment"> * Base header size: 8 bytes</span> +<a name="l00818"></a>00818 <span class="comment"> */</span> +<a name="l00819"></a>00819 <span class="preprocessor">#ifndef IPPROTO_ICMP6</span> +<a name="l00820"></a>00820 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_ICMP6 0x3a</span> +<a name="l00821"></a>00821 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00822"></a>00822 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_icmpv6_hdr +<a name="l00823"></a>00823 { +<a name="l00824"></a>00824 u_int8_t icmp_type; <span class="comment">/* ICMP type */</span> +<a name="l00825"></a>00825 <span class="preprocessor">#ifndef ICMP6_ECHO</span> +<a name="l00826"></a>00826 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_ECHO 128</span> +<a name="l00827"></a>00827 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00828"></a>00828 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_ECHOREPLY</span> +<a name="l00829"></a>00829 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_ECHOREPLY 129</span> +<a name="l00830"></a>00830 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00831"></a>00831 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_UNREACH</span> +<a name="l00832"></a>00832 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_UNREACH 1</span> +<a name="l00833"></a>00833 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00834"></a>00834 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_PKTTOOBIG</span> +<a name="l00835"></a>00835 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_PKTTOOBIG 2</span> +<a name="l00836"></a>00836 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00837"></a>00837 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_TIMXCEED</span> +<a name="l00838"></a>00838 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_TIMXCEED 3</span> +<a name="l00839"></a>00839 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00840"></a>00840 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_PARAMPROB</span> +<a name="l00841"></a>00841 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_PARAMPROB 4</span> +<a name="l00842"></a>00842 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00843"></a>00843 <span class="preprocessor"></span> u_int8_t icmp_code; <span class="comment">/* ICMP code */</span> +<a name="l00844"></a>00844 u_int16_t icmp_sum; <span class="comment">/* ICMP Checksum */</span> +<a name="l00845"></a>00845 u_int16_t id; <span class="comment">/* ICMP id */</span> +<a name="l00846"></a>00846 u_int16_t seq; <span class="comment">/* ICMP sequence number */</span> +<a name="l00847"></a>00847 }; +<a name="l00848"></a>00848 +<a name="l00849"></a>00849 +<a name="l00850"></a>00850 +<a name="l00851"></a>00851 <span class="comment">/*</span> +<a name="l00852"></a>00852 <span class="comment"> * ICMP header</span> +<a name="l00853"></a>00853 <span class="comment"> * Internet Control Message Protocol</span> +<a name="l00854"></a>00854 <span class="comment"> * Base header size: 4 bytes</span> +<a name="l00855"></a>00855 <span class="comment"> */</span> +<a name="l00856"></a>00856 <span class="keyword">struct </span>libnet_icmpv4_hdr +<a name="l00857"></a>00857 { +<a name="l00858"></a>00858 u_int8_t icmp_type; <span class="comment">/* ICMP type */</span> +<a name="l00859"></a>00859 <span class="preprocessor">#ifndef ICMP_ECHOREPLY</span> +<a name="l00860"></a>00860 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_ECHOREPLY 0</span> +<a name="l00861"></a>00861 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00862"></a>00862 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH</span> +<a name="l00863"></a>00863 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH 3</span> +<a name="l00864"></a>00864 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00865"></a>00865 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_SOURCEQUENCH</span> +<a name="l00866"></a>00866 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_SOURCEQUENCH 4</span> +<a name="l00867"></a>00867 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00868"></a>00868 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT</span> +<a name="l00869"></a>00869 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT 5</span> +<a name="l00870"></a>00870 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00871"></a>00871 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_ECHO</span> +<a name="l00872"></a>00872 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_ECHO 8</span> +<a name="l00873"></a>00873 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00874"></a>00874 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_ROUTERADVERT</span> +<a name="l00875"></a>00875 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_ROUTERADVERT 9</span> +<a name="l00876"></a>00876 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00877"></a>00877 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_ROUTERSOLICIT</span> +<a name="l00878"></a>00878 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_ROUTERSOLICIT 10</span> +<a name="l00879"></a>00879 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00880"></a>00880 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TIMXCEED</span> +<a name="l00881"></a>00881 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TIMXCEED 11</span> +<a name="l00882"></a>00882 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00883"></a>00883 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_PARAMPROB</span> +<a name="l00884"></a>00884 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_PARAMPROB 12</span> +<a name="l00885"></a>00885 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00886"></a>00886 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TSTAMP</span> +<a name="l00887"></a>00887 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TSTAMP 13</span> +<a name="l00888"></a>00888 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00889"></a>00889 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TSTAMPREPLY</span> +<a name="l00890"></a>00890 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TSTAMPREPLY 14</span> +<a name="l00891"></a>00891 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00892"></a>00892 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_IREQ</span> +<a name="l00893"></a>00893 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_IREQ 15</span> +<a name="l00894"></a>00894 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00895"></a>00895 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_IREQREPLY</span> +<a name="l00896"></a>00896 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_IREQREPLY 16</span> +<a name="l00897"></a>00897 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00898"></a>00898 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_MASKREQ</span> +<a name="l00899"></a>00899 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_MASKREQ 17</span> +<a name="l00900"></a>00900 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00901"></a>00901 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_MASKREPLY</span> +<a name="l00902"></a>00902 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_MASKREPLY 18</span> +<a name="l00903"></a>00903 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00904"></a>00904 <span class="preprocessor"></span> u_int8_t icmp_code; <span class="comment">/* ICMP code */</span> +<a name="l00905"></a>00905 <span class="preprocessor">#ifndef ICMP_UNREACH_NET</span> +<a name="l00906"></a>00906 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_NET 0</span> +<a name="l00907"></a>00907 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00908"></a>00908 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_HOST</span> +<a name="l00909"></a>00909 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_HOST 1</span> +<a name="l00910"></a>00910 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00911"></a>00911 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_PROTOCOL</span> +<a name="l00912"></a>00912 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_PROTOCOL 2</span> +<a name="l00913"></a>00913 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00914"></a>00914 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_PORT</span> +<a name="l00915"></a>00915 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_PORT 3</span> +<a name="l00916"></a>00916 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00917"></a>00917 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_NEEDFRAG</span> +<a name="l00918"></a>00918 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_NEEDFRAG 4</span> +<a name="l00919"></a>00919 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00920"></a>00920 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_SRCFAIL</span> +<a name="l00921"></a>00921 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_SRCFAIL 5</span> +<a name="l00922"></a>00922 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00923"></a>00923 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_NET_UNKNOWN</span> +<a name="l00924"></a>00924 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_NET_UNKNOWN 6</span> +<a name="l00925"></a>00925 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00926"></a>00926 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_HOST_UNKNOWN</span> +<a name="l00927"></a>00927 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_HOST_UNKNOWN 7</span> +<a name="l00928"></a>00928 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00929"></a>00929 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_ISOLATED</span> +<a name="l00930"></a>00930 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_ISOLATED 8</span> +<a name="l00931"></a>00931 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00932"></a>00932 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_NET_PROHIB</span> +<a name="l00933"></a>00933 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_NET_PROHIB 9</span> +<a name="l00934"></a>00934 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00935"></a>00935 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_HOST_PROHIB</span> +<a name="l00936"></a>00936 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_HOST_PROHIB 10</span> +<a name="l00937"></a>00937 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00938"></a>00938 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_TOSNET</span> +<a name="l00939"></a>00939 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_TOSNET 11</span> +<a name="l00940"></a>00940 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00941"></a>00941 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_TOSHOST</span> +<a name="l00942"></a>00942 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_TOSHOST 12</span> +<a name="l00943"></a>00943 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00944"></a>00944 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_FILTER_PROHIB</span> +<a name="l00945"></a>00945 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_FILTER_PROHIB 13</span> +<a name="l00946"></a>00946 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00947"></a>00947 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_HOST_PRECEDENCE</span> +<a name="l00948"></a>00948 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_HOST_PRECEDENCE 14</span> +<a name="l00949"></a>00949 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00950"></a>00950 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF</span> +<a name="l00951"></a>00951 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15</span> +<a name="l00952"></a>00952 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00953"></a>00953 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT_NET</span> +<a name="l00954"></a>00954 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT_NET 0</span> +<a name="l00955"></a>00955 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00956"></a>00956 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT_HOST</span> +<a name="l00957"></a>00957 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT_HOST 1</span> +<a name="l00958"></a>00958 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00959"></a>00959 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT_TOSNET</span> +<a name="l00960"></a>00960 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT_TOSNET 2</span> +<a name="l00961"></a>00961 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00962"></a>00962 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT_TOSHOST</span> +<a name="l00963"></a>00963 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT_TOSHOST 3</span> +<a name="l00964"></a>00964 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00965"></a>00965 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TIMXCEED_INTRANS</span> +<a name="l00966"></a>00966 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TIMXCEED_INTRANS 0</span> +<a name="l00967"></a>00967 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00968"></a>00968 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TIMXCEED_REASS</span> +<a name="l00969"></a>00969 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TIMXCEED_REASS 1</span> +<a name="l00970"></a>00970 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00971"></a>00971 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_PARAMPROB_OPTABSENT</span> +<a name="l00972"></a>00972 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_PARAMPROB_OPTABSENT 1</span> +<a name="l00973"></a>00973 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00974"></a>00974 <span class="preprocessor"></span> +<a name="l00975"></a>00975 u_int16_t icmp_sum; <span class="comment">/* ICMP Checksum */</span> +<a name="l00976"></a>00976 +<a name="l00977"></a>00977 <span class="keyword">union</span> +<a name="l00978"></a>00978 { +<a name="l00979"></a>00979 <span class="keyword">struct</span> +<a name="l00980"></a>00980 { +<a name="l00981"></a>00981 u_int16_t id; <span class="comment">/* ICMP id */</span> +<a name="l00982"></a>00982 u_int16_t seq;<span class="comment">/* ICMP sequence number */</span> +<a name="l00983"></a>00983 } echo; +<a name="l00984"></a>00984 +<a name="l00985"></a>00985 <span class="preprocessor">#undef icmp_id</span> +<a name="l00986"></a>00986 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_seq</span> +<a name="l00987"></a>00987 <span class="preprocessor"></span><span class="preprocessor">#define icmp_id hun.echo.id</span> +<a name="l00988"></a>00988 <span class="preprocessor"></span><span class="preprocessor">#define icmp_seq hun.echo.seq</span> +<a name="l00989"></a>00989 <span class="preprocessor"></span> +<a name="l00990"></a>00990 u_int32_t gateway; <span class="comment">/* gateway host */</span> +<a name="l00991"></a>00991 <span class="keyword">struct</span> +<a name="l00992"></a>00992 { +<a name="l00993"></a>00993 u_int16_t pad;<span class="comment">/* padding */</span> +<a name="l00994"></a>00994 u_int16_t mtu;<span class="comment">/* MTU size */</span> +<a name="l00995"></a>00995 } frag; +<a name="l00996"></a>00996 } hun; +<a name="l00997"></a>00997 <span class="keyword">union</span> +<a name="l00998"></a>00998 { +<a name="l00999"></a>00999 <span class="keyword">struct</span> +<a name="l01000"></a>01000 { +<a name="l01001"></a>01001 n_time its_otime; +<a name="l01002"></a>01002 n_time its_rtime; +<a name="l01003"></a>01003 n_time its_ttime; +<a name="l01004"></a>01004 } ts; +<a name="l01005"></a>01005 <span class="keyword">struct</span> +<a name="l01006"></a>01006 { +<a name="l01007"></a>01007 <span class="keyword">struct </span>libnet_ipv4_hdr idi_ip; +<a name="l01008"></a>01008 <span class="comment">/* options and then 64 bits of data */</span> +<a name="l01009"></a>01009 } ip; +<a name="l01010"></a>01010 u_int32_t mask; +<a name="l01011"></a>01011 int8_t data[1]; +<a name="l01012"></a>01012 +<a name="l01013"></a>01013 <span class="preprocessor">#undef icmp_mask</span> +<a name="l01014"></a>01014 <span class="preprocessor"></span><span class="preprocessor">#define icmp_mask dun.mask</span> +<a name="l01015"></a>01015 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_data</span> +<a name="l01016"></a>01016 <span class="preprocessor"></span><span class="preprocessor">#define icmp_data dun.data</span> +<a name="l01017"></a>01017 <span class="preprocessor"></span> +<a name="l01018"></a>01018 <span class="preprocessor">#undef icmp_otime</span> +<a name="l01019"></a>01019 <span class="preprocessor"></span><span class="preprocessor">#define icmp_otime dun.ts.its_otime</span> +<a name="l01020"></a>01020 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_rtime</span> +<a name="l01021"></a>01021 <span class="preprocessor"></span><span class="preprocessor">#define icmp_rtime dun.ts.its_rtime</span> +<a name="l01022"></a>01022 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_ttime</span> +<a name="l01023"></a>01023 <span class="preprocessor"></span><span class="preprocessor">#define icmp_ttime dun.ts.its_ttime</span> +<a name="l01024"></a>01024 <span class="preprocessor"></span> }dun; +<a name="l01025"></a>01025 }; +<a name="l01026"></a>01026 +<a name="l01027"></a>01027 +<a name="l01028"></a>01028 <span class="comment">/*</span> +<a name="l01029"></a>01029 <span class="comment"> * IGMP header</span> +<a name="l01030"></a>01030 <span class="comment"> * Internet Group Message Protocol</span> +<a name="l01031"></a>01031 <span class="comment"> * Static header size: 8 bytes</span> +<a name="l01032"></a>01032 <span class="comment"> */</span> +<a name="l01033"></a>01033 <span class="keyword">struct </span>libnet_igmp_hdr +<a name="l01034"></a>01034 { +<a name="l01035"></a>01035 u_int8_t igmp_type; <span class="comment">/* IGMP type */</span> +<a name="l01036"></a>01036 <span class="preprocessor">#ifndef IGMP_MEMBERSHIP_QUERY</span> +<a name="l01037"></a>01037 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_MEMBERSHIP_QUERY 0x11 </span><span class="comment">/* membership query */</span> +<a name="l01038"></a>01038 <span class="preprocessor">#endif</span> +<a name="l01039"></a>01039 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_V1_MEMBERSHIP_REPORT</span> +<a name="l01040"></a>01040 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_V1_MEMBERSHIP_REPORT 0x12 </span><span class="comment">/* Ver. 1 membership report */</span> +<a name="l01041"></a>01041 <span class="preprocessor">#endif</span> +<a name="l01042"></a>01042 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_V2_MEMBERSHIP_REPORT</span> +<a name="l01043"></a>01043 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_V2_MEMBERSHIP_REPORT 0x16 </span><span class="comment">/* Ver. 2 membership report */</span> +<a name="l01044"></a>01044 <span class="preprocessor">#endif</span> +<a name="l01045"></a>01045 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_LEAVE_GROUP</span> +<a name="l01046"></a>01046 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_LEAVE_GROUP 0x17 </span><span class="comment">/* Leave-group message */</span> +<a name="l01047"></a>01047 <span class="preprocessor">#endif</span> +<a name="l01048"></a>01048 <span class="preprocessor"></span> u_int8_t igmp_code; <span class="comment">/* IGMP code */</span> +<a name="l01049"></a>01049 u_int16_t igmp_sum; <span class="comment">/* IGMP checksum */</span> +<a name="l01050"></a>01050 <span class="keyword">struct </span>in_addr igmp_group;<span class="comment">/* IGMP host IP */</span> +<a name="l01051"></a>01051 }; +<a name="l01052"></a>01052 +<a name="l01053"></a>01053 +<a name="l01054"></a>01054 <span class="comment">/*</span> +<a name="l01055"></a>01055 <span class="comment"> * IPSEC header</span> +<a name="l01056"></a>01056 <span class="comment"> * Internet Protocol Security Protocol</span> +<a name="l01057"></a>01057 <span class="comment"> * Encapsulating Security Payload Header Static header size: 12 bytes</span> +<a name="l01058"></a>01058 <span class="comment"> * Encapsulating Security Payload Footer Base header size: 2 bytes</span> +<a name="l01059"></a>01059 <span class="comment"> * Authentication Header Static Size: 16 bytes</span> +<a name="l01060"></a>01060 <span class="comment"> */</span> +<a name="l01061"></a>01061 <span class="preprocessor">#ifndef IPPROTO_ESP</span> +<a name="l01062"></a>01062 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_ESP 50 </span><span class="comment">/* not everyone's got this */</span> +<a name="l01063"></a>01063 <span class="preprocessor">#endif</span> +<a name="l01064"></a>01064 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_esp_hdr +<a name="l01065"></a>01065 { +<a name="l01066"></a>01066 u_int32_t esp_spi; <span class="comment">/* security parameter index */</span> +<a name="l01067"></a>01067 u_int32_t esp_seq; <span class="comment">/* ESP sequence number */</span> +<a name="l01068"></a>01068 u_int32_t esp_iv; <span class="comment">/* initialization vector */</span> +<a name="l01069"></a>01069 }; +<a name="l01070"></a>01070 +<a name="l01071"></a>01071 <span class="keyword">struct </span>libnet_esp_ftr +<a name="l01072"></a>01072 { +<a name="l01073"></a>01073 u_int8_t esp_pad_len; <span class="comment">/* padding length */</span> +<a name="l01074"></a>01074 u_int8_t esp_nh; <span class="comment">/* next header pointer */</span> +<a name="l01075"></a>01075 int8_t *esp_auth; <span class="comment">/* authentication data */</span> +<a name="l01076"></a>01076 }; +<a name="l01077"></a>01077 +<a name="l01078"></a>01078 <span class="preprocessor">#ifndef IPPROTO_AH</span> +<a name="l01079"></a>01079 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_AH 51 </span><span class="comment">/* not everyone's got this */</span> +<a name="l01080"></a>01080 <span class="preprocessor">#endif</span> +<a name="l01081"></a>01081 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ah_hdr +<a name="l01082"></a>01082 { +<a name="l01083"></a>01083 u_int8_t ah_nh; <span class="comment">/* next header */</span> +<a name="l01084"></a>01084 u_int8_t ah_len; <span class="comment">/* payload length */</span> +<a name="l01085"></a>01085 u_int16_t ah_res; <span class="comment">/* reserved */</span> +<a name="l01086"></a>01086 u_int32_t ah_spi; <span class="comment">/* security parameter index */</span> +<a name="l01087"></a>01087 u_int32_t ah_seq; <span class="comment">/* AH sequence number */</span> +<a name="l01088"></a>01088 u_int32_t ah_auth; <span class="comment">/* authentication data */</span> +<a name="l01089"></a>01089 }; +<a name="l01090"></a>01090 +<a name="l01091"></a>01091 +<a name="l01092"></a>01092 <span class="comment">/*</span> +<a name="l01093"></a>01093 <span class="comment"> * For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001.</span> +<a name="l01094"></a>01094 <span class="comment"> * Let's hope this one stays that way for a while!</span> +<a name="l01095"></a>01095 <span class="comment"> */</span> +<a name="l01096"></a>01096 <span class="preprocessor">#define LIBNET_PROTO_ISL 201</span> +<a name="l01097"></a>01097 <span class="preprocessor"></span><span class="comment">/*</span> +<a name="l01098"></a>01098 <span class="comment"> * ISL header</span> +<a name="l01099"></a>01099 <span class="comment"> * Cisco Inter-Switch Link</span> +<a name="l01100"></a>01100 <span class="comment"> * Static header size: 26 bytes</span> +<a name="l01101"></a>01101 <span class="comment"> */</span> +<a name="l01102"></a>01102 <span class="keyword">struct </span>libnet_isl_hdr +<a name="l01103"></a>01103 { +<a name="l01104"></a>01104 u_int8_t isl_dhost[5]; <span class="comment">/* destination address "01:00:0c:00:00" */</span> +<a name="l01105"></a>01105 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span> +<a name="l01106"></a>01106 <span class="preprocessor"></span> u_int8_t isl_type:4, <span class="comment">/* type of frame */</span> +<a name="l01107"></a>01107 isl_user:4; <span class="comment">/* user defined bits */</span> +<a name="l01108"></a>01108 <span class="preprocessor">#endif</span> +<a name="l01109"></a>01109 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span> +<a name="l01110"></a>01110 <span class="preprocessor"></span> u_int8_t isl_user:4, <span class="comment">/* user defined bits */</span> +<a name="l01111"></a>01111 isl_type:4; <span class="comment">/* type of frame */</span> +<a name="l01112"></a>01112 <span class="preprocessor">#endif</span> +<a name="l01113"></a>01113 <span class="preprocessor"></span> u_int8_t isl_shost[6]; <span class="comment">/* source address */</span> +<a name="l01114"></a>01114 u_int16_t isl_len; <span class="comment">/* total length of packet - 18 bytes */</span> +<a name="l01115"></a>01115 u_int8_t isl_snap[6]; <span class="comment">/* 0xaaaa03 + vendor code */</span> +<a name="l01116"></a>01116 u_int16_t isl_vid; <span class="comment">/* 15 bit VLAN ID, 1 bit BPDU / CDP indicator */</span> +<a name="l01117"></a>01117 u_int16_t isl_index; <span class="comment">/* port index */</span> +<a name="l01118"></a>01118 u_int16_t isl_reserved; <span class="comment">/* used for FDDI and token ring */</span> +<a name="l01119"></a>01119 <span class="comment">/* ethernet frame and 4 byte isl crc */</span> +<a name="l01120"></a>01120 }; +<a name="l01121"></a>01121 +<a name="l01122"></a>01122 <span class="preprocessor">#ifndef IPPROTO_OSPF</span> +<a name="l01123"></a>01123 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_OSPF 89 </span><span class="comment">/* not everyone's got this */</span> +<a name="l01124"></a>01124 <span class="preprocessor">#endif</span> +<a name="l01125"></a>01125 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_OSPF_LSA 890 </span><span class="comment">/* made this up. Hope it's unused */</span> +<a name="l01126"></a>01126 <span class="preprocessor">#define LIBNET_MODX 4102 </span><span class="comment">/* used in LSA checksum */</span> +<a name="l01127"></a>01127 +<a name="l01128"></a>01128 <span class="comment">/*</span> +<a name="l01129"></a>01129 <span class="comment"> * Options used in multiple OSPF packets</span> +<a name="l01130"></a>01130 <span class="comment"> * More info can be found in section A.2 of RFC 2328.</span> +<a name="l01131"></a>01131 <span class="comment"> */</span> +<a name="l01132"></a>01132 <span class="preprocessor">#define LIBNET_OPT_EBIT 0x02 </span><span class="comment">/* describes the way AS-external-LSAs are flooded */</span> +<a name="l01133"></a>01133 <span class="preprocessor">#define LIBNET_OPT_MCBIT 0x04 </span><span class="comment">/* whether or not IP multicast dgrams are fwdd */</span> +<a name="l01134"></a>01134 <span class="preprocessor">#define LIBNET_OPT_NPBIT 0x08 </span><span class="comment">/* describes handling of type-7 LSAs */</span> +<a name="l01135"></a>01135 <span class="preprocessor">#define LIBNET_OPT_EABIT 0x10 </span><span class="comment">/* rtr's willingness to send/recv EA-LSAs */</span> +<a name="l01136"></a>01136 <span class="preprocessor">#define LIBNET_OPT_DCBIT 0x20 </span><span class="comment">/* describes handling of demand circuits */</span> +<a name="l01137"></a>01137 +<a name="l01138"></a>01138 +<a name="l01139"></a>01139 <span class="comment">/*</span> +<a name="l01140"></a>01140 <span class="comment"> * MPLS header</span> +<a name="l01141"></a>01141 <span class="comment"> * Multi-Protocol Label Switching</span> +<a name="l01142"></a>01142 <span class="comment"> * Static header size: 4 bytes</span> +<a name="l01143"></a>01143 <span class="comment"> */</span> +<a name="l01144"></a>01144 <span class="keyword">struct </span>libnet_mpls_hdr +<a name="l01145"></a>01145 { +<a name="l01146"></a>01146 u_int32_t mpls_les; <span class="comment">/* 20 bits label, 3 bits exp, 1 bit bos, ttl */</span> +<a name="l01147"></a>01147 <span class="preprocessor">#define LIBNET_MPLS_BOS_ON 1</span> +<a name="l01148"></a>01148 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_MPLS_BOS_OFF 0</span> +<a name="l01149"></a>01149 <span class="preprocessor"></span>}; +<a name="l01150"></a>01150 +<a name="l01151"></a>01151 <span class="comment">/*</span> +<a name="l01152"></a>01152 <span class="comment"> * NTP header</span> +<a name="l01153"></a>01153 <span class="comment"> * Network Time Protocol</span> +<a name="l01154"></a>01154 <span class="comment"> * Static header size: 48 bytes</span> +<a name="l01155"></a>01155 <span class="comment"> */</span> +<a name="l01156"></a>01156 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp <span class="comment">/* int32_t floating point (64-bit) */</span> +<a name="l01157"></a>01157 { +<a name="l01158"></a>01158 u_int32_t integer; <span class="comment">/* integer */</span> +<a name="l01159"></a>01159 u_int32_t fraction; <span class="comment">/* fraction */</span> +<a name="l01160"></a>01160 }; +<a name="l01161"></a>01161 +<a name="l01162"></a>01162 <span class="keyword">struct </span>libnet_ntp_hdr_s_fp <span class="comment">/* int16_t floating point (32-bit) */</span> +<a name="l01163"></a>01163 { +<a name="l01164"></a>01164 u_int16_t integer; <span class="comment">/* integer */</span> +<a name="l01165"></a>01165 u_int16_t fraction; <span class="comment">/* fraction */</span> +<a name="l01166"></a>01166 }; +<a name="l01167"></a>01167 +<a name="l01168"></a>01168 +<a name="l01169"></a>01169 <span class="keyword">struct </span>libnet_ntp_hdr +<a name="l01170"></a>01170 { +<a name="l01171"></a>01171 u_int8_t ntp_li_vn_mode; <span class="comment">/* leap indicator, version, mode */</span> +<a name="l01172"></a>01172 <span class="preprocessor">#define LIBNET_NTP_LI_NW 0x0 </span><span class="comment">/* no warning */</span> +<a name="l01173"></a>01173 <span class="preprocessor">#define LIBNET_NTP_LI_AS 0x1 </span><span class="comment">/* last minute has 61 seconds */</span> +<a name="l01174"></a>01174 <span class="preprocessor">#define LIBNET_NTP_LI_DS 0x2 </span><span class="comment">/* last minute has 59 seconds */</span> +<a name="l01175"></a>01175 <span class="preprocessor">#define LIBNET_NTP_LI_AC 0x3 </span><span class="comment">/* alarm condition */</span> +<a name="l01176"></a>01176 +<a name="l01177"></a>01177 <span class="preprocessor">#define LIBNET_NTP_VN_2 0x2 </span><span class="comment">/* version 2 */</span> +<a name="l01178"></a>01178 <span class="preprocessor">#define LIBNET_NTP_VN_3 0x3 </span><span class="comment">/* version 3 */</span> +<a name="l01179"></a>01179 <span class="preprocessor">#define LIBNET_NTP_VN_4 0x4 </span><span class="comment">/* version 4 */</span> +<a name="l01180"></a>01180 +<a name="l01181"></a>01181 <span class="preprocessor">#define LIBNET_NTP_MODE_R 0x0 </span><span class="comment">/* reserved */</span> +<a name="l01182"></a>01182 <span class="preprocessor">#define LIBNET_NTP_MODE_A 0x1 </span><span class="comment">/* symmetric active */</span> +<a name="l01183"></a>01183 <span class="preprocessor">#define LIBNET_NTP_MODE_P 0x2 </span><span class="comment">/* symmetric passive */</span> +<a name="l01184"></a>01184 <span class="preprocessor">#define LIBNET_NTP_MODE_C 0x3 </span><span class="comment">/* client */</span> +<a name="l01185"></a>01185 <span class="preprocessor">#define LIBNET_NTP_MODE_S 0x4 </span><span class="comment">/* server */</span> +<a name="l01186"></a>01186 <span class="preprocessor">#define LIBNET_NTP_MODE_B 0x5 </span><span class="comment">/* broadcast */</span> +<a name="l01187"></a>01187 <span class="preprocessor">#define LIBNET_NTP_MODE_RC 0x6 </span><span class="comment">/* reserved for NTP control message */</span> +<a name="l01188"></a>01188 <span class="preprocessor">#define LIBNET_NTP_MODE_RP 0x7 </span><span class="comment">/* reserved for private use */</span> +<a name="l01189"></a>01189 u_int8_t ntp_stratum; <span class="comment">/* stratum */</span> +<a name="l01190"></a>01190 <span class="preprocessor">#define LIBNET_NTP_STRATUM_UNAVAIL 0x0 </span><span class="comment">/* unspecified or unavailable */</span> +<a name="l01191"></a>01191 <span class="preprocessor">#define LIBNET_NTP_STRATUM_PRIMARY 0x1 </span><span class="comment">/* primary reference (radio clock) */</span> +<a name="l01192"></a>01192 <span class="comment">/* 2 - 15 is secondary */</span> +<a name="l01193"></a>01193 <span class="comment">/* 16 - 255 is reserved */</span> +<a name="l01194"></a>01194 u_int8_t ntp_poll; <span class="comment">/* poll interval (should be 4 - 12) */</span> +<a name="l01195"></a>01195 u_int8_t ntp_precision; <span class="comment">/* local clock precision */</span> +<a name="l01196"></a>01196 <span class="keyword">struct </span>libnet_ntp_hdr_s_fp ntp_delay; <span class="comment">/* roundtrip delay */</span> +<a name="l01197"></a>01197 <span class="keyword">struct </span>libnet_ntp_hdr_s_fp ntp_dispersion; <span class="comment">/* nominal error */</span> +<a name="l01198"></a>01198 u_int32_t ntp_reference_id; <span class="comment">/* reference source id */</span> +<a name="l01199"></a>01199 <span class="preprocessor">#define LIBNET_NTP_REF_LOCAL 0x4c4f434c </span><span class="comment">/* uncalibrated local clock */</span> +<a name="l01200"></a>01200 <span class="preprocessor">#define LIBNET_NTP_REF_PPS 0x50505300 </span><span class="comment">/* atomic / pulse-per-second clock */</span> +<a name="l01201"></a>01201 <span class="preprocessor">#define LIBNET_NTP_REF_ACTS 0x41435453 </span><span class="comment">/* NIST dialup modem */</span> +<a name="l01202"></a>01202 <span class="preprocessor">#define LIBNET_NTP_REF_USNO 0x55534e4f </span><span class="comment">/* USNO modem service */</span> +<a name="l01203"></a>01203 <span class="preprocessor">#define LIBNET_NTP_REF_PTB 0x50544200 </span><span class="comment">/* PTB (German) modem service */</span> +<a name="l01204"></a>01204 <span class="preprocessor">#define LIBNET_NTP_REF_TDF 0x54444600 </span><span class="comment">/* Allouis (French) radio */</span> +<a name="l01205"></a>01205 <span class="preprocessor">#define LIBNET_NTP_REF_DCF 0x44434600 </span><span class="comment">/* Mainflingen (German) radio */</span> +<a name="l01206"></a>01206 <span class="preprocessor">#define LIBNET_NTP_REF_MSF 0x4d534600 </span><span class="comment">/* Rugby (UK) radio */</span> +<a name="l01207"></a>01207 <span class="preprocessor">#define LIBNET_NTP_REF_WWV 0x57575600 </span><span class="comment">/* Ft Collins (US) radio */</span> +<a name="l01208"></a>01208 <span class="preprocessor">#define LIBNET_NTP_REF_WWVB 0x57575642 </span><span class="comment">/* Boulder (US) radio */</span> +<a name="l01209"></a>01209 <span class="preprocessor">#define LIBNET_NTP_REF_WWVH 0x57575648 </span><span class="comment">/* Kaui Hawaii (US) radio */</span> +<a name="l01210"></a>01210 <span class="preprocessor">#define LIBNET_NTP_REF_CHU 0x43485500 </span><span class="comment">/* Ottaha (Canada) radio */</span> +<a name="l01211"></a>01211 <span class="preprocessor">#define LIBNET_NTP_REF_LORC 0x4c4f5243 </span><span class="comment">/* LORAN-C radionavigation */</span> +<a name="l01212"></a>01212 <span class="preprocessor">#define LIBNET_NTP_REF_OMEG 0x4f4d4547 </span><span class="comment">/* OMEGA radionavigation */</span> +<a name="l01213"></a>01213 <span class="preprocessor">#define LIBNET_NTP_REF_GPS 0x47505300 </span><span class="comment">/* global positioning system */</span> +<a name="l01214"></a>01214 <span class="preprocessor">#define LIBNET_NTP_REF_GOES 0x474f4553 </span><span class="comment">/* geostationary orbit env satellite */</span> +<a name="l01215"></a>01215 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_ref_ts; <span class="comment">/* reference timestamp */</span> +<a name="l01216"></a>01216 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_orig_ts; <span class="comment">/* originate timestamp */</span> +<a name="l01217"></a>01217 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_rec_ts; <span class="comment">/* receive timestamp */</span> +<a name="l01218"></a>01218 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_xmt_ts; <span class="comment">/* transmit timestamp */</span> +<a name="l01219"></a>01219 }; +<a name="l01220"></a>01220 +<a name="l01221"></a>01221 +<a name="l01222"></a>01222 <span class="comment">/*</span> +<a name="l01223"></a>01223 <span class="comment"> * OSPFv2 header</span> +<a name="l01224"></a>01224 <span class="comment"> * Open Shortest Path First</span> +<a name="l01225"></a>01225 <span class="comment"> * Static header size: 16 bytes</span> +<a name="l01226"></a>01226 <span class="comment"> */</span> +<a name="l01227"></a>01227 <span class="keyword">struct </span>libnet_ospf_hdr +<a name="l01228"></a>01228 { +<a name="l01229"></a>01229 u_int8_t ospf_v; <span class="comment">/* version */</span> +<a name="l01230"></a>01230 <span class="preprocessor">#define OSPFVERSION 2</span> +<a name="l01231"></a>01231 <span class="preprocessor"></span> u_int8_t ospf_type; <span class="comment">/* type */</span> +<a name="l01232"></a>01232 <span class="preprocessor">#define LIBNET_OSPF_UMD 0 </span><span class="comment">/* UMd monitoring packet */</span> +<a name="l01233"></a>01233 <span class="preprocessor">#define LIBNET_OSPF_HELLO 1 </span><span class="comment">/* HELLO packet */</span> +<a name="l01234"></a>01234 <span class="preprocessor">#define LIBNET_OSPF_DBD 2 </span><span class="comment">/* dataBase description packet */</span> +<a name="l01235"></a>01235 <span class="preprocessor">#define LIBNET_OSPF_LSR 3 </span><span class="comment">/* link state request packet */</span> +<a name="l01236"></a>01236 <span class="preprocessor">#define LIBNET_OSPF_LSU 4 </span><span class="comment">/* link state Update Packet */</span> +<a name="l01237"></a>01237 <span class="preprocessor">#define LIBNET_OSPF_LSA 5 </span><span class="comment">/* link state acknowledgement packet */</span> +<a name="l01238"></a>01238 u_int16_t ospf_len; <span class="comment">/* length */</span> +<a name="l01239"></a>01239 <span class="keyword">struct </span>in_addr ospf_rtr_id; <span class="comment">/* source router ID */</span> +<a name="l01240"></a>01240 <span class="keyword">struct </span>in_addr ospf_area_id;<span class="comment">/* roam ID */</span> +<a name="l01241"></a>01241 u_int16_t ospf_sum; <span class="comment">/* checksum */</span> +<a name="l01242"></a>01242 u_int16_t ospf_auth_type; <span class="comment">/* authentication type */</span> +<a name="l01243"></a>01243 <span class="preprocessor">#define LIBNET_OSPF_AUTH_NULL 0 </span><span class="comment">/* null password */</span> +<a name="l01244"></a>01244 <span class="preprocessor">#define LIBNET_OSPF_AUTH_SIMPLE 1 </span><span class="comment">/* simple, plaintext, 8 int8_t password */</span> +<a name="l01245"></a>01245 <span class="preprocessor">#define LIBNET_OSPF_AUTH_MD5 2 </span><span class="comment">/* MD5 */</span> +<a name="l01246"></a>01246 }; +<a name="l01247"></a>01247 +<a name="l01248"></a>01248 +<a name="l01249"></a>01249 <span class="comment">/*</span> +<a name="l01250"></a>01250 <span class="comment"> * OSPF authentication header</span> +<a name="l01251"></a>01251 <span class="comment"> * Open Shortest Path First</span> +<a name="l01252"></a>01252 <span class="comment"> * Static header size: 8 bytes</span> +<a name="l01253"></a>01253 <span class="comment"> */</span> +<a name="l01254"></a>01254 <span class="keyword">struct </span>libnet_auth_hdr +<a name="l01255"></a>01255 { +<a name="l01256"></a>01256 u_int16_t ospf_auth_null; <span class="comment">/* NULL */</span> +<a name="l01257"></a>01257 u_int8_t ospf_auth_keyid; <span class="comment">/* authentication key ID */</span> +<a name="l01258"></a>01258 u_int8_t ospf_auth_len; <span class="comment">/* auth data length */</span> +<a name="l01259"></a>01259 u_int ospf_auth_seq; <span class="comment">/* cryptographic sequence number */</span> +<a name="l01260"></a>01260 }; +<a name="l01261"></a>01261 +<a name="l01262"></a>01262 +<a name="l01263"></a>01263 <span class="comment">/*</span> +<a name="l01264"></a>01264 <span class="comment"> * OSPF hello header</span> +<a name="l01265"></a>01265 <span class="comment"> * Open Shortest Path First</span> +<a name="l01266"></a>01266 <span class="comment"> * Static header size: 28 bytes</span> +<a name="l01267"></a>01267 <span class="comment"> */</span> +<a name="l01268"></a>01268 <span class="keyword">struct </span>libnet_ospf_hello_hdr +<a name="l01269"></a>01269 { +<a name="l01270"></a>01270 <span class="keyword">struct </span>in_addr hello_nmask; <span class="comment">/* netmask associated with the interface */</span> +<a name="l01271"></a>01271 u_int16_t hello_intrvl; <span class="comment">/* num of seconds between routers last packet */</span> +<a name="l01272"></a>01272 u_int8_t hello_opts; <span class="comment">/* Options for HELLO packets (look above) */</span> +<a name="l01273"></a>01273 u_int8_t hello_rtr_pri; <span class="comment">/* router's priority (if 0, can't be backup) */</span> +<a name="l01274"></a>01274 u_int hello_dead_intvl; <span class="comment">/* # of secs a router is silent till deemed down */</span> +<a name="l01275"></a>01275 <span class="keyword">struct </span>in_addr hello_des_rtr; <span class="comment">/* Designated router on the network */</span> +<a name="l01276"></a>01276 <span class="keyword">struct </span>in_addr hello_bkup_rtr; <span class="comment">/* Backup router */</span> +<a name="l01277"></a>01277 <span class="keyword">struct </span>in_addr hello_nbr; <span class="comment">/* neighbor router, memcpy more as needed */</span> +<a name="l01278"></a>01278 }; +<a name="l01279"></a>01279 +<a name="l01280"></a>01280 +<a name="l01281"></a>01281 <span class="comment">/*</span> +<a name="l01282"></a>01282 <span class="comment"> * Database Description header.</span> +<a name="l01283"></a>01283 <span class="comment"> */</span> +<a name="l01284"></a>01284 <span class="keyword">struct </span>libnet_dbd_hdr +<a name="l01285"></a>01285 { +<a name="l01286"></a>01286 u_int16_t dbd_mtu_len; <span class="comment">/* max length of IP dgram that this 'if' can use */</span> +<a name="l01287"></a>01287 u_int8_t dbd_opts; <span class="comment">/* DBD packet options (from above) */</span> +<a name="l01288"></a>01288 u_int8_t dbd_type; <span class="comment">/* type of exchange occurring */</span> +<a name="l01289"></a>01289 <span class="preprocessor">#define LIBNET_DBD_IBI 0x01 </span><span class="comment">/* init */</span> +<a name="l01290"></a>01290 <span class="preprocessor">#define LIBNET_DBD_MBIT 0x02 </span><span class="comment">/* more DBD packets are to come */</span> +<a name="l01291"></a>01291 <span class="preprocessor">#define LIBNET_DBD_MSBIT 0x04 </span><span class="comment">/* If 1, sender is the master in the exchange */</span> +<a name="l01292"></a>01292 u_int dbd_seq; <span class="comment">/* DBD sequence number */</span> +<a name="l01293"></a>01293 }; +<a name="l01294"></a>01294 +<a name="l01295"></a>01295 +<a name="l01296"></a>01296 <span class="comment">/*</span> +<a name="l01297"></a>01297 <span class="comment"> * used for the LS type field in all LS* headers</span> +<a name="l01298"></a>01298 <span class="comment"> */</span> +<a name="l01299"></a>01299 <span class="preprocessor">#define LIBNET_LS_TYPE_RTR 1 </span><span class="comment">/* router-LSA */</span> +<a name="l01300"></a>01300 <span class="preprocessor">#define LIBNET_LS_TYPE_NET 2 </span><span class="comment">/* network-LSA */</span> +<a name="l01301"></a>01301 <span class="preprocessor">#define LIBNET_LS_TYPE_IP 3 </span><span class="comment">/* summary-LSA (IP Network) */</span> +<a name="l01302"></a>01302 <span class="preprocessor">#define LIBNET_LS_TYPE_ASBR 4 </span><span class="comment">/* summary-LSA (ASBR) */</span> +<a name="l01303"></a>01303 <span class="preprocessor">#define LIBNET_LS_TYPE_ASEXT 5 </span><span class="comment">/* AS-external-LSA */</span> +<a name="l01304"></a>01304 +<a name="l01305"></a>01305 +<a name="l01306"></a>01306 <span class="comment">/*</span> +<a name="l01307"></a>01307 <span class="comment"> * Link State Request header</span> +<a name="l01308"></a>01308 <span class="comment"> */</span> +<a name="l01309"></a>01309 <span class="keyword">struct </span>libnet_lsr_hdr +<a name="l01310"></a>01310 { +<a name="l01311"></a>01311 u_int lsr_type; <span class="comment">/* type of LS being requested */</span> +<a name="l01312"></a>01312 u_int lsr_lsid; <span class="comment">/* link state ID */</span> +<a name="l01313"></a>01313 <span class="keyword">struct </span>in_addr lsr_adrtr; <span class="comment">/* advertising router (memcpy more as needed) */</span> +<a name="l01314"></a>01314 }; +<a name="l01315"></a>01315 +<a name="l01316"></a>01316 +<a name="l01317"></a>01317 <span class="comment">/*</span> +<a name="l01318"></a>01318 <span class="comment"> * Link State Update header</span> +<a name="l01319"></a>01319 <span class="comment"> */</span> +<a name="l01320"></a>01320 <span class="keyword">struct </span>libnet_lsu_hdr +<a name="l01321"></a>01321 { +<a name="l01322"></a>01322 u_int lsu_num; <span class="comment">/* number of LSAs that will be broadcasted */</span> +<a name="l01323"></a>01323 }; +<a name="l01324"></a>01324 +<a name="l01325"></a>01325 +<a name="l01326"></a>01326 <span class="comment">/*</span> +<a name="l01327"></a>01327 <span class="comment"> * Link State Acknowledgement header.</span> +<a name="l01328"></a>01328 <span class="comment"> */</span> +<a name="l01329"></a>01329 <span class="keyword">struct </span>libnet_lsa_hdr +<a name="l01330"></a>01330 { +<a name="l01331"></a>01331 u_int16_t lsa_age; <span class="comment">/* time in seconds since the LSA was originated */</span> +<a name="l01332"></a>01332 u_int8_t lsa_opts; <span class="comment">/* look above for OPTS_* */</span> +<a name="l01333"></a>01333 u_int8_t lsa_type; <span class="comment">/* look below for LS_TYPE_* */</span> +<a name="l01334"></a>01334 u_int lsa_id; <span class="comment">/* link State ID */</span> +<a name="l01335"></a>01335 <span class="keyword">struct </span>in_addr lsa_adv; <span class="comment">/* router ID of Advertising router */</span> +<a name="l01336"></a>01336 u_int lsa_seq; <span class="comment">/* LSA sequence number to detect old/bad ones */</span> +<a name="l01337"></a>01337 u_int16_t lsa_sum; <span class="comment">/* "Fletcher Checksum" of all fields minus age */</span> +<a name="l01338"></a>01338 u_int16_t lsa_len; <span class="comment">/* length in bytes including the 20 byte header */</span> +<a name="l01339"></a>01339 }; +<a name="l01340"></a>01340 +<a name="l01341"></a>01341 +<a name="l01342"></a>01342 <span class="comment">/*</span> +<a name="l01343"></a>01343 <span class="comment"> * Router LSA data format</span> +<a name="l01344"></a>01344 <span class="comment"> *</span> +<a name="l01345"></a>01345 <span class="comment"> * Other stuff for TOS can be added for backward compatability, for this</span> +<a name="l01346"></a>01346 <span class="comment"> * version, only OSPFv2 is being FULLY supported.</span> +<a name="l01347"></a>01347 <span class="comment"> */</span> +<a name="l01348"></a>01348 <span class="keyword">struct </span>libnet_rtr_lsa_hdr +<a name="l01349"></a>01349 { +<a name="l01350"></a>01350 u_int16_t rtr_flags; <span class="comment">/* set to help describe packet */</span> +<a name="l01351"></a>01351 <span class="preprocessor">#define LIBNET_RTR_FLAGS_W 0x0100 </span><span class="comment">/* W bit */</span> +<a name="l01352"></a>01352 <span class="preprocessor">#define LIBNET_RTR_FLAGS_E 0x0200 </span><span class="comment">/* E bit */</span> +<a name="l01353"></a>01353 <span class="preprocessor">#define LIBNET_RTR_FLAGS_B 0x0400 </span><span class="comment">/* B bit */</span> +<a name="l01354"></a>01354 u_int16_t rtr_num; <span class="comment">/* number of links within that packet */</span> +<a name="l01355"></a>01355 u_int rtr_link_id; <span class="comment">/* describes link_data (look below) */</span> +<a name="l01356"></a>01356 <span class="preprocessor">#define LIBNET_LINK_ID_NBR_ID 1 </span><span class="comment">/* Neighbors router ID, also can be 4 */</span> +<a name="l01357"></a>01357 <span class="preprocessor">#define LIBNET_LINK_ID_IP_DES 2 </span><span class="comment">/* IP address of designated router */</span> +<a name="l01358"></a>01358 <span class="preprocessor">#define LIBNET_LINK_ID_SUB 3 </span><span class="comment">/* IP subnet number */</span> +<a name="l01359"></a>01359 u_int rtr_link_data; <span class="comment">/* Depending on link_id, info is here */</span> +<a name="l01360"></a>01360 u_int8_t rtr_type; <span class="comment">/* Description of router link */</span> +<a name="l01361"></a>01361 <span class="preprocessor">#define LIBNET_RTR_TYPE_PTP 1 </span><span class="comment">/* Point-To-Point */</span> +<a name="l01362"></a>01362 <span class="preprocessor">#define LIBNET_RTR_TYPE_TRANS 2 </span><span class="comment">/* Connection to a "transit network" */</span> +<a name="l01363"></a>01363 <span class="preprocessor">#define LIBNET_RTR_TYPE_STUB 3 </span><span class="comment">/* Connectin to a "stub network" */</span> +<a name="l01364"></a>01364 <span class="preprocessor">#define RTR_TYPE_VRTL 4 </span><span class="comment">/* connects to a "virtual link" */</span> +<a name="l01365"></a>01365 u_int8_t rtr_tos_num; <span class="comment">/* number of different TOS metrics for this link */</span> +<a name="l01366"></a>01366 u_int16_t rtr_metric; <span class="comment">/* the "cost" of using this link */</span> +<a name="l01367"></a>01367 }; +<a name="l01368"></a>01368 +<a name="l01369"></a>01369 +<a name="l01370"></a>01370 <span class="comment">/*</span> +<a name="l01371"></a>01371 <span class="comment"> * Network LSA data format.</span> +<a name="l01372"></a>01372 <span class="comment"> */</span> +<a name="l01373"></a>01373 <span class="keyword">struct </span>libnet_net_lsa_hdr +<a name="l01374"></a>01374 { +<a name="l01375"></a>01375 <span class="keyword">struct </span>in_addr net_nmask; <span class="comment">/* Netmask for that network */</span> +<a name="l01376"></a>01376 u_int net_rtr_id; <span class="comment">/* ID of router attached to that network */</span> +<a name="l01377"></a>01377 }; +<a name="l01378"></a>01378 +<a name="l01379"></a>01379 +<a name="l01380"></a>01380 <span class="comment">/*</span> +<a name="l01381"></a>01381 <span class="comment"> * Summary LSA data format.</span> +<a name="l01382"></a>01382 <span class="comment"> */</span> +<a name="l01383"></a>01383 <span class="keyword">struct </span>libnet_sum_lsa_hdr +<a name="l01384"></a>01384 { +<a name="l01385"></a>01385 <span class="keyword">struct </span>in_addr sum_nmask; <span class="comment">/* Netmask of destination IP address */</span> +<a name="l01386"></a>01386 u_int sum_metric; <span class="comment">/* Same as in rtr_lsa (&0xfff to use last 24bit */</span> +<a name="l01387"></a>01387 u_int sum_tos_metric; <span class="comment">/* first 8bits are TOS, 24bits are TOS Metric */</span> +<a name="l01388"></a>01388 }; +<a name="l01389"></a>01389 +<a name="l01390"></a>01390 +<a name="l01391"></a>01391 <span class="comment">/*</span> +<a name="l01392"></a>01392 <span class="comment"> * AS External LSA data format.</span> +<a name="l01393"></a>01393 <span class="comment"> * & 0xfff logic operator for as_metric to get last 24bits.</span> +<a name="l01394"></a>01394 <span class="comment"> */</span> +<a name="l01395"></a>01395 <span class="keyword">struct </span>libnet_as_lsa_hdr +<a name="l01396"></a>01396 { +<a name="l01397"></a>01397 <span class="keyword">struct </span>in_addr as_nmask; <span class="comment">/* Netmask for advertised destination */</span> +<a name="l01398"></a>01398 u_int as_metric; <span class="comment">/* May have to set E bit in first 8bits */</span> +<a name="l01399"></a>01399 <span class="preprocessor">#define LIBNET_AS_E_BIT_ON 0x80000000 </span><span class="comment">/* as_metric */</span> +<a name="l01400"></a>01400 <span class="keyword">struct </span>in_addr as_fwd_addr; <span class="comment">/* Forwarding address */</span> +<a name="l01401"></a>01401 u_int as_rte_tag; <span class="comment">/* External route tag */</span> +<a name="l01402"></a>01402 }; +<a name="l01403"></a>01403 +<a name="l01404"></a>01404 +<a name="l01405"></a>01405 <span class="comment">/*</span> +<a name="l01406"></a>01406 <span class="comment"> * Base RIP header</span> +<a name="l01407"></a>01407 <span class="comment"> * Routing Information Protocol</span> +<a name="l01408"></a>01408 <span class="comment"> * Base header size: 24 bytes</span> +<a name="l01409"></a>01409 <span class="comment"> */</span> +<a name="l01410"></a>01410 <span class="keyword">struct </span>libnet_rip_hdr +<a name="l01411"></a>01411 { +<a name="l01412"></a>01412 u_int8_t rip_cmd; <span class="comment">/* RIP command */</span> +<a name="l01413"></a>01413 <span class="preprocessor">#define RIPCMD_REQUEST 1 </span><span class="comment">/* want info */</span> +<a name="l01414"></a>01414 <span class="preprocessor">#define RIPCMD_RESPONSE 2 </span><span class="comment">/* responding to request */</span> +<a name="l01415"></a>01415 <span class="preprocessor">#define RIPCMD_TRACEON 3 </span><span class="comment">/* turn tracing on */</span> +<a name="l01416"></a>01416 <span class="preprocessor">#define RIPCMD_TRACEOFF 4 </span><span class="comment">/* turn it off */</span> +<a name="l01417"></a>01417 <span class="preprocessor">#define RIPCMD_POLL 5 </span><span class="comment">/* like request, but anyone answers */</span> +<a name="l01418"></a>01418 <span class="preprocessor">#define RIPCMD_POLLENTRY 6 </span><span class="comment">/* like poll, but for entire entry */</span> +<a name="l01419"></a>01419 <span class="preprocessor">#define RIPCMD_MAX 7 </span><span class="comment">/* ? command */</span> +<a name="l01420"></a>01420 u_int8_t rip_ver; <span class="comment">/* RIP version */</span> +<a name="l01421"></a>01421 <span class="preprocessor">#define RIPVER_0 0</span> +<a name="l01422"></a>01422 <span class="preprocessor"></span><span class="preprocessor">#define RIPVER_1 1</span> +<a name="l01423"></a>01423 <span class="preprocessor"></span><span class="preprocessor">#define RIPVER_2 2</span> +<a name="l01424"></a>01424 <span class="preprocessor"></span> u_int16_t rip_rd; <span class="comment">/* Zero (v1) or Routing Domain (v2) */</span> +<a name="l01425"></a>01425 u_int16_t rip_af; <span class="comment">/* Address family */</span> +<a name="l01426"></a>01426 u_int16_t rip_rt; <span class="comment">/* Zero (v1) or Route Tag (v2) */</span> +<a name="l01427"></a>01427 u_int32_t rip_addr; <span class="comment">/* IP address */</span> +<a name="l01428"></a>01428 u_int32_t rip_mask; <span class="comment">/* Zero (v1) or Subnet Mask (v2) */</span> +<a name="l01429"></a>01429 u_int32_t rip_next_hop; <span class="comment">/* Zero (v1) or Next hop IP address (v2) */</span> +<a name="l01430"></a>01430 u_int32_t rip_metric; <span class="comment">/* Metric */</span> +<a name="l01431"></a>01431 }; +<a name="l01432"></a>01432 +<a name="l01433"></a>01433 <span class="comment">/*</span> +<a name="l01434"></a>01434 <span class="comment"> * RPC headers</span> +<a name="l01435"></a>01435 <span class="comment"> * Remote Procedure Call</span> +<a name="l01436"></a>01436 <span class="comment"> */</span> +<a name="l01437"></a>01437 <span class="preprocessor">#define LIBNET_RPC_CALL 0</span> +<a name="l01438"></a>01438 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_REPLY 1</span> +<a name="l01439"></a>01439 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_VERS 2</span> +<a name="l01440"></a>01440 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_LAST_FRAG 0x80000000</span> +<a name="l01441"></a>01441 <span class="preprocessor"></span> +<a name="l01442"></a>01442 <span class="comment">/*</span> +<a name="l01443"></a>01443 <span class="comment"> * Portmap defines</span> +<a name="l01444"></a>01444 <span class="comment"> */</span> +<a name="l01445"></a>01445 <span class="preprocessor">#define LIBNET_PMAP_PROGRAM 100000</span> +<a name="l01446"></a>01446 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_NULL 0</span> +<a name="l01447"></a>01447 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_SET 1</span> +<a name="l01448"></a>01448 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_UNSET 2</span> +<a name="l01449"></a>01449 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETADDR 3</span> +<a name="l01450"></a>01450 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_DUMP 4</span> +<a name="l01451"></a>01451 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_CALLIT 5</span> +<a name="l01452"></a>01452 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_BCAST 5 </span><span class="comment">/* Not a typo */</span> +<a name="l01453"></a>01453 <span class="preprocessor">#define LIBNET_PMAP_PROC_GETTIME 6</span> +<a name="l01454"></a>01454 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_UADDR2TADDR 7</span> +<a name="l01455"></a>01455 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_TADDR2UADDR 8</span> +<a name="l01456"></a>01456 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETVERSADDR 9</span> +<a name="l01457"></a>01457 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_INDIRECT 10</span> +<a name="l01458"></a>01458 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETADDRLIST 11</span> +<a name="l01459"></a>01459 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETSTAT 12</span> +<a name="l01460"></a>01460 <span class="preprocessor"></span> +<a name="l01461"></a>01461 <span class="comment">/* There will be more to add... */</span> +<a name="l01462"></a>01462 +<a name="l01463"></a>01463 <span class="keyword">struct </span>libnet_rpc_opaque_auth +<a name="l01464"></a>01464 { +<a name="l01465"></a>01465 u_int32_t rpc_auth_flavor; +<a name="l01466"></a>01466 u_int32_t rpc_auth_length; +<a name="l01467"></a>01467 <span class="preprocessor">#if 0</span> +<a name="l01468"></a>01468 <span class="preprocessor"></span> u_int8_t *rpc_auth_data; +<a name="l01469"></a>01469 <span class="preprocessor">#endif</span> +<a name="l01470"></a>01470 <span class="preprocessor"></span>}; +<a name="l01471"></a>01471 +<a name="l01472"></a>01472 <span class="keyword">struct </span>libnet_rpc_call +<a name="l01473"></a>01473 { +<a name="l01474"></a>01474 u_int32_t rpc_rpcvers; <span class="comment">/* RPC version - must be 2 */</span> +<a name="l01475"></a>01475 u_int32_t rpc_prognum; <span class="comment">/* Program Number */</span> +<a name="l01476"></a>01476 u_int32_t rpc_vers; <span class="comment">/* Program Version */</span> +<a name="l01477"></a>01477 u_int32_t rpc_procedure; <span class="comment">/* RPC procedure */</span> +<a name="l01478"></a>01478 <span class="keyword">struct </span>libnet_rpc_opaque_auth rpc_credentials; +<a name="l01479"></a>01479 <span class="keyword">struct </span>libnet_rpc_opaque_auth rpc_verifier; +<a name="l01480"></a>01480 }; +<a name="l01481"></a>01481 +<a name="l01482"></a>01482 <span class="keyword">struct </span>libnet_rpc_call_hdr +<a name="l01483"></a>01483 { +<a name="l01484"></a>01484 u_int32_t rpc_xid; <span class="comment">/* xid (transaction identifier) */</span> +<a name="l01485"></a>01485 u_int32_t rpc_type; +<a name="l01486"></a>01486 <span class="keyword">struct </span>libnet_rpc_call rpc_call; +<a name="l01487"></a>01487 }; +<a name="l01488"></a>01488 +<a name="l01489"></a>01489 <span class="keyword">struct </span>libnet_rpc_call_tcp_hdr +<a name="l01490"></a>01490 { +<a name="l01491"></a>01491 u_int32_t rpc_record_marking; <span class="comment">/* used with byte stream protocols */</span> +<a name="l01492"></a>01492 <span class="keyword">struct </span>libnet_rpc_call_hdr rpc_common; +<a name="l01493"></a>01493 }; +<a name="l01494"></a>01494 +<a name="l01495"></a>01495 <span class="comment">/*</span> +<a name="l01496"></a>01496 <span class="comment"> * STP configuration header</span> +<a name="l01497"></a>01497 <span class="comment"> * Spanning Tree Protocol</span> +<a name="l01498"></a>01498 <span class="comment"> * Static header size: 35 bytes</span> +<a name="l01499"></a>01499 <span class="comment"> */</span> +<a name="l01500"></a>01500 <span class="keyword">struct </span>libnet_stp_conf_hdr +<a name="l01501"></a>01501 { +<a name="l01502"></a>01502 u_int16_t stp_id; <span class="comment">/* protocol id */</span> +<a name="l01503"></a>01503 u_int8_t stp_version; <span class="comment">/* protocol version */</span> +<a name="l01504"></a>01504 u_int8_t stp_bpdu_type; <span class="comment">/* bridge protocol data unit type */</span> +<a name="l01505"></a>01505 u_int8_t stp_flags; <span class="comment">/* control flags */</span> +<a name="l01506"></a>01506 u_int8_t stp_rootid[8]; <span class="comment">/* root id */</span> +<a name="l01507"></a>01507 u_int32_t stp_rootpc; <span class="comment">/* root path cost */</span> +<a name="l01508"></a>01508 u_int8_t stp_bridgeid[8]; <span class="comment">/* bridge id */</span> +<a name="l01509"></a>01509 u_int16_t stp_portid; <span class="comment">/* port id */</span> +<a name="l01510"></a>01510 u_int16_t stp_mage; <span class="comment">/* message age */</span> +<a name="l01511"></a>01511 u_int16_t stp_maxage; <span class="comment">/* max age */</span> +<a name="l01512"></a>01512 u_int16_t stp_hellot; <span class="comment">/* hello time */</span> +<a name="l01513"></a>01513 u_int16_t stp_fdelay; <span class="comment">/* forward delay */</span> +<a name="l01514"></a>01514 }; +<a name="l01515"></a>01515 +<a name="l01516"></a>01516 +<a name="l01517"></a>01517 <span class="comment">/*</span> +<a name="l01518"></a>01518 <span class="comment"> * STP topology change notification header</span> +<a name="l01519"></a>01519 <span class="comment"> * Spanning Tree Protocol</span> +<a name="l01520"></a>01520 <span class="comment"> * Static header size: 4 bytes</span> +<a name="l01521"></a>01521 <span class="comment"> */</span> +<a name="l01522"></a>01522 <span class="keyword">struct </span>libnet_stp_tcn_hdr +<a name="l01523"></a>01523 { +<a name="l01524"></a>01524 u_int16_t stp_id; <span class="comment">/* protocol id */</span> +<a name="l01525"></a>01525 u_int8_t stp_version; <span class="comment">/* protocol version */</span> +<a name="l01526"></a>01526 u_int8_t stp_bpdu_type; <span class="comment">/* bridge protocol data unit type */</span> +<a name="l01527"></a>01527 }; +<a name="l01528"></a>01528 +<a name="l01529"></a>01529 +<a name="l01530"></a>01530 <span class="comment">/*</span> +<a name="l01531"></a>01531 <span class="comment"> * TCP header</span> +<a name="l01532"></a>01532 <span class="comment"> * Transmission Control Protocol</span> +<a name="l01533"></a>01533 <span class="comment"> * Static header size: 20 bytes</span> +<a name="l01534"></a>01534 <span class="comment"> */</span> +<a name="l01535"></a>01535 <span class="keyword">struct </span>libnet_tcp_hdr +<a name="l01536"></a>01536 { +<a name="l01537"></a>01537 u_int16_t th_sport; <span class="comment">/* source port */</span> +<a name="l01538"></a>01538 u_int16_t th_dport; <span class="comment">/* destination port */</span> +<a name="l01539"></a>01539 u_int32_t th_seq; <span class="comment">/* sequence number */</span> +<a name="l01540"></a>01540 u_int32_t th_ack; <span class="comment">/* acknowledgement number */</span> +<a name="l01541"></a>01541 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span> +<a name="l01542"></a>01542 <span class="preprocessor"></span> u_int8_t th_x2:4, <span class="comment">/* (unused) */</span> +<a name="l01543"></a>01543 th_off:4; <span class="comment">/* data offset */</span> +<a name="l01544"></a>01544 <span class="preprocessor">#endif</span> +<a name="l01545"></a>01545 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span> +<a name="l01546"></a>01546 <span class="preprocessor"></span> u_int8_t th_off:4, <span class="comment">/* data offset */</span> +<a name="l01547"></a>01547 th_x2:4; <span class="comment">/* (unused) */</span> +<a name="l01548"></a>01548 <span class="preprocessor">#endif</span> +<a name="l01549"></a>01549 <span class="preprocessor"></span> u_int8_t th_flags; <span class="comment">/* control flags */</span> +<a name="l01550"></a>01550 <span class="preprocessor">#ifndef TH_FIN</span> +<a name="l01551"></a>01551 <span class="preprocessor"></span><span class="preprocessor">#define TH_FIN 0x01 </span><span class="comment">/* finished send data */</span> +<a name="l01552"></a>01552 <span class="preprocessor">#endif</span> +<a name="l01553"></a>01553 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_SYN</span> +<a name="l01554"></a>01554 <span class="preprocessor"></span><span class="preprocessor">#define TH_SYN 0x02 </span><span class="comment">/* synchronize sequence numbers */</span> +<a name="l01555"></a>01555 <span class="preprocessor">#endif</span> +<a name="l01556"></a>01556 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_RST</span> +<a name="l01557"></a>01557 <span class="preprocessor"></span><span class="preprocessor">#define TH_RST 0x04 </span><span class="comment">/* reset the connection */</span> +<a name="l01558"></a>01558 <span class="preprocessor">#endif</span> +<a name="l01559"></a>01559 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_PUSH</span> +<a name="l01560"></a>01560 <span class="preprocessor"></span><span class="preprocessor">#define TH_PUSH 0x08 </span><span class="comment">/* push data to the app layer */</span> +<a name="l01561"></a>01561 <span class="preprocessor">#endif</span> +<a name="l01562"></a>01562 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_ACK</span> +<a name="l01563"></a>01563 <span class="preprocessor"></span><span class="preprocessor">#define TH_ACK 0x10 </span><span class="comment">/* acknowledge */</span> +<a name="l01564"></a>01564 <span class="preprocessor">#endif</span> +<a name="l01565"></a>01565 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_URG</span> +<a name="l01566"></a>01566 <span class="preprocessor"></span><span class="preprocessor">#define TH_URG 0x20 </span><span class="comment">/* urgent! */</span> +<a name="l01567"></a>01567 <span class="preprocessor">#endif</span> +<a name="l01568"></a>01568 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_ECE</span> +<a name="l01569"></a>01569 <span class="preprocessor"></span><span class="preprocessor">#define TH_ECE 0x40</span> +<a name="l01570"></a>01570 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l01571"></a>01571 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_CWR </span> +<a name="l01572"></a>01572 <span class="preprocessor"></span><span class="preprocessor">#define TH_CWR 0x80</span> +<a name="l01573"></a>01573 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l01574"></a>01574 <span class="preprocessor"></span> u_int16_t th_win; <span class="comment">/* window */</span> +<a name="l01575"></a>01575 u_int16_t th_sum; <span class="comment">/* checksum */</span> +<a name="l01576"></a>01576 u_int16_t th_urp; <span class="comment">/* urgent pointer */</span> +<a name="l01577"></a>01577 }; +<a name="l01578"></a>01578 +<a name="l01579"></a>01579 <span class="comment">/*</span> +<a name="l01580"></a>01580 <span class="comment"> * Token Ring Header</span> +<a name="l01581"></a>01581 <span class="comment"> */</span> +<a name="l01582"></a>01582 <span class="keyword">struct </span>libnet_token_ring_hdr +<a name="l01583"></a>01583 { +<a name="l01584"></a>01584 u_int8_t token_ring_access_control; +<a name="l01585"></a>01585 <span class="preprocessor">#define LIBNET_TOKEN_RING_FRAME 0x10</span> +<a name="l01586"></a>01586 <span class="preprocessor"></span> u_int8_t token_ring_frame_control; +<a name="l01587"></a>01587 <span class="preprocessor">#define LIBNET_TOKEN_RING_LLC_FRAME 0x40</span> +<a name="l01588"></a>01588 <span class="preprocessor"></span> u_int8_t token_ring_dhost[TOKEN_RING_ADDR_LEN]; +<a name="l01589"></a>01589 u_int8_t token_ring_shost[TOKEN_RING_ADDR_LEN]; +<a name="l01590"></a>01590 u_int8_t token_ring_llc_dsap; +<a name="l01591"></a>01591 u_int8_t token_ring_llc_ssap; +<a name="l01592"></a>01592 u_int8_t token_ring_llc_control_field; +<a name="l01593"></a>01593 u_int8_t token_ring_llc_org_code[LIBNET_ORG_CODE_SIZE]; +<a name="l01594"></a>01594 u_int16_t token_ring_type; +<a name="l01595"></a>01595 <span class="preprocessor">#define TOKEN_RING_TYPE_IP 0x0800 </span><span class="comment">/* IP protocol */</span> +<a name="l01596"></a>01596 <span class="preprocessor">#define TOKEN_RING_TYPE_ARP 0x0806 </span><span class="comment">/* addr. resolution protocol */</span> +<a name="l01597"></a>01597 <span class="preprocessor">#define TOKEN_RING_TYPE_REVARP 0x8035 </span><span class="comment">/* reverse addr. resolution protocol */</span> +<a name="l01598"></a>01598 }; +<a name="l01599"></a>01599 +<a name="l01600"></a>01600 <span class="keyword">struct </span>libnet_token_ring_addr +<a name="l01601"></a>01601 { +<a name="l01602"></a>01602 u_int8_t token_ring_addr_octet[6]; <span class="comment">/* Token Ring address */</span> +<a name="l01603"></a>01603 }; +<a name="l01604"></a>01604 +<a name="l01605"></a>01605 <span class="comment">/*</span> +<a name="l01606"></a>01606 <span class="comment"> * UDP header</span> +<a name="l01607"></a>01607 <span class="comment"> * User Data Protocol</span> +<a name="l01608"></a>01608 <span class="comment"> * Static header size: 8 bytes</span> +<a name="l01609"></a>01609 <span class="comment"> */</span> +<a name="l01610"></a>01610 <span class="keyword">struct </span>libnet_udp_hdr +<a name="l01611"></a>01611 { +<a name="l01612"></a>01612 u_int16_t uh_sport; <span class="comment">/* soure port */</span> +<a name="l01613"></a>01613 u_int16_t uh_dport; <span class="comment">/* destination port */</span> +<a name="l01614"></a>01614 u_int16_t uh_ulen; <span class="comment">/* length */</span> +<a name="l01615"></a>01615 u_int16_t uh_sum; <span class="comment">/* checksum */</span> +<a name="l01616"></a>01616 }; +<a name="l01617"></a>01617 +<a name="l01618"></a>01618 <span class="comment">/*</span> +<a name="l01619"></a>01619 <span class="comment"> * Sebek header</span> +<a name="l01620"></a>01620 <span class="comment"> * Static header size: 48 bytes</span> +<a name="l01621"></a>01621 <span class="comment"> */</span> +<a name="l01622"></a>01622 <span class="keyword">struct </span>libnet_sebek_hdr +<a name="l01623"></a>01623 { +<a name="l01624"></a>01624 u_int32_t magic; <span class="comment">/* identify packets that should be hidden */</span> +<a name="l01625"></a>01625 u_int16_t version; <span class="comment">/* protocol version, currently 1 */</span> +<a name="l01626"></a>01626 <span class="preprocessor">#define SEBEK_PROTO_VERSION 1</span> +<a name="l01627"></a>01627 <span class="preprocessor"></span> u_int16_t type; <span class="comment">/* type of record (read data is type 0, write data is type 1) */</span> +<a name="l01628"></a>01628 <span class="preprocessor">#define SEBEK_TYPE_READ 0 </span><span class="comment">/* Currently, only read is supported */</span> +<a name="l01629"></a>01629 <span class="preprocessor">#define SEBEK_TYPE_WRITE 1</span> +<a name="l01630"></a>01630 <span class="preprocessor"></span> u_int32_t counter; <span class="comment">/* PDU counter used to identify when packet are lost */</span> +<a name="l01631"></a>01631 u_int32_t time_sec; <span class="comment">/* seconds since EPOCH according to the honeypot */</span> +<a name="l01632"></a>01632 u_int32_t time_usec; <span class="comment">/* residual microseconds */</span> +<a name="l01633"></a>01633 u_int32_t pid; <span class="comment">/* PID */</span> +<a name="l01634"></a>01634 u_int32_t uid; <span class="comment">/* UID */</span> +<a name="l01635"></a>01635 u_int32_t fd; <span class="comment">/* FD */</span> +<a name="l01636"></a>01636 <span class="preprocessor">#define SEBEK_CMD_LENGTH 12</span> +<a name="l01637"></a>01637 <span class="preprocessor"></span> u_int8_t cmd[SEBEK_CMD_LENGTH]; <span class="comment">/* 12 first characters of the command */</span> +<a name="l01638"></a>01638 u_int32_t length; <span class="comment">/* length in bytes of the PDU's body */</span> +<a name="l01639"></a>01639 }; +<a name="l01640"></a>01640 +<a name="l01641"></a>01641 +<a name="l01642"></a>01642 <span class="comment">/*</span> +<a name="l01643"></a>01643 <span class="comment"> * VRRP header</span> +<a name="l01644"></a>01644 <span class="comment"> * Virtual Router Redundancy Protocol</span> +<a name="l01645"></a>01645 <span class="comment"> * Static header size: 8 bytes</span> +<a name="l01646"></a>01646 <span class="comment"> */</span> +<a name="l01647"></a>01647 <span class="preprocessor">#ifndef IPPROTO_VRRP</span> +<a name="l01648"></a>01648 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_VRRP 112 </span><span class="comment">/* not everyone's got this */</span> +<a name="l01649"></a>01649 <span class="preprocessor">#endif</span> +<a name="l01650"></a>01650 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_vrrp_hdr +<a name="l01651"></a>01651 { +<a name="l01652"></a>01652 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span> +<a name="l01653"></a>01653 <span class="preprocessor"></span> u_int8_t vrrp_v:4, <span class="comment">/* protocol version */</span> +<a name="l01654"></a>01654 vrrp_t:4; <span class="comment">/* packet type */</span> +<a name="l01655"></a>01655 <span class="preprocessor">#endif</span> +<a name="l01656"></a>01656 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span> +<a name="l01657"></a>01657 <span class="preprocessor"></span> u_int8_t vrrp_t:4, <span class="comment">/* packet type */</span> +<a name="l01658"></a>01658 vrrp_v:4; <span class="comment">/* protocol version */</span> +<a name="l01659"></a>01659 <span class="preprocessor">#endif</span> +<a name="l01660"></a>01660 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_VERSION_01 0x1</span> +<a name="l01661"></a>01661 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_VERSION_02 0x2</span> +<a name="l01662"></a>01662 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_TYPE_ADVERT 0x1</span> +<a name="l01663"></a>01663 <span class="preprocessor"></span> u_int8_t vrrp_vrouter_id; <span class="comment">/* virtual router id */</span> +<a name="l01664"></a>01664 u_int8_t vrrp_priority; <span class="comment">/* priority */</span> +<a name="l01665"></a>01665 u_int8_t vrrp_ip_count; <span class="comment">/* number of IP addresses */</span> +<a name="l01666"></a>01666 u_int8_t vrrp_auth_type; <span class="comment">/* authorization type */</span> +<a name="l01667"></a>01667 <span class="preprocessor">#define LIBNET_VRRP_AUTH_NONE 0x1</span> +<a name="l01668"></a>01668 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_AUTH_PASSWD 0x2</span> +<a name="l01669"></a>01669 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_AUTH_IPAH 0x3</span> +<a name="l01670"></a>01670 <span class="preprocessor"></span> u_int8_t vrrp_advert_int; <span class="comment">/* advertisement interval */</span> +<a name="l01671"></a>01671 u_int16_t vrrp_sum; <span class="comment">/* checksum */</span> +<a name="l01672"></a>01672 <span class="comment">/* additional addresses */</span> +<a name="l01673"></a>01673 <span class="comment">/* authentication info */</span> +<a name="l01674"></a>01674 }; +<a name="l01675"></a>01675 +<a name="l01676"></a>01676 +<a name="l01677"></a>01677 <span class="comment">/*</span> +<a name="l01678"></a>01678 <span class="comment"> * HSRP header</span> +<a name="l01679"></a>01679 <span class="comment"> * Static header size: 20 bytes</span> +<a name="l01680"></a>01680 <span class="comment"> */</span> +<a name="l01681"></a>01681 <span class="keyword">struct </span>libnet_hsrp_hdr +<a name="l01682"></a>01682 { +<a name="l01683"></a>01683 <span class="preprocessor">#define LIBNET_HSRP_VERSION 0x0</span> +<a name="l01684"></a>01684 <span class="preprocessor"></span> u_int8_t version; <span class="comment">/* Version of the HSRP messages */</span> +<a name="l01685"></a>01685 <span class="preprocessor">#define LIBNET_HSRP_TYPE_HELLO 0x0</span> +<a name="l01686"></a>01686 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_HSRP_TYPE_COUP 0x1</span> +<a name="l01687"></a>01687 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_HSRP_TYPE_RESIGN 0x2</span> +<a name="l01688"></a>01688 <span class="preprocessor"></span> u_int8_t opcode; <span class="comment">/* Type of message */</span> +<a name="l01689"></a>01689 <span class="preprocessor">#define LIBNET_HSRP_STATE_INITIAL 0x0</span> +<a name="l01690"></a>01690 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_HSRP_STATE_LEARN 0x1</span> +<a name="l01691"></a>01691 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_HSRP_STATE_LISTEN 0x2</span> +<a name="l01692"></a>01692 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_HSRP_STATE_SPEAK 0x4</span> +<a name="l01693"></a>01693 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_HSRP_STATE_STANDBY 0x8</span> +<a name="l01694"></a>01694 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_HSRP_STATE_ACTIVE 0x10</span> +<a name="l01695"></a>01695 <span class="preprocessor"></span> u_int8_t state; <span class="comment">/* Current state of the router */</span> +<a name="l01696"></a>01696 u_int8_t hello_time; <span class="comment">/* Period in seconds between hello messages */</span> +<a name="l01697"></a>01697 u_int8_t hold_time; <span class="comment">/* Seconds that the current hello message is valid */</span> +<a name="l01698"></a>01698 u_int8_t priority; <span class="comment">/* Priority for the election proccess */</span> +<a name="l01699"></a>01699 u_int8_t group; <span class="comment">/* Standby group */</span> +<a name="l01700"></a>01700 u_int8_t reserved; <span class="comment">/* Reserved field */</span> +<a name="l01701"></a>01701 <span class="preprocessor">#define HSRP_AUTHDATA_LENGTH 8 </span> +<a name="l01702"></a>01702 <span class="preprocessor"></span> u_int8_t authdata[HSRP_AUTHDATA_LENGTH]; <span class="comment">/* Password */</span> +<a name="l01703"></a>01703 u_int32_t virtual_ip; <span class="comment">/* Virtual IP address */</span> +<a name="l01704"></a>01704 }; +<a name="l01705"></a>01705 +<a name="l01706"></a>01706 <span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_HEADERS_H */</span> +<a name="l01707"></a>01707 +<a name="l01708"></a>01708 <span class="comment">/* EOF */</span> +</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-macros_8h-source.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-macros_8h-source.html new file mode 100644 index 0000000..5b80394 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-macros_8h-source.html @@ -0,0 +1,184 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet-macros.h Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet-macros.h</h1><a href="libnet-macros_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> +<a name="l00002"></a>00002 <span class="comment"> * $Id: libnet-macros.h,v 1.7 2004/04/13 17:32:28 mike Exp $</span> +<a name="l00003"></a>00003 <span class="comment"> *</span> +<a name="l00004"></a>00004 <span class="comment"> * libnet-macros.h - Network routine library macro header file</span> +<a name="l00005"></a>00005 <span class="comment"> *</span> +<a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com></span> +<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span> +<a name="l00008"></a>00008 <span class="comment"> *</span> +<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span> +<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span> +<a name="l00011"></a>00011 <span class="comment"> * are met:</span> +<a name="l00012"></a>00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span> +<a name="l00013"></a>00013 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span> +<a name="l00014"></a>00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span> +<a name="l00015"></a>00015 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span> +<a name="l00016"></a>00016 <span class="comment"> * documentation and/or other materials provided with the distribution.</span> +<a name="l00017"></a>00017 <span class="comment"> *</span> +<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span> +<a name="l00019"></a>00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> +<a name="l00020"></a>00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> +<a name="l00021"></a>00021 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span> +<a name="l00022"></a>00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span> +<a name="l00023"></a>00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span> +<a name="l00024"></a>00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> +<a name="l00025"></a>00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span> +<a name="l00026"></a>00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span> +<a name="l00027"></a>00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span> +<a name="l00028"></a>00028 <span class="comment"> * SUCH DAMAGE.</span> +<a name="l00029"></a>00029 <span class="comment"> *</span> +<a name="l00030"></a>00030 <span class="comment"> */</span> +<a name="l00031"></a>00031 +<a name="l00032"></a>00032 <span class="preprocessor">#ifndef __LIBNET_MACROS_H</span> +<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_MACROS_H</span> +<a name="l00034"></a>00034 <span class="preprocessor"></span> +<a name="l00039"></a>00039 <span class="comment">/* for systems without snprintf */</span> +<a name="l00040"></a>00040 <span class="preprocessor">#if defined(NO_SNPRINTF)</span> +<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#define snprintf(buf, len, args...) sprintf(buf, ##args)</span> +<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00043"></a>00043 <span class="preprocessor"></span> +<a name="l00044"></a>00044 +<a name="l00049"></a><a class="code" href="libnet-macros_8h.html#c67cb6e9b00fd492cc3a9247e9477d87">00049</a> <span class="preprocessor">#define LIBNET_DONT_RESOLVE 0</span> +<a name="l00050"></a>00050 <span class="preprocessor"></span> +<a name="l00055"></a><a class="code" href="libnet-macros_8h.html#6733960f6981f1930b2d1a489df89cc7">00055</a> <span class="preprocessor">#define LIBNET_RESOLVE 1</span> +<a name="l00056"></a>00056 <span class="preprocessor"></span> +<a name="l00060"></a><a class="code" href="libnet-macros_8h.html#5ff9536ca9bbe6f73f69bec817962742">00060</a> <span class="preprocessor">#define LIBNET_ON 0</span> +<a name="l00061"></a>00061 <span class="preprocessor"></span> +<a name="l00065"></a><a class="code" href="libnet-macros_8h.html#f87da67c016a9791d256c2d71bf0b0ac">00065</a> <span class="preprocessor">#define LIBNET_OFF 1</span> +<a name="l00066"></a>00066 <span class="preprocessor"></span> +<a name="l00070"></a>00070 <span class="preprocessor">#ifndef IN6ADDR_ERROR_INIT</span> +<a name="l00071"></a><a class="code" href="libnet-macros_8h.html#9c76fe8da8e411fe1db9f75583dc1b8a">00071</a> <span class="preprocessor"></span><span class="preprocessor">#define IN6ADDR_ERROR_INIT { { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \</span> +<a name="l00072"></a>00072 <span class="preprocessor"> 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \</span> +<a name="l00073"></a>00073 <span class="preprocessor"> 0xff, 0xff } } }</span> +<a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00075"></a>00075 <span class="preprocessor"></span> +<a name="l00079"></a><a class="code" href="libnet-macros_8h.html#96a6017948aa76e5a5d415c3227348df">00079</a> <span class="preprocessor">#define LIBNET_PR2 0</span> +<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PR8 1</span> +<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PR16 2</span> +<a name="l00082"></a>00082 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PRu16 3</span> +<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PR32 4</span> +<a name="l00084"></a>00084 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PRu32 5</span> +<a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PRAND_MAX 0xffffffff</span> +<a name="l00086"></a>00086 <span class="preprocessor"></span> +<a name="l00090"></a><a class="code" href="libnet-macros_8h.html#c7301c95aa36d66e8904979650b5189d">00090</a> <span class="preprocessor">#define LIBNET_MAX_PACKET 0xffff</span> +<a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_MAXPACKET</span> +<a name="l00092"></a>00092 <span class="preprocessor"></span><span class="preprocessor">#define IP_MAXPACKET 0xffff</span> +<a name="l00093"></a>00093 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00094"></a>00094 <span class="preprocessor"></span> +<a name="l00095"></a>00095 +<a name="l00096"></a>00096 <span class="comment">/* ethernet addresses are 6 octets long */</span> +<a name="l00097"></a>00097 <span class="preprocessor">#ifndef ETHER_ADDR_LEN</span> +<a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor">#define ETHER_ADDR_LEN 0x6</span> +<a name="l00099"></a>00099 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00100"></a>00100 <span class="preprocessor"></span> +<a name="l00101"></a>00101 <span class="comment">/* FDDI addresses are 6 octets long */</span> +<a name="l00102"></a>00102 <span class="preprocessor">#ifndef FDDI_ADDR_LEN</span> +<a name="l00103"></a>00103 <span class="preprocessor"></span><span class="preprocessor">#define FDDI_ADDR_LEN 0x6</span> +<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00105"></a>00105 <span class="preprocessor"></span> +<a name="l00106"></a>00106 <span class="comment">/* token ring addresses are 6 octets long */</span> +<a name="l00107"></a>00107 <span class="preprocessor">#ifndef TOKEN_RING_ADDR_LEN</span> +<a name="l00108"></a>00108 <span class="preprocessor"></span><span class="preprocessor">#define TOKEN_RING_ADDR_LEN 0x6</span> +<a name="l00109"></a>00109 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00110"></a>00110 <span class="preprocessor"></span> +<a name="l00111"></a>00111 <span class="comment">/* LLC Organization Code is 3 bytes long */</span> +<a name="l00112"></a>00112 <span class="preprocessor">#define LIBNET_ORG_CODE_SIZE 0x3</span> +<a name="l00113"></a>00113 <span class="preprocessor"></span> +<a name="l00117"></a><a class="code" href="libnet-macros_8h.html#2d720375e2ef5a85a62d6069283a5223">00117</a> <span class="preprocessor">#define LIBNET_ERRBUF_SIZE 0x100</span> +<a name="l00118"></a>00118 <span class="preprocessor"></span> +<a name="l00122"></a><a class="code" href="libnet-macros_8h.html#e9cd154f8cb482809ee456b6ac43dea5">00122</a> <span class="preprocessor">#define LIBNET_MAXOPTION_SIZE 0x28</span> +<a name="l00123"></a>00123 <span class="preprocessor"></span> +<a name="l00124"></a>00124 <span class="comment">/* some BSD variants have this endianess problem */</span> +<a name="l00125"></a>00125 <span class="preprocessor">#if (LIBNET_BSD_BYTE_SWAP)</span> +<a name="l00126"></a>00126 <span class="preprocessor"></span><span class="preprocessor">#define FIX(n) ntohs(n)</span> +<a name="l00127"></a>00127 <span class="preprocessor"></span><span class="preprocessor">#define UNFIX(n) htons(n)</span> +<a name="l00128"></a>00128 <span class="preprocessor"></span><span class="preprocessor">#else</span> +<a name="l00129"></a>00129 <span class="preprocessor"></span><span class="preprocessor">#define FIX(n) (n)</span> +<a name="l00130"></a>00130 <span class="preprocessor"></span><span class="preprocessor">#define UNFIX(n) (n)</span> +<a name="l00131"></a>00131 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00132"></a>00132 <span class="preprocessor"></span> +<a name="l00133"></a>00133 <span class="comment">/* used internally for packet builders */</span> +<a name="l00134"></a>00134 <span class="preprocessor">#define LIBNET_DO_PAYLOAD(l, p) \</span> +<a name="l00135"></a>00135 <span class="preprocessor">if ((payload && !payload_s) || (!payload && payload_s)) \</span> +<a name="l00136"></a>00136 <span class="preprocessor">{ \</span> +<a name="l00137"></a>00137 <span class="preprocessor"> snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, \</span> +<a name="l00138"></a>00138 <span class="preprocessor"> "%s(): payload inconsistency\n", __func__); \</span> +<a name="l00139"></a>00139 <span class="preprocessor"> goto bad; \</span> +<a name="l00140"></a>00140 <span class="preprocessor">} \</span> +<a name="l00141"></a>00141 <span class="preprocessor">if (payload && payload_s) \</span> +<a name="l00142"></a>00142 <span class="preprocessor">{ \</span> +<a name="l00143"></a>00143 <span class="preprocessor"> n = libnet_pblock_append(l, p, payload, payload_s); \</span> +<a name="l00144"></a>00144 <span class="preprocessor"> if (n == (u_int32_t) - 1) \</span> +<a name="l00145"></a>00145 <span class="preprocessor"> { \</span> +<a name="l00146"></a>00146 <span class="preprocessor"> goto bad; \</span> +<a name="l00147"></a>00147 <span class="preprocessor"> } \</span> +<a name="l00148"></a>00148 <span class="preprocessor">} \</span> +<a name="l00149"></a>00149 <span class="preprocessor"></span> +<a name="l00150"></a>00150 <span class="preprocessor"></span> +<a name="l00151"></a>00151 <span class="comment">/* used internally for checksum stuff */</span> +<a name="l00152"></a>00152 <span class="preprocessor">#define LIBNET_CKSUM_CARRY(x) \</span> +<a name="l00153"></a>00153 <span class="preprocessor"> (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff))</span> +<a name="l00154"></a>00154 <span class="preprocessor"></span> +<a name="l00155"></a>00155 <span class="comment">/* used interally for OSPF stuff */</span> +<a name="l00156"></a>00156 <span class="preprocessor">#define LIBNET_OSPF_AUTHCPY(x, y) \</span> +<a name="l00157"></a>00157 <span class="preprocessor"> memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))</span> +<a name="l00158"></a>00158 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_OSPF_CKSUMBUF(x, y) \</span> +<a name="l00159"></a>00159 <span class="preprocessor"> memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y)) </span> +<a name="l00160"></a>00160 <span class="preprocessor"></span> +<a name="l00161"></a>00161 <span class="comment">/* used internally for NTP leap indicator, version, and mode */</span> +<a name="l00162"></a>00162 <span class="preprocessor">#define LIBNET_NTP_DO_LI_VN_MODE(li, vn, md) \</span> +<a name="l00163"></a>00163 <span class="preprocessor"> ((u_int8_t)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7)))</span> +<a name="l00164"></a>00164 <span class="preprocessor"></span> +<a name="l00165"></a>00165 <span class="comment">/* Not all systems have IFF_LOOPBACK */</span> +<a name="l00166"></a>00166 <span class="preprocessor">#ifdef IFF_LOOPBACK</span> +<a name="l00167"></a>00167 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_ISLOOPBACK(p) ((p)->ifr_flags & IFF_LOOPBACK)</span> +<a name="l00168"></a>00168 <span class="preprocessor"></span><span class="preprocessor">#else</span> +<a name="l00169"></a>00169 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_ISLOOPBACK(p) (strcmp((p)->ifr_name, "lo0") == 0)</span> +<a name="l00170"></a>00170 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +<a name="l00171"></a>00171 <span class="preprocessor"></span> +<a name="l00172"></a>00172 <span class="comment">/* advanced mode check */</span> +<a name="l00173"></a>00173 <span class="preprocessor">#define LIBNET_ISADVMODE(x) (x & 0x08)</span> +<a name="l00174"></a>00174 <span class="preprocessor"></span> +<a name="l00175"></a>00175 <span class="comment">/* context queue macros and constants */</span> +<a name="l00176"></a>00176 <span class="preprocessor">#define LIBNET_LABEL_SIZE 64</span> +<a name="l00177"></a>00177 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_LABEL_DEFAULT "cardshark"</span> +<a name="l00178"></a>00178 <span class="preprocessor"></span><span class="preprocessor">#define CQ_LOCK_UNLOCKED (u_int)0x00000000</span> +<a name="l00179"></a>00179 <span class="preprocessor"></span><span class="preprocessor">#define CQ_LOCK_READ (u_int)0x00000001</span> +<a name="l00180"></a>00180 <span class="preprocessor"></span><span class="preprocessor">#define CQ_LOCK_WRITE (u_int)0x00000002</span> +<a name="l00181"></a>00181 <span class="preprocessor"></span> +<a name="l00187"></a><a class="code" href="libnet-macros_8h.html#f36eb84eee10c525720134cfadb50a3e">00187</a> <span class="preprocessor">#define for_each_context_in_cq(l) \</span> +<a name="l00188"></a>00188 <span class="preprocessor"> for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next())</span> +<a name="l00189"></a>00189 <span class="preprocessor"></span> +<a name="l00190"></a>00190 <span class="comment">/* return 1 if write lock is set on cq */</span> +<a name="l00191"></a>00191 <span class="preprocessor">#define cq_is_wlocked() (l_cqd.cq_lock & CQ_LOCK_WRITE)</span> +<a name="l00192"></a>00192 <span class="preprocessor"></span> +<a name="l00193"></a>00193 <span class="comment">/* return 1 if read lock is set on cq */</span> +<a name="l00194"></a>00194 <span class="preprocessor">#define cq_is_rlocked() (l_cqd.cq_lock & CQ_LOCK_READ)</span> +<a name="l00195"></a>00195 <span class="preprocessor"></span> +<a name="l00196"></a>00196 <span class="comment">/* return 1 if any lock is set on cq */</span> +<a name="l00197"></a>00197 <span class="preprocessor">#define cq_is_locked() (l_cqd.cq_lock & (CQ_LOCK_READ | CQ_LOCK_WRITE))</span> +<a name="l00198"></a>00198 <span class="preprocessor"></span> +<a name="l00199"></a>00199 <span class="comment">/* check if a context queue is locked */</span> +<a name="l00200"></a>00200 <span class="preprocessor">#define check_cq_lock(x) (l_cqd.cq_lock & x)</span> +<a name="l00201"></a>00201 <span class="preprocessor"></span> +<a name="l00202"></a>00202 <span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_MACROS_H */</span> +<a name="l00203"></a>00203 +<a name="l00204"></a>00204 <span class="comment">/* EOF */</span> +</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-macros_8h.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-macros_8h.html new file mode 100644 index 0000000..8fa7c45 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-macros_8h.html @@ -0,0 +1,331 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet-macros.h File Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet-macros.h File Reference</h1>libnet macros and symbolic constants <a href="#_details">More...</a> +<p> + +<p> +<a href="libnet-macros_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"> +<tr><td></td></tr> +<tr><td colspan="2"><br><h2>Defines</h2></td></tr> +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#c67cb6e9b00fd492cc3a9247e9477d87">LIBNET_DONT_RESOLVE</a> 0</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#6733960f6981f1930b2d1a489df89cc7">LIBNET_RESOLVE</a> 1</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#5ff9536ca9bbe6f73f69bec817962742">LIBNET_ON</a> 0</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#f87da67c016a9791d256c2d71bf0b0ac">LIBNET_OFF</a> 1</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#9c76fe8da8e411fe1db9f75583dc1b8a">IN6ADDR_ERROR_INIT</a></td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#96a6017948aa76e5a5d415c3227348df">LIBNET_PR2</a> 0</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6e6269313abecb5d687d57d21b2b49a1"></a><!-- doxytag: member="libnet-macros.h::LIBNET_PR8" ref="6e6269313abecb5d687d57d21b2b49a1" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_PR8</b> 1</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="048203597578d34944b2def3b3f1f7ce"></a><!-- doxytag: member="libnet-macros.h::LIBNET_PR16" ref="048203597578d34944b2def3b3f1f7ce" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_PR16</b> 2</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8dfe8585239d898a1d4c8dbeac2356ad"></a><!-- doxytag: member="libnet-macros.h::LIBNET_PRu16" ref="8dfe8585239d898a1d4c8dbeac2356ad" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_PRu16</b> 3</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3b4abb739dd6f288b005395d47e1fe02"></a><!-- doxytag: member="libnet-macros.h::LIBNET_PR32" ref="3b4abb739dd6f288b005395d47e1fe02" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_PR32</b> 4</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6cf838481f5b7726dea022fe92a3770f"></a><!-- doxytag: member="libnet-macros.h::LIBNET_PRu32" ref="6cf838481f5b7726dea022fe92a3770f" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_PRu32</b> 5</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2cb20e30c5929490777df58e91d16f1f"></a><!-- doxytag: member="libnet-macros.h::LIBNET_PRAND_MAX" ref="2cb20e30c5929490777df58e91d16f1f" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_PRAND_MAX</b> 0xffffffff</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#c7301c95aa36d66e8904979650b5189d">LIBNET_MAX_PACKET</a> 0xffff</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1554ef48c7e8f7bd5d6ef2655e59ed07"></a><!-- doxytag: member="libnet-macros.h::IP_MAXPACKET" ref="1554ef48c7e8f7bd5d6ef2655e59ed07" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>IP_MAXPACKET</b> 0xffff</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bf4fcaacb1ad2010711b7c880ec2ed20"></a><!-- doxytag: member="libnet-macros.h::ETHER_ADDR_LEN" ref="bf4fcaacb1ad2010711b7c880ec2ed20" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>ETHER_ADDR_LEN</b> 0x6</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="caac696cbf5938db15328848825b7c7b"></a><!-- doxytag: member="libnet-macros.h::FDDI_ADDR_LEN" ref="caac696cbf5938db15328848825b7c7b" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>FDDI_ADDR_LEN</b> 0x6</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6786a3f4d3531850fda0b55b0f00663c"></a><!-- doxytag: member="libnet-macros.h::TOKEN_RING_ADDR_LEN" ref="6786a3f4d3531850fda0b55b0f00663c" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>TOKEN_RING_ADDR_LEN</b> 0x6</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9c7276e3c31964435cb1e5bd6e589328"></a><!-- doxytag: member="libnet-macros.h::LIBNET_ORG_CODE_SIZE" ref="9c7276e3c31964435cb1e5bd6e589328" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_ORG_CODE_SIZE</b> 0x3</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#2d720375e2ef5a85a62d6069283a5223">LIBNET_ERRBUF_SIZE</a> 0x100</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#e9cd154f8cb482809ee456b6ac43dea5">LIBNET_MAXOPTION_SIZE</a> 0x28</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1630dbffade7ca1bc66c747c9c2137de"></a><!-- doxytag: member="libnet-macros.h::FIX" ref="1630dbffade7ca1bc66c747c9c2137de" args="(n)" --> +#define </td><td class="memItemRight" valign="bottom"><b>FIX</b>(n) (n)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="06d48caec858096d138be9e22aa62ecc"></a><!-- doxytag: member="libnet-macros.h::UNFIX" ref="06d48caec858096d138be9e22aa62ecc" args="(n)" --> +#define </td><td class="memItemRight" valign="bottom"><b>UNFIX</b>(n) (n)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_DO_PAYLOAD</b>(l, p)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ec7ad14d1e9038afd97f5a9145ed150f"></a><!-- doxytag: member="libnet-macros.h::LIBNET_CKSUM_CARRY" ref="ec7ad14d1e9038afd97f5a9145ed150f" args="(x)" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_CKSUM_CARRY</b>(x) (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff))</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="78c38337cc7b1e9ab572ed97d3aaa702"></a><!-- doxytag: member="libnet-macros.h::LIBNET_OSPF_AUTHCPY" ref="78c38337cc7b1e9ab572ed97d3aaa702" args="(x, y)" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_OSPF_AUTHCPY</b>(x, y) memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bba894cfc9afa729b9fae7a7daef128b"></a><!-- doxytag: member="libnet-macros.h::LIBNET_OSPF_CKSUMBUF" ref="bba894cfc9afa729b9fae7a7daef128b" args="(x, y)" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_OSPF_CKSUMBUF</b>(x, y) memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9a522b76610c4ceadb57b6b839f2fdbf"></a><!-- doxytag: member="libnet-macros.h::LIBNET_NTP_DO_LI_VN_MODE" ref="9a522b76610c4ceadb57b6b839f2fdbf" args="(li, vn, md)" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_NTP_DO_LI_VN_MODE</b>(li, vn, md) ((u_int8_t)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7)))</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2b3fe6da087ee254d764d9d3aad20116"></a><!-- doxytag: member="libnet-macros.h::LIBNET_ISLOOPBACK" ref="2b3fe6da087ee254d764d9d3aad20116" args="(p)" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_ISLOOPBACK</b>(p) (strcmp((p)->ifr_name, "lo0") == 0)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="adca40791ffec09cf042012b3c2e0379"></a><!-- doxytag: member="libnet-macros.h::LIBNET_ISADVMODE" ref="adca40791ffec09cf042012b3c2e0379" args="(x)" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_ISADVMODE</b>(x) (x & 0x08)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ad353d408faa7236590b8092b8e608b9"></a><!-- doxytag: member="libnet-macros.h::LIBNET_LABEL_SIZE" ref="ad353d408faa7236590b8092b8e608b9" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_LABEL_SIZE</b> 64</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="dff66f7e27996597f9f486e546edb4e6"></a><!-- doxytag: member="libnet-macros.h::LIBNET_LABEL_DEFAULT" ref="dff66f7e27996597f9f486e546edb4e6" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_LABEL_DEFAULT</b> "cardshark"</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a090ca83cdf9f0828900d826d30d8eba"></a><!-- doxytag: member="libnet-macros.h::CQ_LOCK_UNLOCKED" ref="a090ca83cdf9f0828900d826d30d8eba" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>CQ_LOCK_UNLOCKED</b> (u_int)0x00000000</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="69ad1ac0277dfc2ce9c9b41e9ea83ebc"></a><!-- doxytag: member="libnet-macros.h::CQ_LOCK_READ" ref="69ad1ac0277dfc2ce9c9b41e9ea83ebc" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>CQ_LOCK_READ</b> (u_int)0x00000001</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="eb4a47cde2d621731fd62b709c1dcb21"></a><!-- doxytag: member="libnet-macros.h::CQ_LOCK_WRITE" ref="eb4a47cde2d621731fd62b709c1dcb21" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>CQ_LOCK_WRITE</b> (u_int)0x00000002</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="libnet-macros_8h.html#f36eb84eee10c525720134cfadb50a3e">for_each_context_in_cq</a>(l) for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next())</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ed7ebccea1f0ea8ccde7adbfb273cd74"></a><!-- doxytag: member="libnet-macros.h::cq_is_wlocked" ref="ed7ebccea1f0ea8ccde7adbfb273cd74" args="()" --> +#define </td><td class="memItemRight" valign="bottom"><b>cq_is_wlocked</b>() (l_cqd.cq_lock & CQ_LOCK_WRITE)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bf62890307cdd947227bc8e261565ed7"></a><!-- doxytag: member="libnet-macros.h::cq_is_rlocked" ref="bf62890307cdd947227bc8e261565ed7" args="()" --> +#define </td><td class="memItemRight" valign="bottom"><b>cq_is_rlocked</b>() (l_cqd.cq_lock & CQ_LOCK_READ)</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b21078806a925321484a28f8b3d46fb3"></a><!-- doxytag: member="libnet-macros.h::cq_is_locked" ref="b21078806a925321484a28f8b3d46fb3" args="()" --> +#define </td><td class="memItemRight" valign="bottom"><b>cq_is_locked</b>() (l_cqd.cq_lock & (CQ_LOCK_READ | CQ_LOCK_WRITE))</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f2c376014dcb2eb2d229db3d51e4c177"></a><!-- doxytag: member="libnet-macros.h::check_cq_lock" ref="f2c376014dcb2eb2d229db3d51e4c177" args="(x)" --> +#define </td><td class="memItemRight" valign="bottom"><b>check_cq_lock</b>(x) (l_cqd.cq_lock & x)</td></tr> + +</table> +<hr><a name="_details"></a><h2>Detailed Description</h2> +libnet macros and symbolic constants +<p> +<hr><h2>Define Documentation</h2> +<a class="anchor" name="f36eb84eee10c525720134cfadb50a3e"></a><!-- doxytag: member="libnet-macros.h::for_each_context_in_cq" ref="f36eb84eee10c525720134cfadb50a3e" args="(l)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define for_each_context_in_cq </td> + <td>(</td> + <td class="paramtype">l </td> + <td class="paramname"> </td> + <td> ) </td> + <td width="100%"> for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next())</td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Provides an interface to iterate through the context queue of libnet contexts. Before calling this macro, be sure to set the queue using <a class="el" href="libnet-functions_8h.html#7e98a045ac6e29ca421507d9a200b5aa">libnet_cq_head()</a>. +</div> +</div><p> +<a class="anchor" name="9c76fe8da8e411fe1db9f75583dc1b8a"></a><!-- doxytag: member="libnet-macros.h::IN6ADDR_ERROR_INIT" ref="9c76fe8da8e411fe1db9f75583dc1b8a" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define IN6ADDR_ERROR_INIT </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<b>Value:</b><div class="fragment"><pre class="fragment">{ { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff } } } +</pre></div>IPv6 error code +</div> +</div><p> +<a class="anchor" name="c3d8a2eba10526498a21c2c6d41bf846"></a><!-- doxytag: member="libnet-macros.h::LIBNET_DO_PAYLOAD" ref="c3d8a2eba10526498a21c2c6d41bf846" args="(l, p)" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_DO_PAYLOAD </td> + <td>(</td> + <td class="paramtype">l, <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">p </td> + <td class="paramname"> </td> + <td> ) </td> + <td width="100%"></td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">if</span> ((payload && !payload_s) || (!payload && payload_s)) \ +{ \ + snprintf(l->err_buf, <a class="code" href="libnet-macros_8h.html#2d720375e2ef5a85a62d6069283a5223">LIBNET_ERRBUF_SIZE</a>, \ + <span class="stringliteral">"%s(): payload inconsistency\n"</span>, __func__); \ + <span class="keywordflow">goto</span> bad; \ +} \ +<span class="keywordflow">if</span> (payload && payload_s) \ +{ \ + n = libnet_pblock_append(l, p, payload, payload_s); \ + <span class="keywordflow">if</span> (n == (u_int32_t) - 1) \ + { \ + <span class="keywordflow">goto</span> bad; \ + } \ +} \ +</pre></div> +</div> +</div><p> +<a class="anchor" name="c67cb6e9b00fd492cc3a9247e9477d87"></a><!-- doxytag: member="libnet-macros.h::LIBNET_DONT_RESOLVE" ref="c67cb6e9b00fd492cc3a9247e9477d87" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_DONT_RESOLVE 0 </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Used for libnet's name resolution functions, specifies that no DNS lookups should be performed and the IP address should be kept in numeric form. +</div> +</div><p> +<a class="anchor" name="2d720375e2ef5a85a62d6069283a5223"></a><!-- doxytag: member="libnet-macros.h::LIBNET_ERRBUF_SIZE" ref="2d720375e2ef5a85a62d6069283a5223" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_ERRBUF_SIZE 0x100 </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +The libnet error buffer is 256 bytes long. +</div> +</div><p> +<a class="anchor" name="c7301c95aa36d66e8904979650b5189d"></a><!-- doxytag: member="libnet-macros.h::LIBNET_MAX_PACKET" ref="c7301c95aa36d66e8904979650b5189d" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_MAX_PACKET 0xffff </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +The biggest an IP packet can be -- 65,535 bytes. +</div> +</div><p> +<a class="anchor" name="e9cd154f8cb482809ee456b6ac43dea5"></a><!-- doxytag: member="libnet-macros.h::LIBNET_MAXOPTION_SIZE" ref="e9cd154f8cb482809ee456b6ac43dea5" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_MAXOPTION_SIZE 0x28 </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +IP and TCP options can be up to 40 bytes long. +</div> +</div><p> +<a class="anchor" name="f87da67c016a9791d256c2d71bf0b0ac"></a><!-- doxytag: member="libnet-macros.h::LIBNET_OFF" ref="f87da67c016a9791d256c2d71bf0b0ac" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_OFF 1 </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Used several places, to specify "on" or "one" +</div> +</div><p> +<a class="anchor" name="5ff9536ca9bbe6f73f69bec817962742"></a><!-- doxytag: member="libnet-macros.h::LIBNET_ON" ref="5ff9536ca9bbe6f73f69bec817962742" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_ON 0 </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Used several places, to specify "on" or "one" +</div> +</div><p> +<a class="anchor" name="96a6017948aa76e5a5d415c3227348df"></a><!-- doxytag: member="libnet-macros.h::LIBNET_PR2" ref="96a6017948aa76e5a5d415c3227348df" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_PR2 0 </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Used for <a class="el" href="libnet-functions_8h.html#453d816dc8adffaefc040a1bf5bd9b5f">libnet_get_prand()</a> to specify function disposition +</div> +</div><p> +<a class="anchor" name="6733960f6981f1930b2d1a489df89cc7"></a><!-- doxytag: member="libnet-macros.h::LIBNET_RESOLVE" ref="6733960f6981f1930b2d1a489df89cc7" args="" --> +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define LIBNET_RESOLVE 1 </td> + </tr> + </table> +</div> +<div class="memdoc"> + +<p> +Used for libnet's name resolution functions, specifies that a DNS lookup can be performed if needed to resolve the IP address to a canonical form. +</div> +</div><p> +<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-structures_8h-source.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-structures_8h-source.html new file mode 100644 index 0000000..04795e4 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-structures_8h-source.html @@ -0,0 +1,252 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet-structures.h Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet-structures.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> +<a name="l00002"></a>00002 <span class="comment"> * $Id: libnet-structures.h,v 1.19 2004/11/09 07:05:07 mike Exp $</span> +<a name="l00003"></a>00003 <span class="comment"> *</span> +<a name="l00004"></a>00004 <span class="comment"> * libnet-structures.h - Network routine library structures header file</span> +<a name="l00005"></a>00005 <span class="comment"> *</span> +<a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com></span> +<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span> +<a name="l00008"></a>00008 <span class="comment"> *</span> +<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span> +<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span> +<a name="l00011"></a>00011 <span class="comment"> * are met:</span> +<a name="l00012"></a>00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span> +<a name="l00013"></a>00013 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span> +<a name="l00014"></a>00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span> +<a name="l00015"></a>00015 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span> +<a name="l00016"></a>00016 <span class="comment"> * documentation and/or other materials provided with the distribution.</span> +<a name="l00017"></a>00017 <span class="comment"> *</span> +<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span> +<a name="l00019"></a>00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> +<a name="l00020"></a>00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> +<a name="l00021"></a>00021 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span> +<a name="l00022"></a>00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span> +<a name="l00023"></a>00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span> +<a name="l00024"></a>00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> +<a name="l00025"></a>00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span> +<a name="l00026"></a>00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span> +<a name="l00027"></a>00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span> +<a name="l00028"></a>00028 <span class="comment"> * SUCH DAMAGE.</span> +<a name="l00029"></a>00029 <span class="comment"> *</span> +<a name="l00030"></a>00030 <span class="comment"> */</span> +<a name="l00031"></a>00031 +<a name="l00032"></a>00032 <span class="preprocessor">#ifndef __LIBNET_STRUCTURES_H</span> +<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_STRUCTURES_H</span> +<a name="l00034"></a>00034 <span class="preprocessor"></span> +<a name="l00035"></a>00035 <span class="preprocessor">#if ((__WIN32__) && !(__CYGWIN__))</span> +<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#include "Packet32.h"</span> +<a name="l00037"></a>00037 <span class="preprocessor">#endif</span> +<a name="l00038"></a>00038 <span class="preprocessor"></span> +<a name="l00039"></a>00039 <span class="comment">/* port list chain structure */</span> +<a name="l00040"></a>00040 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_port_list_chain libnet_plist_t; +<a name="l00041"></a>00041 <span class="keyword">struct </span>libnet_port_list_chain +<a name="l00042"></a>00042 { +<a name="l00043"></a>00043 u_int16_t node; <span class="comment">/* node number */</span> +<a name="l00044"></a>00044 u_int16_t bport; <span class="comment">/* beggining port */</span> +<a name="l00045"></a>00045 u_int16_t eport; <span class="comment">/* terminating port */</span> +<a name="l00046"></a>00046 u_int8_t id; <span class="comment">/* global array offset */</span> +<a name="l00047"></a>00047 libnet_plist_t *next; <span class="comment">/* next node in the list */</span> +<a name="l00048"></a>00048 }; +<a name="l00049"></a>00049 +<a name="l00050"></a>00050 +<a name="l00051"></a>00051 <span class="comment">/* libnet statistics structure */</span> +<a name="l00052"></a>00052 <span class="keyword">struct </span><a class="code" href="libnet-functions_8h.html#886dc359d6add4b0608e8611af7e1b35">libnet_stats</a> +<a name="l00053"></a>00053 { +<a name="l00054"></a>00054 <span class="preprocessor">#if (!defined(__WIN32__) || (__CYGWIN__))</span> +<a name="l00055"></a>00055 <span class="preprocessor"></span> u_int64_t packets_sent; <span class="comment">/* packets sent */</span> +<a name="l00056"></a>00056 u_int64_t packet_errors; <span class="comment">/* packets errors */</span> +<a name="l00057"></a>00057 u_int64_t bytes_written; <span class="comment">/* bytes written */</span> +<a name="l00058"></a>00058 <span class="preprocessor">#else</span> +<a name="l00059"></a>00059 <span class="preprocessor"></span> __int64 packets_sent; <span class="comment">/* packets sent */</span> +<a name="l00060"></a>00060 __int64 packet_errors; <span class="comment">/* packets errors */</span> +<a name="l00061"></a>00061 __int64 bytes_written; <span class="comment">/* bytes written */</span> +<a name="l00062"></a>00062 <span class="preprocessor">#endif</span> +<a name="l00063"></a>00063 <span class="preprocessor"></span>}; +<a name="l00064"></a>00064 +<a name="l00065"></a>00065 +<a name="l00066"></a>00066 <span class="comment">/*</span> +<a name="l00067"></a>00067 <span class="comment"> * Libnet ptags are how we identify specific protocol blocks inside the</span> +<a name="l00068"></a>00068 <span class="comment"> * list.</span> +<a name="l00069"></a>00069 <span class="comment"> */</span> +<a name="l00070"></a>00070 <span class="keyword">typedef</span> int32_t libnet_ptag_t; +<a name="l00071"></a>00071 <span class="preprocessor">#define LIBNET_PTAG_INITIALIZER 0</span> +<a name="l00072"></a>00072 <span class="preprocessor"></span> +<a name="l00073"></a>00073 +<a name="l00074"></a>00074 <span class="comment">/*</span> +<a name="l00075"></a>00075 <span class="comment"> * Libnet generic protocol block memory object. Sort of a poor man's mbuf.</span> +<a name="l00076"></a>00076 <span class="comment"> */</span> +<a name="l00077"></a>00077 <span class="keyword">struct </span>libnet_protocol_block +<a name="l00078"></a>00078 { +<a name="l00079"></a>00079 u_int8_t *buf; <span class="comment">/* protocol buffer */</span> +<a name="l00080"></a>00080 u_int32_t b_len; <span class="comment">/* length of buf */</span> +<a name="l00081"></a>00081 u_int16_t h_len; <span class="comment">/* header length (for checksumming) */</span> +<a name="l00082"></a>00082 <span class="comment">/* Unused for IPV4_H block types.</span> +<a name="l00083"></a>00083 <span class="comment"> * For protocols that sit on top of IP, it should be the the amount of</span> +<a name="l00084"></a>00084 <span class="comment"> * buf that is the header, and will be included in the checksum.</span> +<a name="l00085"></a>00085 <span class="comment"> */</span> +<a name="l00086"></a>00086 u_int32_t ip_offset; <span class="comment">/* offset from end of pkt to beginning of IP header for csums */</span> +<a name="l00087"></a>00087 <span class="comment">/* Unused for IPV4_H block types.</span> +<a name="l00088"></a>00088 <span class="comment"> * For protocols that sit on top of IP (UDP, ICMP, ...), they often</span> +<a name="l00089"></a>00089 <span class="comment"> * include some information from the IP header (in the form of a "pseudo</span> +<a name="l00090"></a>00090 <span class="comment"> * header") in their own checksum calculation. To build that</span> +<a name="l00091"></a>00091 <span class="comment"> * pseudo-header, thet need to find the real header.</span> +<a name="l00092"></a>00092 <span class="comment"> */</span> +<a name="l00093"></a>00093 u_int32_t copied; <span class="comment">/* bytes copied - the amount of data copied into buf */</span> +<a name="l00094"></a>00094 <span class="comment">/* Used and updated by libnet_pblock_append(). */</span> +<a name="l00095"></a>00095 u_int8_t type; <span class="comment">/* type of pblock */</span> +<a name="l00096"></a>00096 <span class="comment">/* this needs to be updated every time a new packet builder is added */</span> +<a name="l00097"></a>00097 <span class="preprocessor">#define LIBNET_PBLOCK_ARP_H 0x01 </span><span class="comment">/* ARP header */</span> +<a name="l00098"></a>00098 <span class="preprocessor">#define LIBNET_PBLOCK_DHCPV4_H 0x02 </span><span class="comment">/* DHCP v4 header */</span> +<a name="l00099"></a>00099 <span class="preprocessor">#define LIBNET_PBLOCK_DNSV4_H 0x03 </span><span class="comment">/* DNS v4 header */</span> +<a name="l00100"></a>00100 <span class="preprocessor">#define LIBNET_PBLOCK_ETH_H 0x04 </span><span class="comment">/* Ethernet header */</span> +<a name="l00101"></a>00101 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_H 0x05 </span><span class="comment">/* ICMP v4 base header */</span> +<a name="l00102"></a>00102 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_ECHO_H 0x06 </span><span class="comment">/* ICMP v4 echo header */</span> +<a name="l00103"></a>00103 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_MASK_H 0x07 </span><span class="comment">/* ICMP v4 mask header */</span> +<a name="l00104"></a>00104 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_UNREACH_H 0x08 </span><span class="comment">/* ICMP v4 unreach header */</span> +<a name="l00105"></a>00105 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_TIMXCEED_H 0x09 </span><span class="comment">/* ICMP v4 exceed header */</span> +<a name="l00106"></a>00106 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_REDIRECT_H 0x0a </span><span class="comment">/* ICMP v4 redirect header */</span> +<a name="l00107"></a>00107 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_TS_H 0x0b </span><span class="comment">/* ICMP v4 timestamp header */</span> +<a name="l00108"></a>00108 <span class="preprocessor">#define LIBNET_PBLOCK_IGMP_H 0x0c </span><span class="comment">/* IGMP header */</span> +<a name="l00109"></a>00109 <span class="preprocessor">#define LIBNET_PBLOCK_IPV4_H 0x0d </span><span class="comment">/* IP v4 header */</span> +<a name="l00110"></a>00110 <span class="preprocessor">#define LIBNET_PBLOCK_IPO_H 0x0e </span><span class="comment">/* IP v4 options */</span> +<a name="l00111"></a>00111 <span class="preprocessor">#define LIBNET_PBLOCK_IPDATA 0x0f </span><span class="comment">/* IP data */</span> +<a name="l00112"></a>00112 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_H 0x10 </span><span class="comment">/* OSPF base header */</span> +<a name="l00113"></a>00113 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_HELLO_H 0x11 </span><span class="comment">/* OSPF hello header */</span> +<a name="l00114"></a>00114 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_DBD_H 0x12 </span><span class="comment">/* OSPF dbd header */</span> +<a name="l00115"></a>00115 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSR_H 0x13 </span><span class="comment">/* OSPF lsr header */</span> +<a name="l00116"></a>00116 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSU_H 0x14 </span><span class="comment">/* OSPF lsu header */</span> +<a name="l00117"></a>00117 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSA_H 0x15 </span><span class="comment">/* OSPF lsa header */</span> +<a name="l00118"></a>00118 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_AUTH_H 0x16 </span><span class="comment">/* OSPF auth header */</span> +<a name="l00119"></a>00119 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_CKSUM 0x17 </span><span class="comment">/* OSPF checksum header */</span> +<a name="l00120"></a>00120 <span class="preprocessor">#define LIBNET_PBLOCK_LS_RTR_H 0x18 </span><span class="comment">/* linkstate rtr header */</span> +<a name="l00121"></a>00121 <span class="preprocessor">#define LIBNET_PBLOCK_LS_NET_H 0x19 </span><span class="comment">/* linkstate net header */</span> +<a name="l00122"></a>00122 <span class="preprocessor">#define LIBNET_PBLOCK_LS_SUM_H 0x1a </span><span class="comment">/* linkstate as sum header */</span> +<a name="l00123"></a>00123 <span class="preprocessor">#define LIBNET_PBLOCK_LS_AS_EXT_H 0x1b </span><span class="comment">/* linkstate as ext header */</span> +<a name="l00124"></a>00124 <span class="preprocessor">#define LIBNET_PBLOCK_NTP_H 0x1c </span><span class="comment">/* NTP header */</span> +<a name="l00125"></a>00125 <span class="preprocessor">#define LIBNET_PBLOCK_RIP_H 0x1d </span><span class="comment">/* RIP header */</span> +<a name="l00126"></a>00126 <span class="preprocessor">#define LIBNET_PBLOCK_TCP_H 0x1e </span><span class="comment">/* TCP header */</span> +<a name="l00127"></a>00127 <span class="preprocessor">#define LIBNET_PBLOCK_TCPO_H 0x1f </span><span class="comment">/* TCP options */</span> +<a name="l00128"></a>00128 <span class="preprocessor">#define LIBNET_PBLOCK_TCPDATA 0x20 </span><span class="comment">/* TCP data */</span> +<a name="l00129"></a>00129 <span class="preprocessor">#define LIBNET_PBLOCK_UDP_H 0x21 </span><span class="comment">/* UDP header */</span> +<a name="l00130"></a>00130 <span class="preprocessor">#define LIBNET_PBLOCK_VRRP_H 0x22 </span><span class="comment">/* VRRP header */</span> +<a name="l00131"></a>00131 <span class="preprocessor">#define LIBNET_PBLOCK_DATA_H 0x23 </span><span class="comment">/* generic data */</span> +<a name="l00132"></a>00132 <span class="preprocessor">#define LIBNET_PBLOCK_CDP_H 0x24 </span><span class="comment">/* CDP header */</span> +<a name="l00133"></a>00133 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_ESP_HDR_H 0x25 </span><span class="comment">/* IPSEC ESP header */</span> +<a name="l00134"></a>00134 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_ESP_FTR_H 0x26 </span><span class="comment">/* IPSEC ESP footer */</span> +<a name="l00135"></a>00135 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_AH_H 0x27 </span><span class="comment">/* IPSEC AH header */</span> +<a name="l00136"></a>00136 <span class="preprocessor">#define LIBNET_PBLOCK_802_1Q_H 0x28 </span><span class="comment">/* 802.1q header */</span> +<a name="l00137"></a>00137 <span class="preprocessor">#define LIBNET_PBLOCK_802_2_H 0x29 </span><span class="comment">/* 802.2 header */</span> +<a name="l00138"></a>00138 <span class="preprocessor">#define LIBNET_PBLOCK_802_2SNAP_H 0x2a </span><span class="comment">/* 802.2 SNAP header */</span> +<a name="l00139"></a>00139 <span class="preprocessor">#define LIBNET_PBLOCK_802_3_H 0x2b </span><span class="comment">/* 802.3 header */</span> +<a name="l00140"></a>00140 <span class="preprocessor">#define LIBNET_PBLOCK_STP_CONF_H 0x2c </span><span class="comment">/* STP configuration header */</span> +<a name="l00141"></a>00141 <span class="preprocessor">#define LIBNET_PBLOCK_STP_TCN_H 0x2d </span><span class="comment">/* STP TCN header */</span> +<a name="l00142"></a>00142 <span class="preprocessor">#define LIBNET_PBLOCK_ISL_H 0x2e </span><span class="comment">/* ISL header */</span> +<a name="l00143"></a>00143 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_H 0x2f </span><span class="comment">/* IP v6 header */</span> +<a name="l00144"></a>00144 <span class="preprocessor">#define LIBNET_PBLOCK_802_1X_H 0x30 </span><span class="comment">/* 802.1x header */</span> +<a name="l00145"></a>00145 <span class="preprocessor">#define LIBNET_PBLOCK_RPC_CALL_H 0x31 </span><span class="comment">/* RPC Call header */</span> +<a name="l00146"></a>00146 <span class="preprocessor">#define LIBNET_PBLOCK_MPLS_H 0x32 </span><span class="comment">/* MPLS header */</span> +<a name="l00147"></a>00147 <span class="preprocessor">#define LIBNET_PBLOCK_FDDI_H 0x33 </span><span class="comment">/* FDDI header */</span> +<a name="l00148"></a>00148 <span class="preprocessor">#define LIBNET_PBLOCK_TOKEN_RING_H 0x34 </span><span class="comment">/* TOKEN RING header */</span> +<a name="l00149"></a>00149 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_HEADER_H 0x35 </span><span class="comment">/* BGP4 header */</span> +<a name="l00150"></a>00150 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_OPEN_H 0x36 </span><span class="comment">/* BGP4 open header */</span> +<a name="l00151"></a>00151 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_UPDATE_H 0x37 </span><span class="comment">/* BGP4 update header */</span> +<a name="l00152"></a>00152 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_NOTIFICATION_H 0x38 </span><span class="comment">/* BGP4 notification header */</span> +<a name="l00153"></a>00153 <span class="preprocessor">#define LIBNET_PBLOCK_GRE_H 0x39 </span><span class="comment">/* GRE header */</span> +<a name="l00154"></a>00154 <span class="preprocessor">#define LIBNET_PBLOCK_GRE_SRE_H 0x3a </span><span class="comment">/* GRE SRE header */</span> +<a name="l00155"></a>00155 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_FRAG_H 0x3b </span><span class="comment">/* IPv6 frag header */</span> +<a name="l00156"></a>00156 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_ROUTING_H 0x3c </span><span class="comment">/* IPv6 routing header */</span> +<a name="l00157"></a>00157 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_DESTOPTS_H 0x3d </span><span class="comment">/* IPv6 dest opts header */</span> +<a name="l00158"></a>00158 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_HBHOPTS_H 0x3e </span><span class="comment">/* IPv6 hop/hop opts header */</span> +<a name="l00159"></a>00159 <span class="preprocessor">#define LIBNET_PBLOCK_SEBEK_H 0x3f </span><span class="comment">/* Sebek header */</span> +<a name="l00160"></a>00160 <span class="preprocessor">#define LIBNET_PBLOCK_HSRP_H 0x40 </span><span class="comment">/* HSRP header */</span> +<a name="l00161"></a>00161 u_int8_t flags; <span class="comment">/* control flags */</span> +<a name="l00162"></a>00162 <span class="preprocessor">#define LIBNET_PBLOCK_DO_CHECKSUM 0x01 </span><span class="comment">/* needs a checksum */</span> +<a name="l00163"></a>00163 libnet_ptag_t ptag; <span class="comment">/* protocol block tag */</span> +<a name="l00164"></a>00164 <span class="keyword">struct </span>libnet_protocol_block *next; <span class="comment">/* next pblock */</span> +<a name="l00165"></a>00165 <span class="keyword">struct </span>libnet_protocol_block *prev; <span class="comment">/* prev pblock */</span> +<a name="l00166"></a>00166 }; +<a name="l00167"></a>00167 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_protocol_block libnet_pblock_t; +<a name="l00168"></a>00168 +<a name="l00169"></a>00169 +<a name="l00170"></a>00170 <span class="comment">/*</span> +<a name="l00171"></a>00171 <span class="comment"> * Libnet context</span> +<a name="l00172"></a>00172 <span class="comment"> * Opaque structure. Nothing in here should ever been touched first hand by</span> +<a name="l00173"></a>00173 <span class="comment"> * the applications programmer.</span> +<a name="l00174"></a>00174 <span class="comment"> */</span> +<a name="l00175"></a>00175 <span class="keyword">struct </span>libnet_context +<a name="l00176"></a>00176 { +<a name="l00177"></a>00177 <span class="preprocessor">#if ((__WIN32__) && !(__CYGWIN__)) </span> +<a name="l00178"></a>00178 <span class="preprocessor"></span> SOCKET fd; +<a name="l00179"></a>00179 LPADAPTER lpAdapter; +<a name="l00180"></a>00180 <span class="preprocessor">#else</span> +<a name="l00181"></a>00181 <span class="preprocessor"></span> <span class="keywordtype">int</span> fd; <span class="comment">/* file descriptor of packet device */</span> +<a name="l00182"></a>00182 <span class="preprocessor">#endif</span> +<a name="l00183"></a>00183 <span class="preprocessor"></span> <span class="keywordtype">int</span> injection_type; <span class="comment">/* raw (ipv4 or ipv6) or link */</span> +<a name="l00184"></a>00184 <span class="preprocessor">#define LIBNET_LINK 0x00 </span><span class="comment">/* link-layer interface */</span> +<a name="l00185"></a>00185 <span class="preprocessor">#define LIBNET_RAW4 0x01 </span><span class="comment">/* raw socket interface (ipv4) */</span> +<a name="l00186"></a>00186 <span class="preprocessor">#define LIBNET_RAW6 0x02 </span><span class="comment">/* raw socket interface (ipv6) */</span> +<a name="l00187"></a>00187 <span class="comment">/* the following should actually set a flag in the flags variable above */</span> +<a name="l00188"></a>00188 <span class="preprocessor">#define LIBNET_LINK_ADV 0x08 </span><span class="comment">/* advanced mode link-layer */</span> +<a name="l00189"></a>00189 <span class="preprocessor">#define LIBNET_RAW4_ADV 0x09 </span><span class="comment">/* advanced mode raw socket (ipv4) */</span> +<a name="l00190"></a>00190 <span class="preprocessor">#define LIBNET_RAW6_ADV 0x0a </span><span class="comment">/* advanced mode raw socket (ipv6) */</span> +<a name="l00191"></a>00191 <span class="preprocessor">#define LIBNET_ADV_MASK 0x08 </span><span class="comment">/* mask to determine adv mode */</span> +<a name="l00192"></a>00192 +<a name="l00193"></a>00193 libnet_pblock_t *protocol_blocks; <span class="comment">/* protocol headers / data */</span> +<a name="l00194"></a>00194 libnet_pblock_t *pblock_end; <span class="comment">/* last node in list */</span> +<a name="l00195"></a>00195 u_int32_t n_pblocks; <span class="comment">/* number of pblocks */</span> +<a name="l00196"></a>00196 +<a name="l00197"></a>00197 <span class="keywordtype">int</span> link_type; <span class="comment">/* link-layer type */</span> +<a name="l00198"></a>00198 <span class="keywordtype">int</span> link_offset; <span class="comment">/* link-layer header size */</span> +<a name="l00199"></a>00199 <span class="keywordtype">int</span> aligner; <span class="comment">/* used to align packets */</span> +<a name="l00200"></a>00200 <span class="keywordtype">char</span> *device; <span class="comment">/* device name */</span> +<a name="l00201"></a>00201 +<a name="l00202"></a>00202 <span class="keyword">struct </span><a class="code" href="libnet-functions_8h.html#886dc359d6add4b0608e8611af7e1b35">libnet_stats</a> stats; <span class="comment">/* statistics */</span> +<a name="l00203"></a>00203 libnet_ptag_t ptag_state; <span class="comment">/* state holder for pblock tag */</span> +<a name="l00204"></a>00204 <span class="keywordtype">char</span> label[LIBNET_LABEL_SIZE]; <span class="comment">/* textual label for cq interface */</span> +<a name="l00205"></a>00205 +<a name="l00206"></a>00206 <span class="keywordtype">char</span> err_buf[<a class="code" href="libnet-macros_8h.html#2d720375e2ef5a85a62d6069283a5223">LIBNET_ERRBUF_SIZE</a>]; <span class="comment">/* error buffer */</span> +<a name="l00207"></a>00207 u_int32_t total_size; <span class="comment">/* total size */</span> +<a name="l00208"></a>00208 }; +<a name="l00209"></a>00209 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_context libnet_t; +<a name="l00210"></a>00210 +<a name="l00211"></a>00211 <span class="comment">/*</span> +<a name="l00212"></a>00212 <span class="comment"> * Libnet context queue structure</span> +<a name="l00213"></a>00213 <span class="comment"> * Opaque structure. Nothing in here should ever been touched first hand by</span> +<a name="l00214"></a>00214 <span class="comment"> * the applications programmer.</span> +<a name="l00215"></a>00215 <span class="comment"> */</span> +<a name="l00216"></a>00216 <span class="keyword">typedef</span> <span class="keyword">struct </span>_libnet_context_queue libnet_cq_t; +<a name="l00217"></a>00217 <span class="keyword">struct </span>_libnet_context_queue +<a name="l00218"></a>00218 { +<a name="l00219"></a>00219 libnet_t *context; <span class="comment">/* pointer to libnet context */</span> +<a name="l00220"></a>00220 libnet_cq_t *next; <span class="comment">/* next node in the list */</span> +<a name="l00221"></a>00221 libnet_cq_t *prev; <span class="comment">/* previous node in the list */</span> +<a name="l00222"></a>00222 }; +<a name="l00223"></a>00223 +<a name="l00224"></a>00224 <span class="keyword">struct </span>_libnet_context_queue_descriptor +<a name="l00225"></a>00225 { +<a name="l00226"></a>00226 u_int32_t node; <span class="comment">/* number of nodes in the list */</span> +<a name="l00227"></a>00227 u_int32_t cq_lock; <span class="comment">/* lock status */</span> +<a name="l00228"></a>00228 libnet_cq_t *current; <span class="comment">/* current context */</span> +<a name="l00229"></a>00229 }; +<a name="l00230"></a>00230 <span class="keyword">typedef</span> <span class="keyword">struct </span>_libnet_context_queue_descriptor libnet_cqd_t; +<a name="l00231"></a>00231 +<a name="l00232"></a>00232 <span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_STRUCTURES_H */</span> +<a name="l00233"></a>00233 +<a name="l00234"></a>00234 <span class="comment">/* EOF */</span> +</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-types_8h-source.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-types_8h-source.html new file mode 100644 index 0000000..c6a69f5 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet-types_8h-source.html @@ -0,0 +1,66 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet-types.h Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet-types.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> +<a name="l00002"></a>00002 <span class="comment"> * $Id: libnet-types.h,v 1.3 2004/01/03 20:31:00 mike Exp $</span> +<a name="l00003"></a>00003 <span class="comment"> *</span> +<a name="l00004"></a>00004 <span class="comment"> * libnet-types.h - Network routine library macro header file</span> +<a name="l00005"></a>00005 <span class="comment"> *</span> +<a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com></span> +<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span> +<a name="l00008"></a>00008 <span class="comment"> *</span> +<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span> +<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span> +<a name="l00011"></a>00011 <span class="comment"> * are met:</span> +<a name="l00012"></a>00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span> +<a name="l00013"></a>00013 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span> +<a name="l00014"></a>00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span> +<a name="l00015"></a>00015 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span> +<a name="l00016"></a>00016 <span class="comment"> * documentation and/or other materials provided with the distribution.</span> +<a name="l00017"></a>00017 <span class="comment"> *</span> +<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span> +<a name="l00019"></a>00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> +<a name="l00020"></a>00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> +<a name="l00021"></a>00021 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span> +<a name="l00022"></a>00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span> +<a name="l00023"></a>00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span> +<a name="l00024"></a>00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> +<a name="l00025"></a>00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span> +<a name="l00026"></a>00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span> +<a name="l00027"></a>00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span> +<a name="l00028"></a>00028 <span class="comment"> * SUCH DAMAGE.</span> +<a name="l00029"></a>00029 <span class="comment"> *</span> +<a name="l00030"></a>00030 <span class="comment"> */</span> +<a name="l00031"></a>00031 +<a name="l00032"></a>00032 <span class="preprocessor">#ifndef __LIBNET_TYPES_H</span> +<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_TYPES_H</span> +<a name="l00034"></a>00034 <span class="preprocessor"></span> +<a name="l00035"></a>00035 <span class="preprocessor">#if (__sun__ && __svr4__)</span> +<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="comment">/* libnet should be using the standard type names, but in the short term</span> +<a name="l00037"></a>00037 <span class="comment"> * define our non-standard type names in terms of the standard names.</span> +<a name="l00038"></a>00038 <span class="comment"> */</span> +<a name="l00039"></a>00039 <span class="preprocessor">#include <inttypes.h></span> +<a name="l00040"></a>00040 <span class="keyword">typedef</span> uint8_t u_int8_t; +<a name="l00041"></a>00041 <span class="keyword">typedef</span> uint16_t u_int16_t; +<a name="l00042"></a>00042 <span class="keyword">typedef</span> uint32_t u_int32_t; +<a name="l00043"></a>00043 <span class="keyword">typedef</span> uint64_t u_int64_t; +<a name="l00044"></a>00044 <span class="preprocessor">#endif</span> +<a name="l00045"></a>00045 <span class="preprocessor"></span> +<a name="l00046"></a>00046 <span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_TYPES_H */</span> +<a name="l00047"></a>00047 +<a name="l00048"></a>00048 <span class="comment">/* EOF */</span> +</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet_8h-source.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet_8h-source.html new file mode 100644 index 0000000..53a782b --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet_8h-source.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet.h Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet.h</h1><a href="libnet_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> +<a name="l00002"></a>00002 <span class="comment"> * $Id: libnet.h.in,v 1.5 2004/01/17 07:51:19 mike Exp $</span> +<a name="l00003"></a>00003 <span class="comment"> *</span> +<a name="l00004"></a>00004 <span class="comment"> * libnet.h - Network routine library header file</span> +<a name="l00005"></a>00005 <span class="comment"> *</span> +<a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com></span> +<a name="l00007"></a>00007 <span class="comment"> * All rights reserved.</span> +<a name="l00008"></a>00008 <span class="comment"> *</span> +<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span> +<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span> +<a name="l00011"></a>00011 <span class="comment"> * are met:</span> +<a name="l00012"></a>00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span> +<a name="l00013"></a>00013 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span> +<a name="l00014"></a>00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span> +<a name="l00015"></a>00015 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span> +<a name="l00016"></a>00016 <span class="comment"> * documentation and/or other materials provided with the distribution.</span> +<a name="l00017"></a>00017 <span class="comment"> *</span> +<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span> +<a name="l00019"></a>00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> +<a name="l00020"></a>00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> +<a name="l00021"></a>00021 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span> +<a name="l00022"></a>00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span> +<a name="l00023"></a>00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span> +<a name="l00024"></a>00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> +<a name="l00025"></a>00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span> +<a name="l00026"></a>00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span> +<a name="l00027"></a>00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span> +<a name="l00028"></a>00028 <span class="comment"> * SUCH DAMAGE.</span> +<a name="l00029"></a>00029 <span class="comment"> *</span> +<a name="l00030"></a>00030 <span class="comment"> */</span> +<a name="l00031"></a>00031 +<a name="l00032"></a>00032 <span class="preprocessor">#ifndef __LIBNET_H</span> +<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_H</span> +<a name="l00034"></a>00034 <span class="preprocessor"></span> +<a name="l00058"></a>00058 <span class="preprocessor">#ifdef __cplusplus</span> +<a name="l00059"></a>00059 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> { +<a name="l00060"></a>00060 <span class="preprocessor">#endif</span> +<a name="l00061"></a>00061 <span class="preprocessor"></span> +<a name="l00062"></a>00062 <span class="preprocessor">#define _GNU_SOURCE</span> +<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#include <stdio.h></span> +<a name="l00064"></a>00064 <span class="preprocessor">#include <string.h></span> +<a name="l00065"></a>00065 <span class="preprocessor">#include <unistd.h></span> +<a name="l00066"></a>00066 <span class="preprocessor">#include <fcntl.h></span> +<a name="l00067"></a>00067 <span class="preprocessor">#include <signal.h></span> +<a name="l00068"></a>00068 <span class="preprocessor">#include <stdlib.h></span> +<a name="l00069"></a>00069 <span class="preprocessor">#if !defined(__WIN32__)</span> +<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#include <sys/ioctl.h></span> +<a name="l00071"></a>00071 <span class="preprocessor">#endif </span><span class="comment">/* __WIN32__ */</span> +<a name="l00072"></a>00072 <span class="preprocessor">#if defined(HAVE_SYS_SOCKIO_H) && !defined(SIOCGIFADDR)</span> +<a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#include <sys/sockio.h></span> +<a name="l00074"></a>00074 <span class="preprocessor">#endif</span> +<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#include <sys/stat.h></span> +<a name="l00076"></a>00076 <span class="preprocessor">#include <sys/types.h></span> +<a name="l00077"></a>00077 <span class="preprocessor">#include <ctype.h></span> +<a name="l00078"></a>00078 <span class="preprocessor">#if !defined(__WIN32__)</span> +<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#include <sys/socket.h></span> +<a name="l00080"></a>00080 <span class="preprocessor">#include <netinet/in.h></span> +<a name="l00081"></a>00081 <span class="preprocessor">#include <netinet/in_systm.h></span> +<a name="l00082"></a>00082 <span class="preprocessor">#include <netinet/ip.h></span> +<a name="l00083"></a>00083 <span class="preprocessor">#include <net/if.h></span> +<a name="l00084"></a>00084 <span class="preprocessor">#else </span><span class="comment">/* __WIN32__ */</span> +<a name="l00085"></a>00085 <span class="preprocessor">#if (__CYGWIN__)</span> +<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">#include <sys/socket.h></span> +<a name="l00087"></a>00087 <span class="preprocessor">#endif</span> +<a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#include <ws2tcpip.h></span> +<a name="l00089"></a>00089 <span class="preprocessor">#include <windows.h></span> +<a name="l00090"></a>00090 <span class="preprocessor">#include <winsock2.h></span> +<a name="l00091"></a>00091 <span class="preprocessor">#include <win32/in_systm.h></span> +<a name="l00092"></a>00092 <span class="preprocessor">#endif </span><span class="comment">/* __WIN32__ */</span> +<a name="l00093"></a>00093 <span class="preprocessor">#if !(__linux__) && !(__WIN32__) && !(__APPLE__) && !(__CYGWIN__) && !(__GNU__)</span> +<a name="l00094"></a>00094 <span class="preprocessor"></span><span class="preprocessor">#include <netinet/ip_var.h></span> +<a name="l00095"></a>00095 <span class="preprocessor">#else </span><span class="comment">/* __linux__ */</span> +<a name="l00096"></a>00096 <span class="preprocessor">#if (HAVE_NET_ETHERNET_H)</span> +<a name="l00097"></a>00097 <span class="preprocessor"></span><span class="preprocessor">#include <net/ethernet.h></span> +<a name="l00098"></a>00098 <span class="preprocessor">#endif </span><span class="comment">/* HAVE_NET_ETHERNET_H */</span> +<a name="l00099"></a>00099 <span class="preprocessor">#endif </span><span class="comment">/* __linux__ */</span> +<a name="l00100"></a>00100 <span class="preprocessor">#if !defined(__WIN32__)</span> +<a name="l00101"></a>00101 <span class="preprocessor"></span><span class="preprocessor">#include <netinet/tcp.h></span> +<a name="l00102"></a>00102 <span class="preprocessor">#include <netinet/udp.h></span> +<a name="l00103"></a>00103 <span class="preprocessor">#if (__linux__) && !(__GLIBC__)</span> +<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="comment">/* we get multiple definitions of IGMP_AGE_THRESHOLD if we include netinet */</span> +<a name="l00105"></a>00105 <span class="preprocessor">#include <linux/igmp.h></span> +<a name="l00106"></a>00106 <span class="preprocessor">#else</span> +<a name="l00107"></a>00107 <span class="preprocessor"></span><span class="preprocessor">#include <netinet/igmp.h></span> +<a name="l00108"></a>00108 <span class="preprocessor">#endif</span> +<a name="l00109"></a>00109 <span class="preprocessor"></span><span class="preprocessor">#include <arpa/inet.h></span> +<a name="l00110"></a>00110 <span class="preprocessor">#include <sys/time.h></span> +<a name="l00111"></a>00111 <span class="preprocessor">#include <netdb.h></span> +<a name="l00112"></a>00112 <span class="preprocessor">#endif </span><span class="comment">/* __WIN32__ */</span> +<a name="l00113"></a>00113 <span class="preprocessor">#include <errno.h></span> +<a name="l00114"></a>00114 <span class="preprocessor">#include <stdarg.h></span> +<a name="l00115"></a>00115 +<a name="l00116"></a>00116 <span class="preprocessor">#define LIBNET_VERSION "1.1.4"</span> +<a name="l00117"></a>00117 <span class="preprocessor"></span> +<a name="l00118"></a>00118 <span class="preprocessor">#define LIBNET_LIL_ENDIAN 1</span> +<a name="l00119"></a>00119 <span class="preprocessor"></span> +<a name="l00120"></a>00120 <span class="preprocessor">#include "./libnet/libnet-types.h"</span> +<a name="l00121"></a>00121 <span class="preprocessor">#include "<a class="code" href="libnet-macros_8h.html" title="libnet macros and symbolic constants">./libnet/libnet-macros.h</a>"</span> +<a name="l00122"></a>00122 <span class="preprocessor">#include "./libnet/libnet-headers.h"</span> +<a name="l00123"></a>00123 <span class="preprocessor">#include "./libnet/libnet-structures.h"</span> +<a name="l00124"></a>00124 <span class="preprocessor">#include "./libnet/libnet-asn1.h"</span> +<a name="l00125"></a>00125 <span class="preprocessor">#include "<a class="code" href="libnet-functions_8h.html" title="libnet exported function prototypes">./libnet/libnet-functions.h</a>"</span> +<a name="l00126"></a>00126 +<a name="l00127"></a>00127 <span class="preprocessor">#ifdef __cplusplus</span> +<a name="l00128"></a>00128 <span class="preprocessor"></span>} +<a name="l00129"></a>00129 <span class="preprocessor">#endif</span> +<a name="l00130"></a>00130 <span class="preprocessor"></span> +<a name="l00131"></a>00131 <span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_H */</span> +<a name="l00132"></a>00132 +<a name="l00133"></a>00133 <span class="comment">/* EOF */</span> +</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet_8h.html b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet_8h.html new file mode 100644 index 0000000..2dd7d4e --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/libnet_8h.html @@ -0,0 +1,68 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>libnet: libnet.h File Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +<link href="tabs.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.5.3 --> +<div class="tabs"> + <ul> + <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> +<h1>libnet.h File Reference</h1>toplevel libnet header file <a href="#_details">More...</a> +<p> +<code>#include <stdio.h></code><br> +<code>#include <string.h></code><br> +<code>#include <unistd.h></code><br> +<code>#include <fcntl.h></code><br> +<code>#include <signal.h></code><br> +<code>#include <stdlib.h></code><br> +<code>#include <sys/ioctl.h></code><br> +<code>#include <sys/stat.h></code><br> +<code>#include <sys/types.h></code><br> +<code>#include <ctype.h></code><br> +<code>#include <sys/socket.h></code><br> +<code>#include <netinet/in.h></code><br> +<code>#include <netinet/in_systm.h></code><br> +<code>#include <netinet/ip.h></code><br> +<code>#include <net/if.h></code><br> +<code>#include <netinet/ip_var.h></code><br> +<code>#include <netinet/tcp.h></code><br> +<code>#include <netinet/udp.h></code><br> +<code>#include <netinet/igmp.h></code><br> +<code>#include <arpa/inet.h></code><br> +<code>#include <sys/time.h></code><br> +<code>#include <netdb.h></code><br> +<code>#include <errno.h></code><br> +<code>#include <stdarg.h></code><br> +<code>#include "./libnet/libnet-types.h"</code><br> +<code>#include "<a class="el" href="libnet-macros_8h-source.html">./libnet/libnet-macros.h</a>"</code><br> +<code>#include "./libnet/libnet-headers.h"</code><br> +<code>#include "./libnet/libnet-structures.h"</code><br> +<code>#include "./libnet/libnet-asn1.h"</code><br> +<code>#include "<a class="el" href="libnet-functions_8h-source.html">./libnet/libnet-functions.h</a>"</code><br> + +<p> +<a href="libnet_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"> +<tr><td></td></tr> +<tr><td colspan="2"><br><h2>Defines</h2></td></tr> +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="369266c24eacffb87046522897a570d5"></a><!-- doxytag: member="libnet.h::_GNU_SOURCE" ref="369266c24eacffb87046522897a570d5" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>_GNU_SOURCE</b></td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="52f7f3528df6efb97d6abb6428738571"></a><!-- doxytag: member="libnet.h::LIBNET_VERSION" ref="52f7f3528df6efb97d6abb6428738571" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_VERSION</b> "1.1.4"</td></tr> + +<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="70dbe3ba5a0339df89fafb4bf14e172b"></a><!-- doxytag: member="libnet.h::LIBNET_LIL_ENDIAN" ref="70dbe3ba5a0339df89fafb4bf14e172b" args="" --> +#define </td><td class="memItemRight" valign="bottom"><b>LIBNET_LIL_ENDIAN</b> 1</td></tr> + +</table> +<hr><a name="_details"></a><h2>Detailed Description</h2> +toplevel libnet header file +<p> +<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 9 16:16:39 2009 for libnet by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> +</body> +</html> diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_b.gif b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_b.gif Binary files differnew file mode 100644 index 0000000..0d62348 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_b.gif diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_l.gif b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_l.gif Binary files differnew file mode 100644 index 0000000..9b1e633 --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_l.gif diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_r.gif b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_r.gif Binary files differnew file mode 100644 index 0000000..ce9dd9f --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tab_r.gif diff --git a/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tabs.css b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tabs.css new file mode 100644 index 0000000..c37faaf --- /dev/null +++ b/unmerged/debian/libnet1-doc/usr/share/doc/libnet1-doc/html/tabs.css @@ -0,0 +1,102 @@ +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84B0C7; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1A419D; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI.current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI.current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.nav +{ + background : none; + border : none; + border-bottom : 1px solid #84B0C7; +} diff --git a/unmerged/debian/libnet1.dirs b/unmerged/debian/libnet1.dirs new file mode 100644 index 0000000..4a6ae2c --- /dev/null +++ b/unmerged/debian/libnet1.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/share/doc/libnet1 diff --git a/unmerged/debian/libnet1.docs b/unmerged/debian/libnet1.docs new file mode 100644 index 0000000..a7cd0cb --- /dev/null +++ b/unmerged/debian/libnet1.docs @@ -0,0 +1,4 @@ +README +doc/BUGS +doc/CONTRIB +doc/TODO diff --git a/unmerged/debian/libnet1.install b/unmerged/debian/libnet1.install new file mode 100644 index 0000000..c6ab3ca --- /dev/null +++ b/unmerged/debian/libnet1.install @@ -0,0 +1 @@ +usr/lib/libnet.so.* diff --git a/unmerged/debian/libnet1.postinst.debhelper b/unmerged/debian/libnet1.postinst.debhelper new file mode 100644 index 0000000..3d89d3e --- /dev/null +++ b/unmerged/debian/libnet1.postinst.debhelper @@ -0,0 +1,5 @@ +# Automatically added by dh_makeshlibs +if [ "$1" = "configure" ]; then + ldconfig +fi +# End automatically added section diff --git a/unmerged/debian/libnet1.postrm.debhelper b/unmerged/debian/libnet1.postrm.debhelper new file mode 100644 index 0000000..7f44047 --- /dev/null +++ b/unmerged/debian/libnet1.postrm.debhelper @@ -0,0 +1,5 @@ +# Automatically added by dh_makeshlibs +if [ "$1" = "remove" ]; then + ldconfig +fi +# End automatically added section diff --git a/unmerged/debian/libnet1.substvars b/unmerged/debian/libnet1.substvars new file mode 100644 index 0000000..17c2baa --- /dev/null +++ b/unmerged/debian/libnet1.substvars @@ -0,0 +1 @@ +shlibs:Depends=libc6 (>= 2.6-1) diff --git a/unmerged/debian/libnet1.symbols b/unmerged/debian/libnet1.symbols new file mode 100644 index 0000000..e56aca8 --- /dev/null +++ b/unmerged/debian/libnet1.symbols @@ -0,0 +1,158 @@ +libnet.so.1 libnet1 #MINVER# + __libnet_print_vers@Base 1.1.2.1 + all_lists@Base 1.1.2.1 + in6addr_error@Base 1.1.2.1 + libnet_addr2name4@Base 1.1.2.1 + libnet_addr2name4_r@Base 1.1.2.1 + libnet_addr2name6_r@Base 1.1.2.1 + libnet_adv_cull_header@Base 1.1.2.1 + libnet_adv_cull_packet@Base 1.1.2.1 + libnet_adv_free_packet@Base 1.1.2.1 + libnet_adv_write_link@Base 1.1.2.1 + libnet_autobuild_arp@Base 1.1.2.1 + libnet_autobuild_ethernet@Base 1.1.2.1 + libnet_autobuild_fddi@Base 1.1.2.1 + libnet_autobuild_ipv4@Base 1.1.2.1 + libnet_autobuild_ipv6@Base 1.1.2.1 + libnet_autobuild_token_ring@Base 1.1.2.1 + libnet_build_802_1q@Base 1.1.2.1 + libnet_build_802_1x@Base 1.1.2.1 + libnet_build_802_2@Base 1.1.2.1 + libnet_build_802_2snap@Base 1.1.2.1 + libnet_build_802_3@Base 1.1.2.1 + libnet_build_arp@Base 1.1.2.1 + libnet_build_asn1_bitstring@Base 1.1.2.1 + libnet_build_asn1_header@Base 1.1.2.1 + libnet_build_asn1_int@Base 1.1.2.1 + libnet_build_asn1_length@Base 1.1.2.1 + libnet_build_asn1_null@Base 1.1.2.1 + libnet_build_asn1_objid@Base 1.1.2.1 + libnet_build_asn1_sequence@Base 1.1.2.1 + libnet_build_asn1_string@Base 1.1.2.1 + libnet_build_asn1_uint@Base 1.1.2.1 + libnet_build_bgp4_header@Base 1.1.2.1 + libnet_build_bgp4_notification@Base 1.1.2.1 + libnet_build_bgp4_open@Base 1.1.2.1 + libnet_build_bgp4_update@Base 1.1.2.1 + libnet_build_bootpv4@Base 1.1.2.1 + libnet_build_cdp@Base 1.1.2.1 + libnet_build_cdp_value@Base 1.1.2.1 + libnet_build_data@Base 1.1.2.1 + libnet_build_dhcpv4@Base 1.1.2.1 + libnet_build_dnsv4@Base 1.1.2.1 + libnet_build_egre@Base 1.1.2.1 + libnet_build_ethernet@Base 1.1.2.1 + libnet_build_fddi@Base 1.1.2.1 + libnet_build_gre@Base 1.1.2.1 + libnet_build_gre_last_sre@Base 1.1.2.1 + libnet_build_gre_sre@Base 1.1.2.1 + libnet_build_icmpv4_echo@Base 1.1.2.1 + libnet_build_icmpv4_mask@Base 1.1.2.1 + libnet_build_icmpv4_redirect@Base 1.1.2.1 + libnet_build_icmpv4_timeexceed@Base 1.1.2.1 + libnet_build_icmpv4_timestamp@Base 1.1.2.1 + libnet_build_icmpv4_unreach@Base 1.1.2.1 + libnet_build_igmp@Base 1.1.2.1 + libnet_build_ipsec_ah@Base 1.1.2.1 + libnet_build_ipsec_esp_ftr@Base 1.1.2.1 + libnet_build_ipsec_esp_hdr@Base 1.1.2.1 + libnet_build_ipv4@Base 1.1.2.1 + libnet_build_ipv4_options@Base 1.1.2.1 + libnet_build_ipv6@Base 1.1.2.1 + libnet_build_ipv6_destopts@Base 1.1.2.1 + libnet_build_ipv6_frag@Base 1.1.2.1 + libnet_build_ipv6_hbhopts@Base 1.1.2.1 + libnet_build_ipv6_routing@Base 1.1.2.1 + libnet_build_isl@Base 1.1.2.1 + libnet_build_mpls@Base 1.1.2.1 + libnet_build_ntp@Base 1.1.2.1 + libnet_build_ospfv2@Base 1.1.2.1 + libnet_build_ospfv2_dbd@Base 1.1.2.1 + libnet_build_ospfv2_hello@Base 1.1.2.1 + libnet_build_ospfv2_lsa@Base 1.1.2.1 + libnet_build_ospfv2_lsa_as@Base 1.1.2.1 + libnet_build_ospfv2_lsa_net@Base 1.1.2.1 + libnet_build_ospfv2_lsa_rtr@Base 1.1.2.1 + libnet_build_ospfv2_lsa_sum@Base 1.1.2.1 + libnet_build_ospfv2_lsr@Base 1.1.2.1 + libnet_build_ospfv2_lsu@Base 1.1.2.1 + libnet_build_rip@Base 1.1.2.1 + libnet_build_rpc_call@Base 1.1.2.1 + libnet_build_sebek@Base 1.1.2.1 + libnet_build_snmp@Base 1.1.2.1 + libnet_build_stp_conf@Base 1.1.2.1 + libnet_build_stp_tcn@Base 1.1.2.1 + libnet_build_tcp@Base 1.1.2.1 + libnet_build_tcp_options@Base 1.1.2.1 + libnet_build_token_ring@Base 1.1.2.1 + libnet_build_udp@Base 1.1.2.1 + libnet_build_vrrp@Base 1.1.2.1 + libnet_check_iface@Base 1.1.2.1 + libnet_clear_packet@Base 1.1.2.1 + libnet_close_link@Base 1.1.2.1 + libnet_close_raw4@Base 1.1.2.1 + libnet_close_raw6@Base 1.1.2.1 + libnet_compute_crc@Base 1.1.2.1 + libnet_cq_add@Base 1.1.2.1 + libnet_cq_destroy@Base 1.1.2.1 + libnet_cq_end_loop@Base 1.1.2.1 + libnet_cq_find_by_label@Base 1.1.2.1 + libnet_cq_getlabel@Base 1.1.2.1 + libnet_cq_head@Base 1.1.2.1 + libnet_cq_last@Base 1.1.2.1 + libnet_cq_next@Base 1.1.2.1 + libnet_cq_remove@Base 1.1.2.1 + libnet_cq_remove_by_label@Base 1.1.2.1 + libnet_cq_size@Base 1.1.2.1 + libnet_destroy@Base 1.1.2.1 + libnet_diag_dump_context@Base 1.1.2.1 + libnet_diag_dump_hex@Base 1.1.2.1 + libnet_diag_dump_pblock@Base 1.1.2.1 + libnet_diag_dump_pblock_type@Base 1.1.2.1 + libnet_do_checksum@Base 1.1.2.1 + libnet_get_hwaddr@Base 1.1.2.1 + libnet_get_ipaddr4@Base 1.1.2.1 + libnet_get_ipaddr6@Base 1.1.2.1 + libnet_get_prand@Base 1.1.2.1 + libnet_getdevice@Base 1.1.2.1 + libnet_geterror@Base 1.1.2.1 + libnet_getfd@Base 1.1.2.1 + libnet_getgre_length@Base 1.1.2.1 + libnet_getpacket_size@Base 1.1.2.1 + libnet_getpbuf@Base 1.1.2.1 + libnet_getpbuf_size@Base 1.1.2.1 + libnet_hex_aton@Base 1.1.2.1 + libnet_ifaddrlist@Base 1.1.2.1 + libnet_in_cksum@Base 1.1.2.1 + libnet_init@Base 1.1.2.1 + libnet_ip_check@Base 1.1.2.1 + libnet_name2addr4@Base 1.1.2.1 + libnet_name2addr6@Base 1.1.2.1 + libnet_open_link@Base 1.1.2.1 + libnet_open_raw4@Base 1.1.2.1 + libnet_open_raw6@Base 1.1.2.1 + libnet_pblock_append@Base 1.1.2.1 + libnet_pblock_coalesce@Base 1.1.2.1 + libnet_pblock_delete@Base 1.1.2.1 + libnet_pblock_find@Base 1.1.2.1 + libnet_pblock_insert_before@Base 1.1.2.1 + libnet_pblock_new@Base 1.1.2.1 + libnet_pblock_p2p@Base 1.1.2.1 + libnet_pblock_probe@Base 1.1.2.1 + libnet_pblock_record_ip_offset@Base 1.1.2.1 + libnet_pblock_setflags@Base 1.1.2.1 + libnet_pblock_swap@Base 1.1.2.1 + libnet_pblock_update@Base 1.1.2.1 + libnet_plist_chain_dump@Base 1.1.2.1 + libnet_plist_chain_dump_string@Base 1.1.2.1 + libnet_plist_chain_free@Base 1.1.2.1 + libnet_plist_chain_new@Base 1.1.2.1 + libnet_plist_chain_next_pair@Base 1.1.2.1 + libnet_seed_prand@Base 1.1.2.1 + libnet_select_device@Base 1.1.2.1 + libnet_stats@Base 1.1.2.1 + libnet_toggle_checksum@Base 1.1.2.1 + libnet_write@Base 1.1.2.1 + libnet_write_link@Base 1.1.2.1 + libnet_write_raw_ipv4@Base 1.1.2.1 + libnet_write_raw_ipv6@Base 1.1.2.1 diff --git a/unmerged/debian/libnet1/DEBIAN/control b/unmerged/debian/libnet1/DEBIAN/control new file mode 100644 index 0000000..87660f0 --- /dev/null +++ b/unmerged/debian/libnet1/DEBIAN/control @@ -0,0 +1,22 @@ +Package: libnet1 +Source: libnet +Version: 1.1.2.1-4. +Architecture: amd64 +Maintainer: David Paleino <d.paleino@gmail.com> +Installed-Size: 180 +Depends: libc6 (>= 2.6-1) +Section: libs +Priority: optional +Description: library for the construction and handling of network packets + libnet provides a portable framework for low-level network packet + writing and handling. + . + libnet features portable packet creation interfaces at the IP layer + and link layer, as well as a host of supplementary functionality. + . + Using libnet, quick and simple packet assembly applications can be + whipped up with little effort. With a bit more time, more complex + programs can be written (Traceroute and ping were easily rewritten + using libnet and libpcap). + . + This package contains the shared library. diff --git a/unmerged/debian/libnet1/DEBIAN/md5sums b/unmerged/debian/libnet1/DEBIAN/md5sums new file mode 100644 index 0000000..c979ba6 --- /dev/null +++ b/unmerged/debian/libnet1/DEBIAN/md5sums @@ -0,0 +1,8 @@ +72c2b62b481b35b1cfa3dd156b196ba2 usr/share/doc/libnet1/TODO +2bb1a3c48e190c9e8b877b00729b0b66 usr/share/doc/libnet1/copyright +a65eb69d689ab766481cd36089be4a01 usr/share/doc/libnet1/changelog.Debian.gz +02a2ba42bc5465fab78afe0223a0d4b9 usr/share/doc/libnet1/BUGS +c00d4bcb3c17025a2b826e26f0e62c64 usr/share/doc/libnet1/README +fc4d1696ee8a90d4f1fbd7355353822b usr/share/doc/libnet1/CONTRIB +bb5f0c20d189bb0184e0dbb892768d32 usr/share/doc/libnet1/changelog.gz +c41531e2c4106fe4d2b1fdaa13487532 usr/lib/libnet.so.1.5.0 diff --git a/unmerged/debian/libnet1/DEBIAN/postinst b/unmerged/debian/libnet1/DEBIAN/postinst new file mode 100755 index 0000000..379f1fa --- /dev/null +++ b/unmerged/debian/libnet1/DEBIAN/postinst @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +# Automatically added by dh_makeshlibs +if [ "$1" = "configure" ]; then + ldconfig +fi +# End automatically added section diff --git a/unmerged/debian/libnet1/DEBIAN/postrm b/unmerged/debian/libnet1/DEBIAN/postrm new file mode 100755 index 0000000..3e73d38 --- /dev/null +++ b/unmerged/debian/libnet1/DEBIAN/postrm @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +# Automatically added by dh_makeshlibs +if [ "$1" = "remove" ]; then + ldconfig +fi +# End automatically added section diff --git a/unmerged/debian/libnet1/DEBIAN/shlibs b/unmerged/debian/libnet1/DEBIAN/shlibs new file mode 100644 index 0000000..7eb809f --- /dev/null +++ b/unmerged/debian/libnet1/DEBIAN/shlibs @@ -0,0 +1 @@ +libnet 1 libnet1 (>= 1.1.2) diff --git a/unmerged/debian/libnet1/usr/lib/libnet.so.1 b/unmerged/debian/libnet1/usr/lib/libnet.so.1 new file mode 120000 index 0000000..501e384 --- /dev/null +++ b/unmerged/debian/libnet1/usr/lib/libnet.so.1 @@ -0,0 +1 @@ +libnet.so.1.5.0
\ No newline at end of file diff --git a/unmerged/debian/libnet1/usr/lib/libnet.so.1.5.0 b/unmerged/debian/libnet1/usr/lib/libnet.so.1.5.0 Binary files differnew file mode 100644 index 0000000..7b1bb85 --- /dev/null +++ b/unmerged/debian/libnet1/usr/lib/libnet.so.1.5.0 diff --git a/unmerged/debian/libnet1/usr/share/doc/libnet1/BUGS b/unmerged/debian/libnet1/usr/share/doc/libnet1/BUGS new file mode 100644 index 0000000..2e8c929 --- /dev/null +++ b/unmerged/debian/libnet1/usr/share/doc/libnet1/BUGS @@ -0,0 +1,19 @@ +=============================================================================== + $Id: BUGS,v 1.2 2004/01/03 20:31:00 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + + 1.1.0 KNOWN BUG LIST + + - It appears as though getprotobynumber() is broken in some linux + distributions. The /etc/protocols file should be of the format: + protocol name protocol number proctocol symbolic constant comment + Most of the file (in my redhat 7.1) distro complies with this format + until you get to the end of the file: + # 134-254 # Unassigned + # 255 # Reserved + This will cause getprotobynumber() and presumably getprotobyname() to + segfault. If you get this behavior in your program and you're calling + __libnet_file_dump(), this could be the reason. Caveat Emptor. diff --git a/unmerged/debian/libnet1/usr/share/doc/libnet1/CONTRIB b/unmerged/debian/libnet1/usr/share/doc/libnet1/CONTRIB new file mode 100644 index 0000000..18b3bb5 --- /dev/null +++ b/unmerged/debian/libnet1/usr/share/doc/libnet1/CONTRIB @@ -0,0 +1,62 @@ +=============================================================================== + $Id: CONTRIB,v 1.9 2004/11/09 07:05:06 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + + 1.1.x CONTRIBUTERS + Barbato, Luca + . faster C checksum routine + Beverly, Scott <scottbeverly@xengin.com> + Bowman, Don <don@sandvine.com> + Coulter, Michae l <mjc@bitz.ca> + . arp bugfix + Damron, Jason <jsdamron@hushmail.com> + . bugfixes + . IP/TCP options bugfixes + . RPC builder + . token ring and fddi support + Davis, Michael <mike@datanerds.net> + . bugfixes + Dulai, Danny <ddulai@stake.com> + Harhalakis, Stefanos <v13@v13.gr> + . debian packaging and help with autotools + Keramida, Giorgos <keramida@ceid.upatras.gr> + . various bugfixes + Kuehl, Kirby <kkuehl@cisco.com> + . u_short -> u_long patch + . 1.1.1 Win32 porting + . tons and tons of other stuff + Newsham, Tim <tnewsham@stake.com> + . general elitism + O'Donnell, Adam <javaman@west.philly.ghetto.org> + . Solaris IPv6 address fix + Omella, Alfredo Andres <aandres@s21sec.com> + . Solaris DLPI fix + Paleino, David <d.paleino@gmail.com> + . debian packaging and help with autotools + Raynal, Frederic <frederic.raynal@security-labs.org> + . cq interface + . numerous bugfixes and suggestions + . keeping the project alive during my sabbatical! + Roberto Larcher <roberto.larcher@libero.it> + . 1.1.0 Win32 Porting + Salvatori, Alessandro + . many many patches + Scheck, Robert + . latin-1 to utf-8 conversion from Fedora + Sehgal, Anupma <asehgal@cisco.com> + . pblock sanity check oversight fix + Schlott, Stefan <stefan@ploing.de> + . IPv6 code + Shields, Michael <shieldszero@aol.com> + . configure.in patch + Simons, Terry <Terry.Simons@m.cc.utah.edu> + . OS/X port + Song, Doug <dug@monkey.org> + . inspiration + Su, Joe <cysu@csie.nctu.edu.tw> + . IPv6 traffic clas and flow label fix + Yardley, Tim <liquid@dqc.org> +EOF diff --git a/unmerged/debian/libnet1/usr/share/doc/libnet1/README b/unmerged/debian/libnet1/usr/share/doc/libnet1/README new file mode 100644 index 0000000..f6336b6 --- /dev/null +++ b/unmerged/debian/libnet1/usr/share/doc/libnet1/README @@ -0,0 +1,34 @@ +=============================================================================== + $Id: README,v 1.4 2004/03/01 20:26:11 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + +libnet has become unmaintained at packetfactory.net, and it's author is unreachable. + +This version was forked from the 1.1.3 release candidate, then bug fixed, +actively maintained, and rereleased. + +Home page and more info is available at: + + http://github.com/sam-github/libnet + +Contact Sam Roberts <vieuxtech@gmail.com> if you have patches or have found bugs. + + + A C library for portable packet creation and injection. + + Libnet is an API to help with the construction and handling of network + packets. It provides a portable framework for low-level network + packet writing and handling (use libnet in conjunction with libpcap and + you can write some really cool stuff). Libnet includes packet creation + at the IP layer and at the link layer as well as a host of supplementary + and complementary functionality. Libnet is very handy with which to + write network tools and network test code. See the manpage and sample + test code for more detailed information. + + Your old code (circa libnet-1.0.x) WILL NOT WORK with libnet-1.1.x. + Read doc/MIGRATION for easy steps on porting your old code. + +EOF diff --git a/unmerged/debian/libnet1/usr/share/doc/libnet1/TODO b/unmerged/debian/libnet1/usr/share/doc/libnet1/TODO new file mode 100644 index 0000000..84464d1 --- /dev/null +++ b/unmerged/debian/libnet1/usr/share/doc/libnet1/TODO @@ -0,0 +1,96 @@ +=============================================================================== + $Id: TODO,v 1.2 2004/01/03 20:31:00 mike Exp $ + LIBNET 1.1 (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + http://www.packetfactory.net/libnet +=============================================================================== + + + 1.1.x TODO LIST + + * Update the man page! + + - Add a programmer's man page detailing the pblock architecture. + + - Fix plist memory leak. + + - Fix IPv6. According to RFC 2992: + "Another difference from IPv4 raw sockets is that complete packets + (that is, IPv6 packets with extension headers) cannot be read or + written using the IPv6 raw sockets API. Instead, ancillary data + objects are used to transfer the extension headers, as described + later in this document. Should an application need access to the + complete IPv6 packet, some other technique, such as the datalink + interfaces BPF or DLPI, must be used. + + All fields in the IPv6 header that an application might want to + change (i.e., everything other than the version number) can be + modified using ancillary data and/or socket options by the + application for output. All fields in a received IPv6 header (other + than the version number and Next Header fields) and all extension + headers are also made available to the application as ancillary data + on input. Hence there is no need for a socket option similar to the + IPv4 IP_HDRINCL socket option." + + - Add self-throttling logic to libnet_write()/libnet_init()? Advanced + mode thing? + + - Prune the include list in libnet.h.in. Also add conditionals + around the headers we use for building the library, but not when + using it. + + - Data marshalling API for unaligned structures (like STP). + + - Make cisco ISL work. The issue is that we have build our Ethernet + frame first, then encapsulate it inside of an ISL envelope. + - We have to compute CRCs for both Ethernet and ISL. + + - Tune advanced interface functionality that allow the application + programmer to get inside libnet_t. + + - Test HPUX 11 port. + + - Test cywin32 port. + + - Flesh out the advanced mode. + + - Consider making a flag for "strict mode" where libnet will check + things like when you build an IP options list there is an IP + header preceding it (likewise for TCP)... Other "smart" things + could happen in this mode too. When in non-strict mode, libnet + will be less rigid but prone to user-error mode. + + - If we have a problem building a header we might end up freeing it + creating a NULL entry on the list and preventing us from getting to + entries beyond it (to free or whatever). Maybe we should mark it + bad or something and rely on the cleanup at the end to free it up? + + - Fix checksum support for CDP + + - Verify Checksuming: + Currently verified working on OpenBSD/Linux/Solaris: + - raw IP/UDP [with and without data] + - raw IP/TCP [with and without data] + - raw IP/ICMP [with and without data] + - raw IP/OSPF + - hello packet [with no auth data] + - hello packet [with no auth data and LSA sub-header (LSA check = bad)] + - link IP/UDP [with and without data] + - link IP/TCP [with and without data] + + - Update the rest of the libnet_link_* files for the new format, already + ported: + - bpf [works] + - linux packet socket [works] + - linux sock packet [works] + - dlpi [works] + + - Port link stuff to use writev() in libnet_write() (sendto can't hang). + + - Get IPsec code working. + + - Add the following packet builders: + - SNMP + + - Update __libnet_handle_dump to dump everything in l verbosely. + +EOF diff --git a/unmerged/debian/libnet1/usr/share/doc/libnet1/changelog.Debian.gz b/unmerged/debian/libnet1/usr/share/doc/libnet1/changelog.Debian.gz Binary files differnew file mode 100644 index 0000000..92759cd --- /dev/null +++ b/unmerged/debian/libnet1/usr/share/doc/libnet1/changelog.Debian.gz diff --git a/unmerged/debian/libnet1/usr/share/doc/libnet1/changelog.gz b/unmerged/debian/libnet1/usr/share/doc/libnet1/changelog.gz Binary files differnew file mode 100644 index 0000000..0f0c0f8 --- /dev/null +++ b/unmerged/debian/libnet1/usr/share/doc/libnet1/changelog.gz diff --git a/unmerged/debian/libnet1/usr/share/doc/libnet1/copyright b/unmerged/debian/libnet1/usr/share/doc/libnet1/copyright new file mode 100644 index 0000000..b776c81 --- /dev/null +++ b/unmerged/debian/libnet1/usr/share/doc/libnet1/copyright @@ -0,0 +1,234 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Upstream-Author: Mike D. Schiffman <mike@infonexus.com> +Packaged-By: Domenico Andreoli <cavok@debian.org> +Packaged-Date: Mon, 18 Nov 2002 23:53:40 +0100 +Original-Source-Location: http://www.packetfactory.net/libnet/ + +Files: debian/* +Copyright: © 2008, David Paleino <d.paleino@gmail.com> + © 2002-2008, Domenico Andreoli <cavok@debian.org> +License: BSD-2 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED.IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: include/bpf.h + include/win32/getopt.h + include/win32/in_systm.h + sample/win32/getopt.c +Copyright: © 1982-1997, The Regents of the University of California +License: BSD-4 + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +Files: include/ifaddrlist.h +Copyright: © 1997, The Regents of the University of California +License: BSD-3 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +Files: include/libnet/libnet-asn1.h +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1989, Carnegie Mellon University +License: BSD-2 | other + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: sample/bgp4* + sample/dns.c + sample/gre.c + sample/ip_link.c + sample/ip_raw.c + sample/sebek.c + sample/tftp.c + src/libnet_build_bgp.c + src/libnet_build_gre.c +Copyright: © 2003-2004 Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/icmp_redirect.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Alberto Ornaghi <alor@antifork.org> +License: BSD-2 + +Files: sample/icmp_timeexceed.c + src/libnet_build_sebek.c + src/libnet_cq.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Frédéric Raynal <pappy@security-labs.org> +License: BSD-2 + +Files: sample/ospf* + src/libnet_build_ospf.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2000, Andrew Reiter <areiter@bindview.com> +License: BSD-2 + +Files: sample/ping_of_death.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1999-2001, Dug Song <dugsong@monkey.org> +License: BSD-2 + +Files: srct/libnet_asn1.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1988-1992, Carnegie Mellon University + © 1993-1996, 1998, The Regents of the University of California +License: BSD-3 | other +==> BSD-3 <== + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +==> other <== + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + +Files: src/libnet_build_fddi.c + src/libnet_build_rpc.c + src/libnet_build_token_ring.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © Jason Damron <jsdamron@hushmail.com> <jdamron@stackheap.org> +License: BSD-2 + +Files: src/libnet_build_ipsec.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2002, Jose Nazario <jose@crimelabs.net> +License: BSD-2 + +Files: src/libnet_build_link.c + src/libnet_write.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2003, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_dll.c +Copyright: © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: src/libnet_link_dlpi.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1993-1997, The Regents of the University of California + © Atanu Ghosh <atanu@cs.ucl.ac.uk>, University College London +License: BSD-3 + +Files: src/libnet_link_nit.c + src/libnet_link_none.c + src/libnet_link_pf.c + src/libnet_link_snoop.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. +License: BSD-3 + +Files: src/libnet_link_snit.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 1990-1996, 1998, The Regents of the University of California. + © 1989, Micky Liu <micky@cunixc.cc.columbia.edu>, Columbia University +License: BSD-3 + +Files: src/libnet_link_win32.c +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> + © 2001-2002, Don Bowman <don@sandvine.com> + © 2002, Roberto Larcher <roberto.larcher@libero.it> +License: BSD-2 + +Files: * +Copyright: © 1998-2004, Mike D. Schiffman <mike@infonexus.com> +License: BSD-2 diff --git a/unmerged/debian/patches/00-fix_build_process.patch b/unmerged/debian/patches/00-fix_build_process.patch new file mode 100644 index 0000000..49b3842 --- /dev/null +++ b/unmerged/debian/patches/00-fix_build_process.patch @@ -0,0 +1,246 @@ +--- libnet-1.1.2.1.orig/Makefile.am ++++ libnet-1.1.2.1/Makefile.am +@@ -12,4 +12,4 @@ + + EXTRA_DIST = Makefile.am.common + +-bin_scripts = libnet-config ++bin_SCRIPTS = libnet-config +--- libnet-1.1.2.1.orig/configure.in ++++ libnet-1.1.2.1/configure.in +@@ -21,10 +21,24 @@ + dnl + AC_PROG_CC + AC_PROG_INSTALL +-AC_PROG_RANLIB ++AC_PROG_LIBTOOL + ++# Added by Debian maintainer after `autoscan` ++AC_PROG_CXX ++AC_PROG_CPP ++AC_PROG_LN_S ++AC_PROG_MAKE_SET ++# ++ ++# Check for headers + AC_CHECK_HEADERS(sys/sockio.h) + ++# Added by Debian maintainer after `autoscan` ++AC_CHECK_HEADERS([arpa/inet.h fcntl.h memory.h netdb.h netinet/in.h nlist.h]) ++AC_CHECK_HEADERS([stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h]) ++AC_CHECK_HEADERS([sys/socket.h sys/systeminfo.h sys/time.h sys/timeb.h unistd.h]) ++# ++ + dnl + dnl And some custom things + dnl +@@ -49,6 +63,22 @@ + CFLAGS="$CFLAGS -Wall" + fi + ++# Added by Debian maintainer after `autoscan` ++AC_C_INLINE ++AC_TYPE_INT16_T ++AC_TYPE_INT32_T ++AC_TYPE_INT64_T ++AC_TYPE_INT8_T ++AC_TYPE_OFF_T ++AC_TYPE_SIZE_T ++AC_CHECK_MEMBERS([struct stat.st_rdev]) ++AC_TYPE_UINT16_T ++AC_TYPE_UINT32_T ++AC_TYPE_UINT64_T ++AC_TYPE_UINT8_T ++# ++ ++ + dnl + dnl Set the root install directory + dnl +@@ -61,6 +91,11 @@ + dnl Check for library functions. + dnl + AC_CHECK_FUNCS(strerror) ++# Added by Debian maintainer after `autoscan` ++AC_HEADER_MAJOR ++AC_CHECK_FUNCS([bzero gethostbyaddr gethostbyname gettimeofday memmove]) ++AC_CHECK_FUNCS([memset socket strchr strdup strpbrk strrchr strtol strtoul]) ++# + + dnl + dnl Get link-layer interface type +--- libnet-1.1.2.1.orig/src/Makefile.am ++++ libnet-1.1.2.1/src/Makefile.am +@@ -8,9 +8,9 @@ + + include $(top_srcdir)/Makefile.am.common + +-lib_LIBRARIES = libnet.a ++lib_LTLIBRARIES = libnet.la + +-libnet_a_SOURCES = libnet_asn1.c \ ++libnet_la_SOURCES = libnet_asn1.c \ + libnet_build_802.1q.c \ + libnet_build_802.1x.c \ + libnet_build_802.2.c \ +@@ -57,15 +57,20 @@ + libnet_version.c \ + libnet_write.c + +-EXTRA_libnet_a_SOURCES = libnet_link_bpf.c \ +- libnet_link_dlpi.c \ +- libnet_link_linux.c \ +- libnet_link_nit.c \ +- libnet_link_none.c \ +- libnet_link_pf.c \ +- libnet_link_snit.c \ +- libnet_link_snoop.c \ +- libnet_link_win32.c +- +-libnet_a_LIBADD = @LIBOBJS@ ++libnet_la_LIBADD = @LTLIBOBJS@ + ++# Here are a set of rules to help you update your library version ++# information: ++# ++# 1. If the library source code has changed at all since the last ++# update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). ++# ++# 2. If any interfaces have been added, removed, or changed since the ++# last update, increment CURRENT, and set REVISION to 0. ++# ++# 3. If any interfaces have been added since the last public release, ++# then increment AGE. ++# ++# 4. If any interfaces have been removed since the last public release, ++# then set AGE to 0. ++libnet_la_LDFLAGS = -version-info 4:0:3 # CURRENT[:REVISION[:AGE]] +--- libnet-1.1.2.1.orig/acinclude.m4 ++++ libnet-1.1.2.1/acinclude.m4 +@@ -11,7 +11,7 @@ + dnl usage: AC_LIBNET_LINUX_PROCFS + dnl results: HAVE_LINUX_PROCFS + dnl +-AC_DEFUN(AC_LIBNET_LINUX_PROCFS, ++AC_DEFUN([AC_LIBNET_LINUX_PROCFS], + [AC_MSG_CHECKING(for Linux proc filesystem) + AC_CACHE_VAL(ac_cv_libnet_linux_procfs, + if test "x`cat /proc/sys/kernel/ostype 2>&-`" = "xLinux" ; then +@@ -37,15 +37,15 @@ + dnl HAVE_PACKET_SOCKET (DEFINED) + dnl + +-AC_DEFUN(AC_LIBNET_CHECK_PF_PACKET, ++AC_DEFUN([AC_LIBNET_CHECK_PF_PACKET], + [ + AC_MSG_CHECKING(for packet socket (PF_SOCKET)) +- AC_CACHE_VAL(ac_libnet_have_packet_socket, ++ AC_CACHE_VAL(ac_cv_libnet_have_packet_socket, + + [case "$target_os" in + + linux) +- ac_libnet_have_packet_socket = no ++ ac_cv_libnet_have_packet_socket = no + ;; + *) + +@@ -94,17 +94,17 @@ + + # Oopz 4.3 BSD doesn't have this. Sorry. + if test ! -x ./pf_packet-test ; then +- ac_libnet_have_packet_socket=choked ++ ac_cv_libnet_have_packet_socket=choked + else +- ac_libnet_have_packet_socket=`./pf_packet-test`; ++ ac_cv_libnet_have_packet_socket=`./pf_packet-test`; + fi +- if test $ac_libnet_have_packet_socket = choked; then ++ if test $ac_cv_libnet_have_packet_socket = choked; then + AC_MSG_RESULT(test program compile choked... assuming no) +- elif test $ac_libnet_have_packet_socket = yes; then ++ elif test $ac_cv_libnet_have_packet_socket = yes; then + AC_MSG_RESULT(yes) +- elif test $ac_libnet_have_packet_socket = probably; then ++ elif test $ac_cv_libnet_have_packet_socket = probably; then + AC_MSG_RESULT(test program got EPERM... assuming yes) +- elif test $ac_libnet_have_packet_socket = no; then ++ elif test $ac_cv_libnet_have_packet_socket = no; then + AC_MSG_RESULT(no) + fi + +@@ -112,7 +112,7 @@ + ;; + esac]) + +- if test $ac_libnet_have_packet_socket = yes -o $ac_libnet_have_packet_socket = probably; then ++ if test $ac_cv_libnet_have_packet_socket = yes -o $ac_cv_libnet_have_packet_socket = probably; then + AC_DEFINE(HAVE_PACKET_SOCKET) + fi + ]) +@@ -131,17 +131,17 @@ + dnl + dnl + +-AC_DEFUN(AC_LIBNET_CHECK_LIBNET_VER, ++AC_DEFUN([AC_LIBNET_CHECK_LIBNET_VER], + [ + AC_CHECK_LIB(net, libnet_build_ip, AC_MSG_CHECKING(version) \ + + changequote(<<, >>)dnl +- if [[ ! -f $LIB_PREFIX/libnet.a ]] ; then ++ if [[ ! -f $LIB_PREFIX/libnet.la ]] ; then + changequote([, ])dnl +- AC_MSG_RESULT($LIB_PREFIX/libnet.a doesn't exist) ++ AC_MSG_RESULT($LIB_PREFIX/libnet.la doesn't exist) + AC_MSG_RESULT(previous libnet install lives elsewhere, you should probably find it) + else +- __LIBNET_VERSION=`strings $LIB_PREFIX/libnet.a | grep "libnet version"\ ++ __LIBNET_VERSION=`strings $LIB_PREFIX/libnet.la | grep "libnet version"\ + | cut -f3 -d" "`;\ + if test -z "$__LIBNET_VERSION"; then + AC_MSG_RESULT(<0.8) +@@ -166,7 +166,7 @@ + dnl HAVE_STRUCT_IP_CSUM (DEFINED) + dnl + +-AC_DEFUN(AC_LIBNET_CHECK_IP_CSUM, ++AC_DEFUN([AC_LIBNET_CHECK_IP_CSUM], + [ + AC_MSG_CHECKING([struct ip contains ip_csum]) + AC_TRY_COMPILE([ +@@ -199,7 +199,7 @@ + dnl LBL_ALIGN (DEFINED) + dnl + +-AC_DEFUN(AC_LBL_UNALIGNED_ACCESS, ++AC_DEFUN([AC_LBL_UNALIGNED_ACCESS], + [AC_MSG_CHECKING(if unaligned accesses fail) + AC_CACHE_VAL(ac_cv_lbl_unaligned_fail, + [case "$target_cpu" in +@@ -278,7 +278,7 @@ + dnl LIBNET_LIL_ENDIAN = 1 + dnl + +-AC_DEFUN(AC_LIBNET_ENDIAN_CHECK, ++AC_DEFUN([AC_LIBNET_ENDIAN_CHECK], + [AC_MSG_CHECKING(machine endianess) + + cat > conftest.c << EOF +@@ -439,7 +439,7 @@ + dnl statically and happen to have a libresolv.a lying around (and no + dnl libnsl.a). + dnl +-AC_DEFUN(AC_LBL_LIBRARY_NET, [ ++AC_DEFUN([AC_LBL_LIBRARY_NET], [ + # Most operating systems have gethostbyname() in the default searched + # libraries (i.e. libc): + AC_CHECK_FUNC(gethostbyname, , +--- libnet-1.1.2.1.orig/sample/Makefile.am ++++ libnet-1.1.2.1/sample/Makefile.am +@@ -60,4 +60,4 @@ + ip_link_SOURCES = ip_link.c + sebek_SOURCES = sebek.c + +-LDADD = $(top_srcdir)/src/libnet.a ++LDADD = $(top_srcdir)/src/libnet.la diff --git a/unmerged/debian/patches/01-fix_libnet-functions.h.3.patch b/unmerged/debian/patches/01-fix_libnet-functions.h.3.patch new file mode 100644 index 0000000..1ba50e0 --- /dev/null +++ b/unmerged/debian/patches/01-fix_libnet-functions.h.3.patch @@ -0,0 +1,839 @@ +--- libnet.orig/doc/man/man3/libnet-functions.h.3 ++++ libnet/doc/man/man3/libnet-functions.h.3 +@@ -485,7 +485,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + +@@ -504,7 +504,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + +@@ -535,7 +535,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-the number of bytes written, or -1 on failure ++the number of bytes written, or \-1 on failure + .RE + .PP + +@@ -560,7 +560,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -579,7 +579,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -606,7 +606,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -627,7 +627,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -654,7 +654,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -675,7 +675,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -706,7 +706,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -741,7 +741,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -768,7 +768,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -795,7 +795,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -826,7 +826,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -853,7 +853,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -892,13 +892,14 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + + .SS "libnet_ptag_t libnet_build_bgp4_header (u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" + .PP +-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. ++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. + .PP + \fBParameters:\fP + .RS 4 +@@ -919,7 +920,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -944,7 +945,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -975,7 +976,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1008,7 +1009,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1027,7 +1028,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1060,7 +1061,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1081,7 +1082,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1100,7 +1101,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1133,13 +1134,13 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + + .SS "libnet_ptag_t libnet_build_egre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" + .PP +-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. ++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. + .PP + \fBParameters:\fP + .RS 4 +@@ -1168,7 +1169,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1195,7 +1196,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1228,13 +1229,13 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + + .SS "libnet_ptag_t libnet_build_gre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" + .PP +-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. ++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. + .PP + \fBParameters:\fP + .RS 4 +@@ -1263,7 +1264,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1282,7 +1283,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1301,7 +1302,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1332,7 +1333,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1365,7 +1366,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1406,7 +1407,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1449,7 +1450,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1486,7 +1487,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1527,7 +1528,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1556,7 +1557,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1589,7 +1590,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1616,7 +1617,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1643,7 +1644,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1682,7 +1683,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1703,7 +1704,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1738,7 +1739,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1763,7 +1764,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1792,7 +1793,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1817,7 +1818,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1844,7 +1845,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1883,7 +1884,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1912,7 +1913,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -1941,7 +1942,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2000,7 +2001,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2019,7 +2020,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2038,7 +2039,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2057,7 +2058,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2076,7 +2077,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2095,7 +2096,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2114,7 +2115,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2133,7 +2134,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2152,7 +2153,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2171,7 +2172,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2190,7 +2191,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2229,7 +2230,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2243,7 +2244,7 @@ + .br + \fIxid\fP transaction identifier used to link calls and replies + .br +-\fIprog_num\fP remote program specification typically between 0 - 1fffffff ++\fIprog_num\fP remote program specification typically between 0 \- 1fffffff + .br + \fIprog_vers\fP remote program version specification + .br +@@ -2272,7 +2273,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2315,7 +2316,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2360,7 +2361,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2387,7 +2388,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2422,7 +2423,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2443,7 +2444,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2482,7 +2483,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2511,7 +2512,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2523,7 +2524,7 @@ + .RS 4 + \fIversion\fP VRRP version (should be 2) + .br +-\fItype\fP VRRP packet type (should be 1 -- ADVERTISEMENT) ++\fItype\fP VRRP packet type (should be 1 \-\- ADVERTISEMENT) + .br + \fIvrouter_id\fP virtual router identification + .br +@@ -2531,7 +2532,7 @@ + .br + \fIip_count\fP number of IPv4 addresses contained in this advertisement + .br +-\fIauth_type\fP type of authentication (0, 1, 2 -- see RFC) ++\fIauth_type\fP type of authentication (0, 1, 2 \-\- see RFC) + .br + \fIadvert_int\fP interval between advertisements + .br +@@ -2548,7 +2549,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2575,7 +2576,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + +@@ -2757,7 +2758,7 @@ + + .SS "u_int32_t libnet_get_ipaddr4 (libnet_t * l)" + .PP +-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. ++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. + .PP + \fBParameters:\fP + .RS 4 +@@ -2766,7 +2767,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-a big endian IP address suitable for use in a libnet_build function or -1 ++a big endian IP address suitable for use in a libnet_build function or \-1 + .RE + .PP + +@@ -2787,7 +2788,7 @@ + + .SS "u_int32_t libnet_get_prand (int mod)" + .PP +-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 ++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 + .PP + \fBParameters:\fP + .RS 4 +@@ -2796,7 +2797,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + +@@ -2860,7 +2861,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-protocol tag value on success, -1 on error ++protocol tag value on success, \-1 on error + .RE + .PP + +@@ -2964,7 +2965,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-network byte ordered IPv4 address or -1 (2^32 - 1) on error ++network byte ordered IPv4 address or \-1 (2^32 \- 1) on error + .RE + .PP + +@@ -2998,7 +2999,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + +@@ -3028,13 +3029,13 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + + .SS "int libnet_plist_chain_new (libnet_t * l, libnet_plist_t ** plist, char * token_list)" + .PP +-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 \fBlibnet_geterror()\fP can tell you why. ++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 \fBlibnet_geterror()\fP can tell you why. + .PP + \fBParameters:\fP + .RS 4 +@@ -3047,13 +3048,13 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + + .SS "int libnet_plist_chain_next_pair (libnet_plist_t * plist, u_int16_t * bport, u_int16_t * eport)" + .PP +-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. ++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. + .PP + \fBParameters:\fP + .RS 4 +@@ -3066,7 +3067,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, 0 if empty, -1 on failure ++1 on success, 0 if empty, \-1 on failure + .RE + .PP + +@@ -3081,7 +3082,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + +@@ -3112,7 +3113,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-1 on success, -1 on failure ++1 on success, \-1 on failure + .RE + .PP + +@@ -3127,7 +3128,7 @@ + .PP + \fBReturns:\fP + .RS 4 +-the number of bytes written, -1 on error ++the number of bytes written, \-1 on error + .RE + .PP + diff --git a/unmerged/debian/patches/02-fix_libnet_802_1q_hdr.3.patch b/unmerged/debian/patches/02-fix_libnet_802_1q_hdr.3.patch new file mode 100644 index 0000000..90d3961 --- /dev/null +++ b/unmerged/debian/patches/02-fix_libnet_802_1q_hdr.3.patch @@ -0,0 +1,11 @@ +--- libnet.orig/doc/man/man3/libnet_802_1q_hdr.3 ++++ libnet/doc/man/man3/libnet_802_1q_hdr.3 +@@ -2,7 +2,7 @@ + .ad l + .nh + .SH NAME +-libnet_802_1q_hdr \- ++libnet_802_1q_hdr \- IEEE 802.1Q VLAN header + .SH SYNOPSIS + .br + .PP diff --git a/unmerged/debian/patches/03-fix_libnet_802_1x_hdr.3.patch b/unmerged/debian/patches/03-fix_libnet_802_1x_hdr.3.patch new file mode 100644 index 0000000..2c9b945 --- /dev/null +++ b/unmerged/debian/patches/03-fix_libnet_802_1x_hdr.3.patch @@ -0,0 +1,11 @@ +--- libnet.orig/doc/man/man3/libnet_802_1x_hdr.3 ++++ libnet/doc/man/man3/libnet_802_1x_hdr.3 +@@ -2,7 +2,7 @@ + .ad l + .nh + .SH NAME +-libnet_802_1x_hdr \- ++libnet_802_1x_hdr \- IEEE 802.1X EAP header + .SH SYNOPSIS + .br + .PP diff --git a/unmerged/debian/patches/04-fix_libnet_build_ntp.patch b/unmerged/debian/patches/04-fix_libnet_build_ntp.patch new file mode 100644 index 0000000..4bf2d15 --- /dev/null +++ b/unmerged/debian/patches/04-fix_libnet_build_ntp.patch @@ -0,0 +1,13 @@ +--- libnet.orig/src/libnet_build_ntp.c ++++ libnet/src/libnet_build_ntp.c +@@ -85,8 +85,8 @@ + ntp_hdr.ntp_ref_ts.fraction = htonl(ref_ts_frac); + ntp_hdr.ntp_orig_ts.integer = htonl(orig_ts_int); + ntp_hdr.ntp_orig_ts.fraction = htonl(orig_ts_frac); +- ntp_hdr.ntp_rec_ts.integer = htonl(orig_ts_int); +- ntp_hdr.ntp_rec_ts.fraction = htonl(orig_ts_frac); ++ ntp_hdr.ntp_rec_ts.integer = htonl(rec_ts_int); ++ ntp_hdr.ntp_rec_ts.fraction = htonl(rec_ts_frac); + ntp_hdr.ntp_xmt_ts.integer = htonl(xmt_ts_int); + ntp_hdr.ntp_xmt_ts.fraction = htonl(xmt_ts_frac); + diff --git a/unmerged/debian/patches/05-fix_libnet_pblock_coalesce_buffer_overrun.patch b/unmerged/debian/patches/05-fix_libnet_pblock_coalesce_buffer_overrun.patch new file mode 100644 index 0000000..7c6a2f2 --- /dev/null +++ b/unmerged/debian/patches/05-fix_libnet_pblock_coalesce_buffer_overrun.patch @@ -0,0 +1,11 @@ +--- libnet.orig/src/libnet_pblock.c ++++ libnet/src/libnet_pblock.c +@@ -389,7 +389,7 @@ + { + if ((q->flags) & LIBNET_PBLOCK_DO_CHECKSUM) + { +- int offset = (l->total_size + l->aligner) - q->ip_offset; ++ int offset = l->aligner + q->ip_offset; + c = libnet_do_checksum(l, *packet + offset, + libnet_pblock_p2p(q->type), q->h_len); + if (c == -1) diff --git a/unmerged/debian/patches/06-fix_libnet_pblock_coalesce_leak.patch b/unmerged/debian/patches/06-fix_libnet_pblock_coalesce_leak.patch new file mode 100644 index 0000000..50b9411 --- /dev/null +++ b/unmerged/debian/patches/06-fix_libnet_pblock_coalesce_leak.patch @@ -0,0 +1,49 @@ +--- libnet.orig/src/libnet_pblock.c ++++ libnet/src/libnet_pblock.c +@@ -339,7 +339,7 @@ + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, + "%s(): packet assembly cannot find a layer 2 header\n", + __func__); +- return (-1); ++ goto err; + } + break; + case LIBNET_RAW4: +@@ -348,7 +348,7 @@ + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, + "%s(): packet assembly cannot find an IPv4 header\n", + __func__); +- return (-1); ++ goto err; + } + break; + case LIBNET_RAW6: +@@ -357,7 +357,7 @@ + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, + "%s(): packet assembly cannot find an IPv6 header\n", + __func__); +- return (-1); ++ goto err; + } + break; + default: +@@ -365,7 +365,7 @@ + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, + "%s(): suddenly the dungeon collapses -- you die\n", + __func__); +- return (-1); ++ goto err; + break; + } + } +@@ -419,6 +419,10 @@ + *size -= l->aligner; + } + return (1); ++ ++err: ++ free(packet); ++ return (-1); + } + + void diff --git a/unmerged/debian/patches/07-add_libnet-cq-end-loop.patch b/unmerged/debian/patches/07-add_libnet-cq-end-loop.patch new file mode 100644 index 0000000..7f10311 --- /dev/null +++ b/unmerged/debian/patches/07-add_libnet-cq-end-loop.patch @@ -0,0 +1,32 @@ +--- libnet-1.1.2.1.orig/src/libnet_cq.c ++++ libnet-1.1.2.1/src/libnet_cq.c +@@ -393,3 +393,14 @@ + { + return (l_cqd.node); + } ++ ++u_int32_t ++libnet_cq_end_loop() ++{ ++ if (! clear_cq_lock(CQ_LOCK_WRITE)) ++ { ++ return (0); ++ } ++ l_cqd.current = l_cq; ++ return (1); ++} +--- libnet-1.1.2.1.orig/include/libnet/libnet-functions.h ++++ libnet-1.1.2.1/include/libnet/libnet-functions.h +@@ -1886,6 +1886,12 @@ + libnet_cq_size(); + + /** ++ * [Context Queue] ++ */ ++u_int32_t ++libnet_cq_end_loop(); ++ ++/** + * [Diagnostic] + * Prints the contents of the given context. + * @param l pointer to a libnet context diff --git a/unmerged/debian/patches/08-fix_libnet_checksum.c.patch b/unmerged/debian/patches/08-fix_libnet_checksum.c.patch new file mode 100644 index 0000000..627ddd7 --- /dev/null +++ b/unmerged/debian/patches/08-fix_libnet_checksum.c.patch @@ -0,0 +1,23 @@ +--- libnet-1.1.2.1.orig/src/libnet_checksum.c ++++ libnet-1.1.2.1/src/libnet_checksum.c +@@ -42,8 +42,10 @@ + libnet_in_cksum(u_int16_t *addr, int len) + { + int sum; ++ u_int16_t last_byte; + + sum = 0; ++ last_byte = 0; + + while (len > 1) + { +@@ -52,7 +54,8 @@ + } + if (len == 1) + { +- sum += *(u_int16_t *)addr; ++ *(u_int8_t *)&last_byte = *(u_int8_t *)addr; ++ sum += last_byte; + } + + return (sum); diff --git a/unmerged/debian/patches/09-fix_hurd-i386_build.patch b/unmerged/debian/patches/09-fix_hurd-i386_build.patch new file mode 100644 index 0000000..6ab2b50 --- /dev/null +++ b/unmerged/debian/patches/09-fix_hurd-i386_build.patch @@ -0,0 +1,11 @@ +--- libnet-1.1.2.1.orig/include/libnet.h.in ++++ libnet-1.1.2.1/include/libnet.h.in +@@ -90,7 +90,7 @@ + #include <winsock2.h> + #include <win32/in_systm.h> + #endif /* __WIN32__ */ +-#if !(__linux__) && !(__WIN32__) && !(__APPLE__) && !(__CYGWIN__) ++#if !(__linux__) && !(__WIN32__) && !(__APPLE__) && !(__CYGWIN__) && !(__GNU__) + #include <netinet/ip_var.h> + #else /* __linux__ */ + #if (HAVE_NET_ETHERNET_H) diff --git a/unmerged/debian/patches/series b/unmerged/debian/patches/series new file mode 100644 index 0000000..cb1db37 --- /dev/null +++ b/unmerged/debian/patches/series @@ -0,0 +1,10 @@ +#00-fix_build_process.patch +#01-fix_libnet-functions.h.3.patch +#02-fix_libnet_802_1q_hdr.3.patch +#03-fix_libnet_802_1x_hdr.3.patch +#04-fix_libnet_build_ntp.patch +#05-fix_libnet_pblock_coalesce_buffer_overrun.patch +#06-fix_libnet_pblock_coalesce_leak.patch +#07-add_libnet-cq-end-loop.patch +#08-fix_libnet_checksum.c.patch +#09-fix_hurd-i386_build.patch diff --git a/unmerged/debian/rules b/unmerged/debian/rules new file mode 100755 index 0000000..aea3293 --- /dev/null +++ b/unmerged/debian/rules @@ -0,0 +1,102 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +# (what magic? -- cph) +# (if you do not export it, nobody will see it. -- cavok) +export DH_OPTIONS + +# removed the autotools stuff, currently the update of autotool stuff +# is done by cvs-debuild when i make the final build of the package. +# i'd like to keep them out of here and from cvs. + +include /usr/share/quilt/quilt.make + +DESTDIR := $(CURDIR)/debian/tmp + +PREFIX = /usr +INFODIR = $(PREFIX)/share/info +MANDIR = $(PREFIX)/share/man + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + CONFIGURE_ARGS += --build $(DEB_HOST_GNU_TYPE) +else + CONFIGURE_ARGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +endif + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS := -O0 +else + CFLAGS := -O2 +endif +CFLAGS += -g -Wall + +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + NUMJOBS := -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + MAKEFLAGS += $(NUMJOBS) +endif + +configure: configure-stamp +configure-stamp: $(QUILT_STAMPFN) + libtoolize + aclocal + autoconf + automake --add-missing --copy + + ./configure $(CONFIGURE_ARGS) \ + --prefix=$(PREFIX) --mandir=$(MANDIR) --infodir=$(INFODIR) \ + LDFLAGS="-Wl,-z,defs,--as-needed" CFLAGS="$(CFLAGS)" + touch $@ + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + $(MAKE) + touch $@ + +clean: unpatch + dh_testdir + dh_testroot + + [ ! -f Makefile ] || $(MAKE) distclean + + find $(CURDIR) -name "Makefile.in" -exec rm -rf {} \; + rm -rf $(CURDIR)/configure + + dh_clean build-stamp configure-stamp config.sub config.guess ltmain.sh + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + $(MAKE) $(MAKE_FLAGS) DESTDIR=$(DESTDIR) install + dh_install --sourcedir=$(DESTDIR) --list-missing + +binary-indep: build install +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installman + dh_installchangelogs doc/CHANGELOG + dh_strip --dbg-package=libnet1-dbg + dh_compress + dh_makeshlibs -V "libnet1 (>= 1.1.2)" + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/unmerged/debian/tmp/usr/include/libnet/libnet-asn1.h b/unmerged/debian/tmp/usr/include/libnet/libnet-asn1.h new file mode 100644 index 0000000..ea27356 --- /dev/null +++ b/unmerged/debian/tmp/usr/include/libnet/libnet-asn1.h @@ -0,0 +1,255 @@ +/* + * $Id: libnet-asn1.h,v 1.3 2004/01/17 07:51:19 mike Exp $ + * + * libnet-asn1.h - Network routine library ASN.1 header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Definitions for Abstract Syntax Notation One, ASN.1 + * As defined in ISO/IS 8824 and ISO/IS 8825 + * + * Copyright 1988, 1989 by Carnegie Mellon University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of CMU not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Copyright (c) 1998 - 2001 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __LIBNET_ASN1_H +#define __LIBNET_ASN1_H + +#ifndef EIGHTBIT_SUBIDS +typedef u_int32_t oid; +#define MAX_SUBID 0xFFFFFFFF +#else +typedef u_int8_t oid; +#define MAX_SUBID 0xFF +#endif + +#define MAX_OID_LEN 64 /* max subid's in an oid */ + +#define ASN_BOOLEAN (0x01) +#define ASN_INTEGER (0x02) +#define ASN_BIT_STR (0x03) +#define ASN_OCTET_STR (0x04) +#define ASN_NULL (0x05) +#define ASN_OBJECT_ID (0x06) +#define ASN_SEQUENCE (0x10) +#define ASN_SET (0x11) + +#define ASN_UNIVERSAL (0x00) +#define ASN_APPLICATION (0x40) +#define ASN_CONTEXT (0x80) +#define ASN_PRIVATE (0xC0) + +#define ASN_PRIMITIVE (0x00) +#define ASN_CONSTRUCTOR (0x20) + +#define ASN_LONG_LEN (0x80) +#define ASN_EXTENSION_ID (0x1F) +#define ASN_BIT8 (0x80) + +#define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR) +#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) = ASN_EXTENSION_ID) + +/* + * All of the build_asn1_* (build_asn1_length being an exception) functions + * take the same first 3 arguments: + * + * u_int8_t *data: This is a pointer to the start of the data object to be + * manipulated. + * int *datalen: This is a pointer to the number of valid bytes following + * "data". This should be not be exceeded in any function. + * Upon exiting a function, this value will reflect the + * changed "data" and then refer to the new number of valid + * bytes until the end of "data". + * u_int8_t type: The ASN.1 object type. + */ + + +/* + * Builds an ASN object containing an integer. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_int( + u_int8_t *, /* Pointer to the output buffer */ + int *, /* Number of valid bytes left in the buffer */ + u_int8_t, /* ASN object type */ + int32_t *, /* Pointer to a int32_t integer */ + int /* Size of a int32_t integer */ + ); + + +/* + * Builds an ASN object containing an unsigned integer. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_uint( + u_int8_t *, /* Pointer to the output buffer */ + int *, /* Number of valid bytes left in the buffer */ + u_int8_t, /* ASN object type */ + u_int32_t *, /* Pointer to an unsigned int32_t integer */ + int /* Size of a int32_t integer */ + ); + + +/* + * Builds an ASN object containing an octect string. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_string( + u_int8_t *, /* Pointer to the output buffer */ + int *, /* Number of valid bytes left in the buffer */ + u_int8_t, /* ASN object type */ + u_int8_t *, /* Pointer to a string to be built into an object */ + int /* Size of the string */ + ); + + +/* + * Builds an ASN header for an object with the ID and length specified. This + * only works on data types < 30, i.e. no extension octets. The maximum + * length is 0xFFFF; + * + * Returns a pointer to the first byte of the contents of this object or + * NULL upon error + */ + +u_int8_t * +libnet_build_asn1_header( + u_int8_t *, /* Pointer to the start of the object */ + int *, /* Number of valid bytes left in buffer */ + u_int8_t, /* ASN object type */ + int /* ASN object length */ + ); + + +u_int8_t * +libnet_build_asn1_length( + u_int8_t *, /* Pointer to start of object */ + int *, /* Number of valid bytes in buffer */ + int /* Length of object */ + ); + + +/* + * Builds an ASN header for a sequence with the ID and length specified. + * + * This only works on data types < 30, i.e. no extension octets. + * The maximum length is 0xFFFF; + * + * Returns a pointer to the first byte of the contents of this object. + * Returns NULL on any error. + */ + +u_int8_t * +libnet_build_asn1_sequence( + u_int8_t *, + int *, + u_int8_t, + int + ); + + +/* + * Builds an ASN object identifier object containing the input string. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_objid( + u_int8_t *, + int *, + u_int8_t, + oid *, + int + ); + + +/* + * Builds an ASN null object. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_null( + u_int8_t *, + int *, + u_int8_t + ); + + +/* + * Builds an ASN bitstring. + * + * Returns NULL upon error or a pointer to the first byte past the end of + * this object (the start of the next object). + */ + +u_int8_t * +libnet_build_asn1_bitstring( + u_int8_t *, + int *, + u_int8_t, + u_int8_t *, /* Pointer to the input buffer */ + int /* Length of the input buffer */ + ); + + +#endif /* __LIBNET_ASN1_H */ + +/* EOF */ diff --git a/unmerged/debian/tmp/usr/include/libnet/libnet-functions.h b/unmerged/debian/tmp/usr/include/libnet/libnet-functions.h new file mode 100644 index 0000000..a9e18bb --- /dev/null +++ b/unmerged/debian/tmp/usr/include/libnet/libnet-functions.h @@ -0,0 +1,2287 @@ +/* + * $Id: libnet-functions.h,v 1.43 2004/11/09 07:05:07 mike Exp $ + * + * libnet-functions.h - function prototypes + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_FUNCTIONS_H +#define __LIBNET_FUNCTIONS_H +/** + * @file libnet-functions.h + * @brief libnet exported function prototypes + */ + +/** + * 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. + * @param injection_type packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV) + * @param device the interface to use (NULL and libnet will choose one) + * @param err_buf will contain an error message on failure + * @return libnet context ready for use or NULL on error. + */ +libnet_t * +libnet_init(int injection_type, char *device, char *err_buf); + +/** + * Shuts down the libnet session referenced by l. It closes the network + * interface and frees all internal memory structures associated with l. + * @param l pointer to a libnet context + */ +void +libnet_destroy(libnet_t *l); + +/** + * 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. + * @param l pointer to a libnet context + */ +void +libnet_clear_packet(libnet_t *l); + +/** + * Fills in a libnet_stats structure with packet injection statistics + * (packets written, bytes written, packet sending errors). + * @param l pointer to a libnet context + * @param ls pointer to a libnet statistics structure + */ +void +libnet_stats(libnet_t *l, struct libnet_stats *ls); + +/** + * Returns the FILENO of the file descriptor used for packet injection. + * @param l pointer to a libnet context + * @return the file number of the file descriptor used for packet injection + */ +int +libnet_getfd(libnet_t *l); + +/** + * Returns the canonical name of the device used for packet injection. + * @param l pointer to a libnet context + * @return the canonical name of the device used for packet injection. Note + * it can be NULL without being an error. + */ +const char * +libnet_getdevice(libnet_t *l); + +/** + * Returns the pblock buffer contents for the specified ptag; a + * subsequent call to libnet_getpbuf_size() should be made to determine the + * size of the buffer. + * @param l pointer to a libnet context + * @param ptag the ptag reference number + * @return a pointer to the pblock buffer or NULL on error + */ +u_int8_t * +libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag); + +/** + * Returns the pblock buffer size for the specified ptag; a + * previous call to libnet_getpbuf() should be made to pull the actual buffer + * contents. + * @param l pointer to a libnet context + * @param ptag the ptag reference number + * @return the size of the pblock buffer + */ +u_int32_t +libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param l pointer to a libnet context + * @return an error string or NULL if no error has occured + */ +char * +libnet_geterror(libnet_t *l); + +/** + * Returns the sum of the size of all of the pblocks inside of l (this should + * be the resuling packet size). + * @param l pointer to a libnet context + * @return the size of the packet in l + */ +u_int32_t +libnet_getpacket_size(libnet_t *l); + +/** + * Seeds the psuedo-random number generator. + * @param l pointer to a libnet context + * @return 1 on success, -1 on failure + */ +int +libnet_seed_prand(libnet_t *l); + +/** + * 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 + * + * @param mod one the of LIBNET_PR* constants + * @return 1 on success, -1 on failure + */ +u_int32_t +libnet_get_prand(int mod); + +/** + * 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 libnet_toggle_checksum(). + * 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. + * @param l pointer to a libnet context + * @param ptag the ptag reference number + * @param mode LIBNET_ON or LIBNET_OFF + * @return 1 on success, -1 on failure + */ +int +libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode); + +/** + * 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. + * @param in network byte ordered IPv4 address + * @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE + * @return a pointer to presentation format string + */ +char * +libnet_addr2name4(u_int32_t in, u_int8_t use_name); + +/** + * 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. + * @param l pointer to a libnet context + * @param host_name pointer to a string containing a presentation format host + * name + * @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE + * @return network byte ordered IPv4 address or -1 (2^32 - 1) on error + */ +u_int32_t +libnet_name2addr4(libnet_t *l, char *host_name, u_int8_t use_name); + +extern const struct libnet_in6_addr in6addr_error; + +/** + * 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. + * @param l pointer to a libnet context + * @param host_name pointer to a string containing a presentation format host + * name + * @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE + * @return network byte ordered IPv6 address structure + */ +struct libnet_in6_addr +libnet_name2addr6(libnet_t *l, char *host_name, u_int8_t use_name); + +/** + * Should document this baby right here. + */ +void +libnet_addr2name6_r(struct libnet_in6_addr addr, u_int8_t use_name, +char *host_name, int host_name_len); + +/** + * 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 libnet_geterror() can tell you + * why. + * @param l pointer to a libnet context + * @param plist if successful, will refer to the portlist, if not, NULL + * @param token_list string containing the port list primitive + * @return 1 on success, -1 on failure + */ +int +libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list); + +/** + * 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. + * @param plist previously created portlist + * @param bport will contain the beginning port number or 0 + * @param eport will contain the ending port number or 0 + * @return 1 on success, 0 if empty, -1 on failure + */ +int +libnet_plist_chain_next_pair(libnet_plist_t *plist, u_int16_t *bport, +u_int16_t *eport); + +/** + * Runs through the port list and prints the contents of the port list chain + * list to stdout. + * @param plist previously created portlist + * @return 1 on success, -1 on failure + */ +int +libnet_plist_chain_dump(libnet_plist_t *plist); + +/** + * 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. + * @param plist previously created portlist + * @return a printable string containing the port list contents on success + * NULL on error + */ +char * +libnet_plist_chain_dump_string(libnet_plist_t *plist); + +/** + * Frees all memory associated with port list chain. + * @param plist previously created portlist + * @return 1 on success, -1 on failure + */ +int +libnet_plist_chain_free(libnet_plist_t *plist); + +/** + * @section PBF Packet Builder Functions + * + * The core of libnet is the platform-independent packet-building + * functionality. These functions enable an application programmer to build + * protocol headers (and data) in a simple and consistent manner without having + * to worry (too much) about low-level network odds and ends. Each + * libnet_build() function builds a piece of a packet (generally a protocol + * header). While it is perfectly possible to build an entire, + * ready-to-transmit packet with a single call to a libnet_build() function, + * generally more than one builder-class function call is required to construct + * a full packet. A complete wire-ready packet generally consists of more than + * one piece. + * Every function that builds a protocol header takes a series of arguments + * roughly corresponding to the header values as they appear on the wire. This + * process is intuitive but often makes for functions with huge prototypes and + * large stack frames. + * One important thing to note is that you must call these functions in order, + * corresponding to how they should appear on the wire (from the highest + * protocol layer on down). This building process is intuitive; it approximates + * what happens in an operating system kernel. In other words, to build a + * Network Time Protocol (NTP) packet by using the link-layer interface, the + * application programmer would call the libnet_build() functions in the + * following order: + * 1. libnet_build_ntp() + * 2. libnet_build_udp() + * 3. libnet_build_ipv4() + * 4. libnet_build_ethernet() + * This ordering is essential for libnet 1.1.x to properly link together the + * packet internally (previous libnet versions did not have the requirement). + * + * @subsection TPI The Payload Interface + * + * The payload interface specifies an optional way to include data directly + * after the protocol header in question. You can use this function for a + * variety of purposes, including the following: + * - Including additional or arbitrary protocol header information that is not + * available from a libnet interface + * - Including a packet payload (data segment) + * - Building another protocol header that is not available from a libnet + * interface + * To employ the interface, the application programmer should construct the i + * payload data and pass a u_int8_t * to this data and its size to the desired + * libnet_build() function. Libnet handles the rest. + * + * It is important to note that some functions (notably the IPv6 builders) do + * use the payload interface to specify variable length but ostensibly + * non-optional data. See the individual libnet_build_ipv6*() functions for + * more information. + * + * @subsection PT Protocol Tags and Packet Builder Return Values + * + * Libnet uses the protocol tag (ptag) to identify individual pieces of a + * packet after being created. A new ptag results every time a libnet_build() + * function with an empty (0) ptag argument completes successfully. This new + * ptag now refers to the packet piece just created. The application + * programmer's responsibility is to save this value if he or she plans to + * modify this particular portion later on in the program. If the application + * programmer needs to modify some portion of that particular packet piece + * again, he or she calls the same libnet_build() function specifying the + * saved ptag argument. Libnet then searches for that packet piece and modifies + * it rather than creating a new one. Upon failure for any reason, + * libnet_build() functions return -1; libnet_geterror() tells you why. + */ + +/** + * Builds an IEEE 802.1q VLAN tagging header. Depending on the value of + * len_proto, the function wraps the 802.1q header inside either an IEEE 802.3 + * header or an RFC 894 Ethernet II (DIX) header (both resulting in an 18-byte + * frame). If len is 1500 or less, most receiving protocol stacks parse the + * frame as an IEEE 802.3 encapsulated frame. If len is one of the Ethernet type + * values, most protocol stacks parse the frame as an RFC 894 Ethernet II + * encapsulated frame. Note the length value is calculated without the 802.1q + * header of 18 bytes. + * @param dst pointer to a six byte source ethernet address + * @param src pointer to a six byte destination ethernet address + * @param tpi tag protocol identifier + * @param priority priority + * @param cfi canonical format indicator + * @param vlan_id vlan identifier + * @param len_proto length (802.3) protocol (Ethernet II) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_1q(u_int8_t *dst, u_int8_t *src, u_int16_t tpi, +u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IEEE 802.1x extended authentication protocol header. + * @param eap_ver the EAP version + * @param eap_type the EAP type + * @param length frame length + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_1x(u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IEEE 802.2 LLC header. + * @param dsap destination service access point + * @param ssap source service access point + * @param control control field + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_2(u_int8_t dsap, u_int8_t ssap, u_int8_t control, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IEEE 802.2 LLC SNAP header. + * @param dsap destination service access point + * @param ssap source service access point + * @param control control field + * @param oui Organizationally Unique Identifier + * @param type upper layer protocol + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_2snap(u_int8_t dsap, u_int8_t ssap, u_int8_t control, +u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst destination ethernet address + * @param src source ethernet address + * @param len frame length sans header + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_802_3(u_int8_t *dst, u_int8_t *src, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst destination ethernet address + * @param src source ethernet address + * @param type upper layer protocol type + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ethernet(u_int8_t *dst, u_int8_t *src, u_int16_t type, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst destination ethernet address + * @param type upper layer protocol type + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_ethernet(u_int8_t *dst, u_int16_t type, libnet_t *l); + +/** + * Builds a Fiber Distributed Data Interface (FDDI) header. + * @param fc class format and priority + * @param dst destination fddi address + * @param src source fddi address + * @param dsap destination service access point + * @param ssap source service access point + * @param cf cf + * @param oui 3 byte IEEE organizational code + * @param type upper layer protocol + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_fddi(u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, +u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Autobuilds a Fiber Distributed Data Interface (FDDI) header. + * @param fc class format and priority + * @param dst destination fddi address + * @param dsap destination service access point + * @param ssap source service access point + * @param cf cf + * @param oui IEEE organizational code + * @param type upper layer protocol + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_fddi(u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, +u_int8_t cf, u_int8_t *oui, u_int16_t type, libnet_t *l); + +/** + * 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. + * @param hrd hardware address format + * @param pro protocol address format + * @param hln hardware address length + * @param pln protocol address length + * @param op ARP operation type + * @param sha sender's hardware address + * @param spa sender's protocol address + * @param tha target hardware address + * @param tpa targer protocol address + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_arp(u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, +u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param op ARP operation type + * @param sha sender's hardware address + * @param spa sender's protocol address + * @param tha target hardware address + * @param tpa targer protocol address + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_arp(u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, +u_int8_t *tpa, libnet_t *l); + +/** + * Builds an RFC 793 Transmission Control Protocol (TCP) header. + * @param sp source port + * @param dp destination port + * @param seq sequence number + * @param ack acknowledgement number + * @param control control flags + * @param win window size + * @param sum checksum (0 for libnet to autofill) + * @param urg urgent pointer + * @param len total length of the TCP packet (for checksum calculation) + * @param payload + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_tcp(u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, +u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param options byte string of TCP options + * @param options_s length of options string + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_tcp_options(u_int8_t *options, u_int32_t options_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * Builds an RFC 768 User Datagram Protocol (UDP) header. + * @param sp source port + * @param dp destination port + * @param len total length of the UDP packet + * @param sum checksum (0 for libnet to autofill) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_udp(u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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 libnet_build_data() to construct them. + * @param version CDP version + * @param ttl time to live (time information should be cached by recipient) + * @param sum checksum (0 for libnet to autofill) + * @param type type of data contained in value + * @param len length of value arugment + * @param value the CDP information string + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_cdp(u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, +u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) + * echo request/reply header + * @param type type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO) + * @param code code of ICMP packet (should be 0) + * @param sum checksum (0 for libnet to autofill) + * @param id identification number + * @param seq packet sequence number + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_echo(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int16_t id, u_int16_t seq, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) + * IP netmask request/reply header. + * @param type type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY) + * @param code code of ICMP packet (should be 0) + * @param sum checksum (0 for libnet to autofill) + * @param id identification number + * @param seq packet sequence number + * @param mask subnet mask + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_mask(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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 libnet_build_ipv4(). + * @param type type of ICMP packet (should be ICMP_UNREACH) + * @param code code of ICMP packet (should be one of the 16 unreachable codes) + * @param sum checksum (0 for libnet to autofill) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_unreach(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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 libnet_build_ipv4(). + * @param type type of ICMP packet (should be ICMP_REDIRECT) + * @param code code of ICMP packet (should be one of the four redirect codes) + * @param sum checksum (0 for libnet to autofill) + * @param gateway + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_redirect(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int32_t gateway, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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 libnet_build_ipv4(). + * @param type type of ICMP packet (should be ICMP_TIMXCEED) + * @param code code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS) + * @param sum checksum (0 for libnet to autofill) + * @param payload optional payload or NULL + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_timeexceed(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) + * timestamp request/reply header. + * @param type type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY) + * @param code code of ICMP packet (should be 0) + * @param sum checksum (0 for libnet to autofill) + * @param id identification number + * @param seq sequence number + * @param otime originate timestamp + * @param rtime receive timestamp + * @param ttime transmit timestamp + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_icmpv4_timestamp(u_int8_t type, u_int8_t code, u_int16_t sum, +u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header. + * @param type packet type + * @param code packet code (should be 0) + * @param sum checksum (0 for libnet to autofill) + * @param ip IPv4 address + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_igmp(u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a version 4 RFC 791 Internet Protocol (IP) header. + * + * @param ip_len total length of the IP packet including all subsequent data (subsequent + * data includes any IP options and IP options padding) + * @param tos type of service bits + * @param id IP identification number + * @param frag fragmentation bits and offset + * @param ttl time to live in the network + * @param prot upper layer protocol + * @param sum checksum (0 for libnet to autofill) + * @param src source IPv4 address (little endian) + * @param dst destination IPv4 address (little endian) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv4(u_int16_t ip_len, u_int8_t tos, u_int16_t id, u_int16_t frag, +u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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). + * + * When building a chain, the options must be built, then the IPv4 header. + * + * When updating a chain, if the block following the options is an IPv4 header, + * it's total length and header length will be updated if the options block + * size changes. + * + * @param options byte string of IP options (it will be padded up to be an integral + * multiple of 32-bit words). + * @param options_s length of options string + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv4_options(u_int8_t *options, u_int32_t options_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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 + * libnet_build_ipv4(). 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. + * @param len total length of the IP packet including all subsequent data + * @param prot upper layer protocol + * @param dst destination IPv4 address (little endian) + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_ipv4(u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t *l); + +/** + * Builds a version 6 RFC 2460 Internet Protocol (IP) header. + * @param tc traffic class + * @param fl flow label + * @param len total length of the IP packet + * @param nh next header + * @param hl hop limit + * @param src source IPv6 address + * @param dst destination IPv6 address + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6(u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, +u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header. + * @param nh next header + * @param reserved unused value... OR IS IT! + * @param frag fragmentation bits (ala ipv4) + * @param id packet identification + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6_frag(u_int8_t nh, u_int8_t reserved, u_int16_t frag, +u_int32_t id, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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. + * @param nh next header + * @param len length of the header in 8-byte octets not including the first 8 octets + * @param rtype routing header type + * @param segments number of routing segments that follow + * @param payload optional payload of routing information + * @param payload_s payload length + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6_routing(u_int8_t nh, u_int8_t len, u_int8_t rtype, +u_int8_t segments, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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. + * @param nh next header + * @param len length of the header in 8-byte octets not including the first 8 octets + * @param payload options payload + * @param payload_s payload length + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6_destopts(u_int8_t nh, u_int8_t len, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param nh next header + * @param len length of the header in 8-byte octets not including the first 8 octets + * @param payload options payload + * @param payload_s payload length + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipv6_hbhopts(u_int8_t nh, u_int8_t len, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * This function is not yet implement and is a NOOP. + * @param len length + * @param nh next header + * @param dst destination IPv6 address + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_ipv6(u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, +libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a Cisco Inter-Switch Link (ISL) header. + * @param dhost destination address (should be 01:00:0c:00:00) + * @param type type of frame + * @param user user defined data + * @param shost source mac address + * @param len total length of the encapuslated packet less 18 bytes + * @param snap SNAP information (0xaaaa03 + vendor code) + * @param vid 15 bit VLAN ID, 1 bit BPDU or CDP indicator + * @param portindex port index + * @param reserved used for FDDI and token ring + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_isl(u_int8_t *dhost, u_int8_t type, u_int8_t user, +u_int8_t *shost, u_int16_t len, u_int8_t *snap, u_int16_t vid, +u_int16_t portindex, u_int16_t reserved, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an Internet Protocol Security Encapsulating Security Payload header. + * @param spi security parameter index + * @param seq ESP sequence number + * @param iv initialization vector + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipsec_esp_hdr(u_int32_t spi, u_int32_t seq, u_int32_t iv, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an Internet Protocol Security Encapsulating Security Payload footer. + * @param len padding length + * @param nh next header + * @param auth authentication data + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipsec_esp_ftr(u_int8_t len, u_int8_t nh, int8_t *auth, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an Internet Protocol Security Authentication header. + * @param nh next header + * @param len payload length + * @param res reserved + * @param spi security parameter index + * @param seq sequence number + * @param auth authentication data + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ipsec_ah(u_int8_t nh, u_int8_t len, u_int16_t res, +u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an RFC 1035 version 4 DNS header. Additional DNS payload information + * should be specified using the payload interface. + * @param h_len + * @param id DNS packet id + * @param flags control flags + * @param num_q number of questions + * @param num_anws_rr number of answer resource records + * @param num_auth_rr number of authority resource records + * @param num_addi_rr number of additional resource records + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_dnsv4(u_int16_t h_len, u_int16_t id, u_int16_t flags, +u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, +u_int16_t num_addi_rr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * Builds a Routing Information Protocol header (RFCs 1058 and 2453). + * @param cmd command + * @param version protocol version + * @param rd version one: 0, version two: routing domain + * @param af address family + * @param rt version one: 0, version two: route tag + * @param addr IPv4 address + * @param mask version one: 0, version two: subnet mask + * @param next_hop version one: 0, version two: next hop address + * @param metric routing metric + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_rip(u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, +u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, +u_int32_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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). + * @param rm record marking indicating the position in a stream, 0 otherwise + * @param xid transaction identifier used to link calls and replies + * @param prog_num remote program specification typically between 0 - 1fffffff + * @param prog_vers remote program version specification + * @param procedure procedure to be performed by remote program + * @param cflavor authentication credential type + * @param clength credential length (should be 0) + * @param cdata opaque credential data (currently unused) + * @param vflavor authentication verifier type + * @param vlength verifier length (should be 0) + * @param vdata opaque verifier data (currently unused) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_rpc_call(u_int32_t rm, u_int32_t xid, u_int32_t prog_num, +u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, +u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param id protocol id + * @param version protocol version + * @param bpdu_type bridge protocol data unit type + * @param flags flags + * @param root_id root id + * @param root_pc root path cost + * @param bridge_id bridge id + * @param port_id port id + * @param message_age message age + * @param max_age max age + * @param hello_time hello time + * @param f_delay forward delay + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_stp_conf(u_int16_t id, u_int8_t version, u_int8_t bpdu_type, +u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id, +u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, +u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param id protocol id + * @param version protocol version + * @param bpdu_type bridge protocol data unit type + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_stp_tcn(u_int16_t id, u_int8_t version, u_int8_t bpdu_type, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a token ring header. + * @param ac access control + * @param fc frame control + * @param dst destination address + * @param src source address + * @param dsap destination service access point + * @param ssap source service access point + * @param cf control field + * @param oui Organizationally Unique Identifier + * @param type upper layer protocol type + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_token_ring(u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, +u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Auto-builds a token ring header. + * @param ac access control + * @param fc frame control + * @param dst destination address + * @param dsap destination service access point + * @param ssap source service access point + * @param cf control field + * @param oui Organizationally Unique Identifier + * @param type upper layer protocol type + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_token_ring(u_int8_t ac, u_int8_t fc, u_int8_t *dst, +u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, +libnet_t *l); + +/** + * 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. + * @param version VRRP version (should be 2) + * @param type VRRP packet type (should be 1 -- ADVERTISEMENT) + * @param vrouter_id virtual router identification + * @param priority priority (higher numbers indicate higher priority) + * @param ip_count number of IPv4 addresses contained in this advertisement + * @param auth_type type of authentication (0, 1, 2 -- see RFC) + * @param advert_int interval between advertisements + * @param sum checksum (0 for libnet to autofill) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_vrrp(u_int8_t version, u_int8_t type, u_int8_t vrouter_id, +u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, +u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header. + * @param label 20-bit label value + * @param experimental 3-bit reserved field + * @param bos 1-bit bottom of stack identifier + * @param ttl time to live + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_mpls(u_int32_t label, u_int8_t experimental, u_int8_t bos, +u_int8_t ttl, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * Builds an RFC 958 Network Time Protocol (NTP) header. + * @param leap_indicator the leap indicator + * @param version NTP protocol version + * @param mode NTP mode + * @param stratum stratum + * @param poll polling interval + * @param precision precision + * @param delay_int delay interval + * @param delay_frac delay fraction + * @param dispersion_int dispersion interval + * @param dispersion_frac dispersion fraction + * @param reference_id reference id + * @param ref_ts_int reference timestamp integer + * @param ref_ts_frac reference timestamp fraction + * @param orig_ts_int original timestamp integer + * @param orig_ts_frac original timestamp fraction + * @param rec_ts_int receiver timestamp integer + * @param rec_ts_frac reciever timestamp fraction + * @param xmt_ts_int transmit timestamp integer + * @param xmt_ts_frac transmit timestamp integer + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ntp(u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, +u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, +u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, +u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, +u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, +u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param len + * @param type + * @param rtr_id + * @param area_id + * @param sum + * @param autype + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2(u_int16_t len, u_int8_t type, u_int32_t rtr_id, +u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param netmask + * @param interval + * @param opts + * @param priority + * @param dead_int + * @param des_rtr + * @param bkup_rtr + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_hello(u_int32_t netmask, u_int16_t interval, u_int8_t opts, +u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param dgram_len + * @param opts + * @param type + * @param seqnum + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_dbd(u_int16_t dgram_len, u_int8_t opts, u_int8_t type, +u_int seqnum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * @param type + * @param lsid + * @param advrtr + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsr(u_int type, u_int lsid, u_int32_t advrtr, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param num + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsu(u_int num, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * @param age + * @param opts + * @param type + * @param lsid + * @param advrtr + * @param seqnum + * @param sum + * @param len + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa(u_int16_t age, u_int8_t opts, u_int8_t type, +u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param flags + * @param num + * @param id + * @param data + * @param type + * @param tos + * @param metric + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa_rtr(u_int16_t flags, u_int16_t num, u_int id, +u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param nmask + * @param rtrid + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa_net(u_int32_t nmask, u_int rtrid, u_int8_t *payload, +u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param nmask + * @param metric + * @param tos + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa_sum(u_int32_t nmask, u_int metric, u_int tos, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param nmask + * @param metric + * @param fwdaddr + * @param tag + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_ospfv2_lsa_as(u_int32_t nmask, u_int metric, u_int32_t fwdaddr, +u_int tag, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * 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. + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_data(u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * @param opcode + * @param htype + * @param hlen + * @param hopcount + * @param xid + * @param secs + * @param flags + * @param cip + * @param yip + * @param sip + * @param gip + * @param chaddr + * @param sname + * @param file + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_dhcpv4(u_int8_t opcode, u_int8_t htype, u_int8_t hlen, +u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, +u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, +u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * @param opcode + * @param htype + * @param hlen + * @param hopcount + * @param xid + * @param secs + * @param flags + * @param cip + * @param yip + * @param sip + * @param gip + * @param chaddr + * @param sname + * @param file + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bootpv4(u_int8_t opcode, u_int8_t htype, u_int8_t hlen, +u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, +u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, +u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * @param fv see libnet_build_gre(). + * @return size, see libnet_build_gre(). + */ +u_int32_t +libnet_getgre_length(u_int16_t fv); + +/** + * 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. + * @param fv the 16 0 to 7: which fields are included in the header (checksum, + * seq. number, key, ...), bits 8 to 12: flag, bits 13 to 15: version. + * @param type which protocol is encapsulated (PPP, IP, ...) + * @param sum checksum (0 for libnet to autofill). + * @param offset byte offset from the start of the routing field to the first byte of the SRE + * @param key inserted by the encapsulator to authenticate the source + * @param seq sequence number used by the receiver to sort the packets + * @param len size of the GRE packet + * @param payload + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_gre(u_int16_t fv, u_int16_t type, u_int16_t sum, +u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param fv the 16 0 to 7: which fields are included in the header (checksum, seq. number, key, ...), bits 8 to 12: flag, bits 13 to 15: version. + * @param type which protocol is encapsulated (PPP, IP, ...) + * @param sum checksum (0 for libnet to autofill). + * @param offset byte offset from the start of the routing field to the first byte of the SRE + * @param key inserted by the encapsulator to authenticate the source + * @param seq sequence number used by the receiver to sort the packets + * @param len size of the GRE packet + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_egre(u_int16_t fv, u_int16_t type, u_int16_t sum, +u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * @param af + * @param offset + * @param length + * @param routing + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_gre_sre(u_int16_t af, u_int8_t offset, u_int8_t length, +u_int8_t *routing, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, +libnet_ptag_t ptag); + +/** + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param marker a value the receiver can predict (if the message type is not BGP OPEN, or no authentication is used, these 16 bytes are normally set as all ones) + * @param len total length of the BGP message, including the header + * @param type type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE) + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bgp4_header(u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], +u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * 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). + * @param version protocol version (should be set to 4) + * @param src_as Autonomous System of the sender + * @param hold_time used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender + * @param bgp_id BGP identifier of the sender + * @param opt_len total length of the optional parameters field in bytes + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bgp4_open(u_int8_t version, u_int16_t src_as, u_int16_t hold_time, +u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header. Update + * messages are used to transfer routing information between BGP peers. + * @param unfeasible_rt_len indicates the length of the (next) "withdrawn routes" field in bytes + * @param withdrawn_rt list of IP addresses prefixes for the routes that are being withdrawn; each IP address prefix is built as a 2-tuple <length (1 byte), prefix (variable)> + * @param total_path_attr_len indicates the length of the (next) "path attributes" field in bytes + * @param path_attributes each attribute is a 3-tuple <type (2 bytes), length, value> + * @param info_len indicates the length of the (next) "network layer reachability information" field in bytes (needed for internal memory size calculation) + * @param reachability_info 2-tuples <length (1 byte), prefix (variable)>. + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bgp4_update(u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt, +u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len, +u_int8_t *reachability_info, u_int8_t *payload, u_int32_t payload_s, +libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param err_code type of notification + * @param err_subcode more specific information about the reported error. + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_bgp4_notification(u_int8_t err_code, u_int8_t err_subcode, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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: http://www.honeynet.org/papers/sebek.pdf. + * @param magic identify packets that should be hidden + * @param version protocol version, currently 1 + * @param type type of record (read data is type 0, write data is type 1) + * @param counter PDU counter used to identify when packet are lost + * @param time_sec seconds since EPOCH according to the honeypot + * @param time_usec residual microseconds + * @param pid PID + * @param uid UID + * @param fd FD + * @param cmd 12 first characters of the command + * @param length length in bytes of the PDU's body + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_sebek(u_int32_t magic, u_int16_t version, u_int16_t type, +u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, +u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * Builds a HSRP header. HSRP is a Cisco propietary protocol defined in + * RFC 2281 + * @param version version of the HSRP messages + * @param opcode type of message + * @param state current state of the router + * @param hello_time period in seconds between hello messages + * @param hold_time seconds that the current hello message is valid + * @param priority priority for the election proccess + * @param group standby group + * @param reserved reserved field + * @param authdata password + * @param virtual_ip virtual ip address + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_hsrp(u_int8_t version, u_int8_t opcode, u_int8_t state, +u_int8_t hello_time, u_int8_t hold_time, u_int8_t priority, u_int8_t group, +u_int8_t reserved, u_int8_t authdata[HSRP_AUTHDATA_LENGTH], u_int32_t virtual_ip, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst the destination MAC address + * @param src the source MAC address + * @param oui Organizationally Unique Identifier (unused for Ethernet) + * @param type the upper layer protocol type + * @param payload optional payload or NULL + * @param payload_s payload length or 0 + * @param l pointer to a libnet context + * @param ptag protocol tag to modify an existing header, 0 to build a new one + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_build_link(u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, +u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag); + +/** + * 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. + * @param dst the destination MAC address + * @param oui Organizationally Unique Identifier (unused for Ethernet) + * @param type the upper layer protocol type + * @param l pointer to a libnet context + * @return protocol tag value on success, -1 on error + */ +libnet_ptag_t +libnet_autobuild_link(u_int8_t *dst, u_int8_t *oui, u_int16_t type, +libnet_t *l); + +/** + * Writes a prebuilt packet to the network. The function assumes that l was + * previously initialized (via a call to libnet_init()) 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 + * libnet_stats(). + * @param l pointer to a libnet context + * @return the number of bytes written, -1 on error + */ +int +libnet_write(libnet_t *l); + +/** + * 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. + * @param l pointer to a libnet context + * @return a big endian IP address suitable for use in a libnet_build function or -1 + */ + +u_int32_t +libnet_get_ipaddr4(libnet_t *l); + +/** + * This function is not yet implemented under IPv6. + * @param l pointer to a libnet context + * @return well, nothing yet + */ +struct libnet_in6_addr +libnet_get_ipaddr6(libnet_t *l); + +/** + * 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 libnet_geterror() will + * tell you why. + * @param l pointer to a libnet context + * @return a pointer to the MAC address or NULL + */ +struct libnet_ether_addr * +libnet_get_hwaddr(libnet_t *l); + +/** + * 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. + * @param s the string to be parsed + * @param len the resulting size of the returned byte string + * @return a byte string or NULL on failure + */ +u_int8_t * +libnet_hex_aton(const char *s, int *len); + +/** + * Returns the version of libnet. + * @return the libnet version + */ +const char * +libnet_version(void); + +/** + * [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 libnet_adv_free_packet() should be made to free the + * memory packet occupies. If the function fails libnet_geterror() can tell you + * why. + * @param l pointer to a libnet context + * @param packet will contain the wire-ready packet + * @param packet_s will contain the packet size + * @return 1 on success, -1 on failure + */ +int +libnet_adv_cull_packet(libnet_t *l, u_int8_t **packet, u_int32_t *packet_s); + +/** + * [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 libnet_geterror() can + * tell you why. + * @param l pointer to a libnet context + * @param ptag the ptag referencing the header to pull + * @param header will contain the header + * @param header_s will contain the header size + * @return 1 on success, -1 on failure + */ +int +libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, +u_int32_t *header_s); + +/** + * [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 libnet_adv_cull_packet(). This function is part of the advanced + * interface and is only available when libnet is initialized in advanced mode. + * If the function fails libnet_geterror() can tell you why. + * @param l pointer to a libnet context + * @param packet a pointer to the packet to inject + * @param packet_s the size of the packet + * @return the number of bytes written, or -1 on failure + */ +int +libnet_adv_write_link(libnet_t *l, u_int8_t *packet, u_int32_t packet_s); + +/** + * [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 libnet_adv_cull_packet(). This function is part of the advanced + * interface and is only available when libnet is initialized in advanced mode. + * If the function fails libnet_geterror() can tell you why. + * @param l pointer to a libnet context + * @param packet a pointer to the packet to inject + * @param packet_s the size of the packet + * @return the number of bytes written, or -1 on failure + */ +int +libnet_adv_write_raw_ipv4(libnet_t *l, u_int8_t *packet, u_int32_t packet_s); + +/** + * [Advanced Interface] + * Frees the memory allocated when libnet_adv_cull_packet() is called. + * @param l pointer to a libnet context + * @param packet a pointer to the packet to free + */ +void +libnet_adv_free_packet(libnet_t *l, u_int8_t *packet); + +/** + * [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 libnet_init(). If the context queue in write + * locked, this function will fail. + * @param l pointer to a libnet context + * @param label a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE + * @return 1 on success, -1 on failure +*/ +int +libnet_cq_add(libnet_t *l, char *label); + +/** + * [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 libnet_destroy(). 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 libnet_cq_remove_by_label(). If the + * context queue is write locked, this function will fail. + * @param l pointer to a libnet context + * @return the pointer to the removed libnet context, NULL on failure + */ +libnet_t * +libnet_cq_remove(libnet_t *l); + +/** + * [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 libnet_destroy(). If the context queue is write locked, this function + * will fail. + * @param label canonical name of the context to remove + * @return the pointer to the removed libnet context, NULL on failure + */ +libnet_t * +libnet_cq_remove_by_label(char *label); + +/** + * [Context Queue] + * Returns the canonical label associated with the context. + * @param l pointer to a libnet context + * @return pointer to the libnet context's label + */ +const char * +libnet_cq_getlabel(libnet_t *l); + +/** + * [Context Queue] + * Locates a libnet context from the queue, indexed by a canonical label. + * @param label canonical label of the libnet context to retrieve + * @return the expected libnet context, NULL on failure + */ +libnet_t * +libnet_cq_find_by_label(char *label); + +/** + * [Context Queue] + * Destroys the entire context queue, calling libnet_destroy() on each + * member context. + */ +void +libnet_cq_destroy(void); + +/** + * [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: + * + * for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next()) + * { + * ... + * } + * + * Much of the time, the application programmer will use the iterator as it is + * written above; as such, libnet provides a macro to do exactly that, + * for_each_context_in_cq(l). Warning: do not call the iterator more than once + * in a single loop. + * @return the head of the context queue + */ +libnet_t * +libnet_cq_head(void); + +/** + * [Context Queue] + * Check whether the iterator is at the last context in the queue. + * @return 1 if at the end of the context queue, 0 otherwise + */ +int +libnet_cq_last(void); + +/** + * [Context Queue] + * Get next context from the context queue. + * @return the next context from the context queue + */ +libnet_t * +libnet_cq_next(void); + +/** + * [Context Queue] + * Function returns the number of libnet contexts that are in the queue. + * @return the number of libnet contexts currently in the queue + */ +u_int32_t +libnet_cq_size(void); + +/** + * [Context Queue] + */ +u_int32_t +libnet_cq_end_loop(void); + +/** + * [Diagnostic] + * Prints the contents of the given context. + * @param l pointer to a libnet context + */ +void +libnet_diag_dump_context(libnet_t *l); + +/** + * [Diagnostic] + * Prints the contents of every pblock. + * @param l pointer to a libnet context + */ +void +libnet_diag_dump_pblock(libnet_t *l); + +/** + * [Diagnostic] + * Returns the canonical name of the pblock type. + * @param type pblock type + * @return a string representing the pblock type type or "unknown" for an unknown value + */ +char * +libnet_diag_dump_pblock_type(u_int8_t type); + +/** + * [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. + * @param packet the packet to print + * @param len length of the packet in bytes + * @param swap 1 to swap byte order, 0 to not. + * Counter-intuitively, it is necessary to swap in order to see the byte + * order as it is on the wire (this may be a bug). + * @param stream a stream pointer to print to + */ +void +libnet_diag_dump_hex(u_int8_t *packet, u_int32_t len, int swap, FILE *stream); + +/* + * [Internal] + */ +int +libnet_write_raw_ipv4(libnet_t *l, u_int8_t *packet, u_int32_t size); + +/* + * [Internal] + */ +int +libnet_write_raw_ipv6(libnet_t *l, u_int8_t *packet, u_int32_t size); + +/* + * [Internal] + */ +int +libnet_write_link(libnet_t *l, u_int8_t *packet, u_int32_t size); + +#if ((__WIN32__) && !(__CYGWIN__)) +/* + * [Internal] + */ +SOCKET +libnet_open_raw4(libnet_t *l); +#else +/* + * [Internal] + */ +int +libnet_open_raw4(libnet_t *l); +#endif + +/* + * [Internal] + */ +int +libnet_close_raw4(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_open_raw6(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_close_raw6(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_select_device(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_open_link(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_close_link(libnet_t *l); + +/* + * [Internal] + */ +int +libnet_do_checksum(libnet_t *l, u_int8_t *packet, int protocol, int len); + +/* + * [Internal] + */ +u_int32_t +libnet_compute_crc(u_int8_t *buf, u_int32_t len); + +/* + * [Internal] + */ +u_int16_t +libnet_ip_check(u_int16_t *addr, int len); + +/* + * [Internal] + */ +int +libnet_in_cksum(u_int16_t *addr, int len); + +/* + * [Internal] + * If ptag is 0, function will create a pblock for the protocol unit type, + * append it to the list and return a pointer to it. If ptag is not 0, + * function will search the pblock list for the specified protocol block + * and return a pointer to it. + */ +libnet_pblock_t * +libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, u_int32_t n, +u_int8_t type); + +/* + * [Internal] + * Function creates the pblock list if l->protocol_blocks == NULL or appends + * an entry to the doubly linked list. + */ +libnet_pblock_t * +libnet_pblock_new(libnet_t *l, u_int32_t size); + +/* + * [Internal] + * Function swaps two pblocks in memory. + */ +int +libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2); + +/* + * [Internal] + * Function inserts a pblock into the doubly linked list. + */ +int +libnet_pblock_insert_before(libnet_t *l, libnet_ptag_t ptag1, +libnet_ptag_t ptag2); + +/* + * [Internal] + * Function removes a pblock from context + */ +void +libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p); + +/* + * [Internal] + * Function updates the pblock meta-inforation. Internally it updates the + * ptag with a monotonically increasing variable kept in l. This way each + * pblock has a succesively increasing ptag identifier. + */ +libnet_ptag_t +libnet_pblock_update(libnet_t *l, libnet_pblock_t *p, u_int32_t h, +u_int8_t type); + + + /* + * [Internal] + * Checksums are a real pain in the <beep>!!! + * Function updates referer used to compute the checksum. All + * pblock need to know where is their referer (ie IP header). + * So, this function is called each time a new IP header is inserted. + * It updates the ip_offset field (referer) of each previous pblock. + */ +void +libnet_pblock_record_ip_offset(libnet_t *l, libnet_pblock_t *p); + +/* + * [Internal] + * Function locates a given block by it's ptag. + */ +libnet_pblock_t * +libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag); + +/* + * [Internal] + * Function copies protocol block data over. + */ +int +libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, +u_int32_t len); + +/* + * [Internal] + * Function sets pblock flags. + */ +void +libnet_pblock_setflags(libnet_pblock_t *p, u_int8_t flags); + +/* + * [Internal] + * Function returns the protocol number for the protocol block type. If + * the type is unknown, the function defaults to returning IPPROTO_IP. + */ +int +libnet_pblock_p2p(u_int8_t type); + +/* + * [Internal] + * Function assembles the packet for subsequent writing. Function makes two + * passes through the pblock list: + */ +int +libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size); + +#if !(__WIN32__) +/* + * [Internal] + * By testing if we can retrieve the FLAGS of an iface + * we can know if it exists or not and if it is up. + */ +int +libnet_check_iface(libnet_t *l); +#endif + +#if defined(__WIN32__) +/* + * [Internal] + */ +BYTE * +libnet_win32_get_remote_mac(libnet_t *l, DWORD IP); + +/* + * [Internal] + */ +int +libnet_close_link_interface(libnet_t *l); + +/* + * [Internal] + */ +BYTE * +libnet_win32_read_arp_table(DWORD IP); +#endif +#endif /* __LIBNET_FUNCTIONS_H */ + +/* EOF */ diff --git a/unmerged/debian/tmp/usr/include/libnet/libnet-headers.h b/unmerged/debian/tmp/usr/include/libnet/libnet-headers.h new file mode 100644 index 0000000..92c17bb --- /dev/null +++ b/unmerged/debian/tmp/usr/include/libnet/libnet-headers.h @@ -0,0 +1,1708 @@ +/* + * $Id: libnet-headers.h,v 1.15 2004/11/09 07:05:07 mike Exp $ + * + * libnet-headers.h - Network routine library headers header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_HEADERS_H +#define __LIBNET_HEADERS_H +/* + * @file libnet-headers.h + * @brief libnet header information + */ + +/* + * Libnet defines header sizes for every builder function exported. + */ +#define LIBNET_802_1Q_H 0x12 /**< 802.1Q header: 18 bytes */ +#define LIBNET_802_1X_H 0x04 /**< 802.1X header: 4 bytes */ +#define LIBNET_802_2_H 0x03 /**< 802.2 LLC header: 3 bytes */ +#define LIBNET_802_2SNAP_H 0x08 /**< 802.2 LLC/SNAP header:8 bytes */ +#define LIBNET_802_3_H 0x0e /**< 802.3 header: 14 bytes */ +#define LIBNET_ARP_H 0x08 /**< ARP header w/o addrs: 8 bytes */ +#define LIBNET_ARP_ETH_IP_H 0x1c /**< ARP w/ ETH and IP: 28 bytes */ +#define LIBNET_BGP4_HEADER_H 0x13 /**< BGP header: 19 bytes */ +#define LIBNET_BGP4_OPEN_H 0x0a /**< BGP open header: 10 bytes */ +#define LIBNET_BGP4_UPDATE_H 0x04 /**< BGP open header: 4 bytes */ +#define LIBNET_BGP4_NOTIFICATION_H 0x02 /**< BGP notif. header: 2 bytes */ +#define LIBNET_CDP_H 0x08 /**< CDP header base: 8 bytes */ +#define LIBNET_DHCPV4_H 0xf0 /**< DHCP v4 header: 240 bytes */ +#define LIBNET_UDP_DNSV4_H 0x0c /**< UDP DNS v4 header: 12 bytes */ +#define LIBNET_TCP_DNSV4_H 0x0e /**< TCP DNS v4 header: 14 bytes */ +#define LIBNET_ETH_H 0x0e /**< Ethernet header: 14 bytes */ +#define LIBNET_FDDI_H 0x15 /**< FDDI header: 21 bytes */ +#define LIBNET_ICMPV4_H 0x04 /**< ICMP header base: 4 bytes */ +#define LIBNET_ICMPV4_ECHO_H 0x08 /**< ICMP_ECHO header: 8 bytes */ +#define LIBNET_ICMPV4_MASK_H 0x0c /**< ICMP_MASK header: 12 bytes */ +#define LIBNET_ICMPV4_UNREACH_H 0x08 /**< ICMP_UNREACH header: 8 bytes */ +#define LIBNET_ICMPV4_TIMXCEED_H 0x08 /**< ICMP_TIMXCEED header: 8 bytes */ +#define LIBNET_ICMPV4_REDIRECT_H 0x08 /**< ICMP_REDIRECT header: 8 bytes */ +#define LIBNET_ICMPV4_TS_H 0x14 /**< ICMP_TIMESTAMP headr:20 bytes */ +#define LIBNET_ICMPV6_H 0x08 /**< ICMP6 header base: 8 bytes */ +#define LIBNET_IGMP_H 0x08 /**< IGMP header: 8 bytes */ +#define LIBNET_IPV4_H 0x14 /**< IPv4 header: 20 bytes */ +#define LIBNET_IPV6_H 0x28 /**< IPv6 header: 40 bytes */ +#define LIBNET_IPV6_FRAG_H 0x08 /**< IPv6 frag header: 8 bytes */ +#define LIBNET_IPV6_ROUTING_H 0x04 /**< IPv6 frag header base:4 bytes */ +#define LIBNET_IPV6_DESTOPTS_H 0x02 /**< IPv6 dest opts base: 2 bytes */ +#define LIBNET_IPV6_HBHOPTS_H 0x02 /**< IPv6 hop/hop opt base:2 bytes */ +#define LIBNET_IPSEC_ESP_HDR_H 0x0c /**< IPSEC ESP header: 12 bytes */ +#define LIBNET_IPSEC_ESP_FTR_H 0x02 /**< IPSEC ESP footer: 2 bytes */ +#define LIBNET_IPSEC_AH_H 0x10 /**< IPSEC AH header: 16 bytes */ +#define LIBNET_ISL_H 0x1a /**< ISL header: 26 bytes */ +#define LIBNET_GRE_H 0x04 /**< GRE header: 4 bytes */ +#define LIBNET_GRE_SRE_H 0x04 /**< GRE SRE header: 4 bytes */ +#define LIBNET_MPLS_H 0x04 /**< MPLS header: 4 bytes */ +#define LIBNET_OSPF_H 0x10 /**< OSPF header: 16 bytes */ +#define LIBNET_OSPF_HELLO_H 0x18 /**< OSPF hello header: 24 bytes */ +#define LIBNET_OSPF_DBD_H 0x08 /**< OSPF DBD header: 8 bytes */ +#define LIBNET_OSPF_LSR_H 0x0c /**< OSPF LSR header: 12 bytes */ +#define LIBNET_OSPF_LSU_H 0x04 /**< OSPF LSU header: 4 bytes */ +#define LIBNET_OSPF_LSA_H 0x14 /**< OSPF LSA header: 20 bytes */ +#define LIBNET_OSPF_AUTH_H 0x08 /**< OSPF AUTH header: 8 bytes */ +#define LIBNET_OSPF_CKSUM 0x10 /**< OSPF CKSUM header: 16 bytes */ +#define LIBNET_OSPF_LS_RTR_H 0x10 /**< OSPF LS RTR header: 16 bytes */ +#define LIBNET_OSPF_LS_NET_H 0x08 /**< OSPF LS NET header: 8 bytes */ +#define LIBNET_OSPF_LS_SUM_H 0x0c /**< OSPF LS SUM header: 12 bytes */ +#define LIBNET_OSPF_LS_AS_EXT_H 0x10 /**< OSPF LS AS header: 16 bytes */ +#define LIBNET_NTP_H 0x30 /**< NTP header: 48 bytes */ +#define LIBNET_RIP_H 0x18 /**< RIP header base: 24 bytes */ +#define LIBNET_RPC_CALL_H 0x28 /**< RPC header: 40 bytes + * (assuming 8 byte auth header) + */ +#define LIBNET_RPC_CALL_TCP_H 0x2c /**< RPC header: 44 bytes + * (with record marking) + */ +#define LIBNET_SEBEK_H 0x30 /* sebek header: 48 bytes */ +#define LIBNET_STP_CONF_H 0x23 /**< STP conf header: 35 bytes */ +#define LIBNET_STP_TCN_H 0x04 /**< STP tcn header: 4 bytes */ +#define LIBNET_TOKEN_RING_H 0x16 /**< Token Ring header: 22 bytes */ +#define LIBNET_TCP_H 0x14 /**< TCP header: 20 bytes */ +#define LIBNET_UDP_H 0x08 /**< UDP header: 8 bytes */ +#define LIBNET_VRRP_H 0x08 /**< VRRP header: 8 bytes */ +#define LIBNET_HSRP_H 0x14 /**< HSRP header: 8 bytes */ + +/* + * IEEE 802.1Q (Virtual Local Area Network) VLAN header, static header + * size: 18 bytes + */ +struct libnet_802_1q_hdr +{ + u_int8_t vlan_dhost[ETHER_ADDR_LEN]; /**< destination ethernet address */ + u_int8_t vlan_shost[ETHER_ADDR_LEN]; /**< source ethernet address */ + u_int16_t vlan_tpi; /**< tag protocol ID */ + u_int16_t vlan_priority_c_vid; /**< priority | VLAN ID */ +#define LIBNET_802_1Q_PRIMASK 0x0007 /**< priority mask */ +#define LIBNET_802_1Q_CFIMASK 0x0001 /**< CFI mask */ +#define LIBNET_802_1Q_VIDMASK 0x0fff /**< vid mask */ + u_int16_t vlan_len; /**< length or type (802.3 / Eth 2) */ +}; + +/* + * IEEE 802.1X EAP (Extensible Authentication Protocol) header, static header + * size: 4 bytes + */ +struct libnet_802_1x_hdr +{ + u_int8_t dot1x_version; /**< protocol version */ + u_int8_t dot1x_type; /**< frame type */ +#define LIBNET_802_1X_PACKET 0x00 /**< 802.1x packet */ +#define LIBNET_802_1X_START 0x01 /**< 802.1x start */ +#define LIBNET_802_1X_LOGOFF 0x02 /**< 802.1x logoff */ +#define LIBNET_802_1X_KEY 0x03 /**< 802.1x key */ +#define LIBNET_802_1X_ENCASFAL 0x04 /**< 802.1x encasfal */ + u_int16_t dot1x_length; /**< total frame length */ +}; + +/* + * IEEE 802.2 LLC header + * Link Layer Control + * static header size: 3 bytes + */ +struct libnet_802_2_hdr +{ + u_int8_t llc_dsap; /* destination service access point */ + u_int8_t llc_ssap; /* source service access point */ +#define LIBNET_SAP_STP 0x42 +#define LIBNET_SAP_SNAP 0xaa + u_int8_t llc_control; /* control field */ +}; + + +/* + * IEEE 802.2 LLC/SNAP header + * SubNetwork Attachment Point + * static header size: 8 bytes + */ +struct libnet_802_2snap_hdr +{ + u_int8_t snap_dsap; /* destination service access point */ + u_int8_t snap_ssap; /* destination service access point */ + u_int8_t snap_control; /* control field */ + u_int8_t snap_oui[3]; /* OUI */ + u_int16_t snap_type; /* type */ +}; + + +/* + * 802.3 header + * IEEE Ethernet + * Static header size: 14 bytes + */ +struct libnet_802_3_hdr +{ + u_int8_t _802_3_dhost[ETHER_ADDR_LEN];/* destination ethernet address */ + u_int8_t _802_3_shost[ETHER_ADDR_LEN];/* source ethernet address */ + u_int16_t _802_3_len; /* packet type ID */ +}; + + +/* + * ARP header + * Address Resolution Protocol + * Base header size: 8 bytes + */ +struct libnet_arp_hdr +{ + u_int16_t ar_hrd; /* format of hardware address */ +#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ +#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ +#define ARPHRD_EETHER 2 /* Experimental Ethernet */ +#define ARPHRD_AX25 3 /* AX.25 Level 2 */ +#define ARPHRD_PRONET 4 /* PROnet token ring */ +#define ARPHRD_CHAOS 5 /* Chaosnet */ +#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ +#define ARPHRD_ARCNET 7 /* ARCnet */ +#define ARPHRD_APPLETLK 8 /* APPLEtalk */ +#define ARPHRD_LANSTAR 9 /* Lanstar */ +#define ARPHRD_DLCI 15 /* Frame Relay DLCI */ +#define ARPHRD_ATM 19 /* ATM */ +#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ +#define ARPHRD_IPSEC 31 /* IPsec tunnel */ + u_int16_t ar_pro; /* format of protocol address */ + u_int8_t ar_hln; /* length of hardware address */ + u_int8_t ar_pln; /* length of protocol addres */ + u_int16_t ar_op; /* operation type */ +#define ARPOP_REQUEST 1 /* req to resolve address */ +#define ARPOP_REPLY 2 /* resp to previous request */ +#define ARPOP_REVREQUEST 3 /* req protocol address given hardware */ +#define ARPOP_REVREPLY 4 /* resp giving protocol address */ +#define ARPOP_INVREQUEST 8 /* req to identify peer */ +#define ARPOP_INVREPLY 9 /* resp identifying peer */ + /* address information allocated dynamically */ +}; + +/* + * BGP4 header + * Border Gateway Protocol 4 + * Base header size : 19 bytes + */ +struct libnet_bgp4_header_hdr +{ +#define LIBNET_BGP4_MARKER_SIZE 16 + u_int8_t marker[LIBNET_BGP4_MARKER_SIZE]; + u_int16_t len; + u_int8_t type; +#define LIBNET_BGP4_OPEN 1 +#define LIBNET_BGP4_UPDATE 2 +#define LIBNET_BGP4_NOTIFICATION 3 +#define LIBNET_BGP4_KEEPALIVE 4 +}; + +/* + * BGP4 open header + * Border Gateway Protocol 4 + * Base header size : 10 bytes + */ +struct libnet_bgp4_open_hdr +{ + u_int8_t version; + u_int16_t src_as; + u_int16_t hold_time; + u_int32_t bgp_id; + u_int8_t opt_len; +}; + +/* + * BGP4 notification message + * + * Border Gateway Protocol 4 + * Base header size : 2 bytes + * + * Use payload if you need data + */ +struct libnet_bgp4_notification_hdr +{ +#define LIBNET_BGP4_MESSAGE_HEADER_ERROR 1 +#define LIBNET_BGP4_OPEN_MESSAGE_ERROR 2 +#define LIBNET_BGP4_UPDATE_MESSAGE_ERROR 3 +#define LIBNET_BGP4_HOLD_TIMER_EXPIRED 4 +#define LIBNET_BGP4_FINITE_STATE__ERROR 5 +#define LIBNET_BGP4_CEASE 6 + u_int8_t err_code; + +/* Message Header Error subcodes */ +#define LIBNET_BGP4_CONNECTION_NOT_SYNCHRONIZED 1 +#define LIBNET_BGP4_BAD_MESSAGE_LENGTH 2 +#define LIBNET_BGP4_BAD_MESSAGE_TYPE 3 +/* OPEN Message Error subcodes */ +#define LIBNET_BGP4_UNSUPPORTED_VERSION_NUMBER 1 +#define LIBNET_BGP4_BAD_PEER_AS 2 +#define LIBNET_BGP4_BAD_BGP_IDENTIFIER 3 +#define LIBNET_BGP4_UNSUPPORTED_OPTIONAL_PARAMETER 4 +#define LIBNET_BGP4_AUTHENTICATION_FAILURE 5 +#define LIBNET_BGP4_UNACCEPTABLE_HOLD_TIME 6 +/* UPDATE Message Error subcodes */ +#define LIBNET_BGP4_MALFORMED_ATTRIBUTE_LIST +#define LIBNET_BGP4_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE +#define LIBNET_BGP4_MISSING_WELL_KNOWN_ATTRIBUTE +#define LIBNET_BGP4_ATTRIBUTE_FLAGS_ERROR +#define LIBNET_BGP4_ATTRIBUTE_LENGTH_ERROR +#define LIBNET_BGP4_INVALID_ORIGIN_ATTRIBUTE +#define LIBNET_BGP4_AS_ROUTING_LOOP +#define LIBNET_BGP4_INVALID_NEXT_HOP_ATTRIBUTE +#define LIBNET_BGP4_OPTIONAL_ATTRIBUTE_ERROR +#define LIBNET_BGP4_INVALID_NETWORK_FIELD +#define LIBNET_BGP4_MALFORMED_AS_PATH + u_int8_t err_subcode; +}; + + + +/* + * For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001. + * Let's hope this one stays that way for a while! + */ +#define LIBNET_PROTO_CDP 200 + +/* + * CDP header + * Cisco Discovery Protocol + * Base header size: 8 bytes + */ +struct libnet_cdp_hdr +{ + u_int8_t cdp_version; /* version (should always be 0x01) */ + u_int8_t cdp_ttl; /* time reciever should hold info in this packet */ + u_int16_t cdp_sum; /* checksum */ + u_int16_t cdp_type; /* type */ +#define LIBNET_CDP_DEVID 0x1 /* device id */ +#define LIBNET_CDP_ADDRESS 0x2 /* address */ +#define LIBNET_CDP_PORTID 0x3 /* port id */ +#define LIBNET_CDP_CAPABIL 0x4 /* capabilities */ +#define LIBNET_CDP_VERSION 0x5 /* version */ +#define LIBNET_CDP_PLATFORM 0x6 /* platform */ +#define LIBNET_CDP_IPPREFIX 0x7 /* ip prefix */ + u_int16_t cdp_len; /* type + length + value */ + /* value information done dynamically */ + +/* CDP capabilities */ +#define LIBNET_CDP_CAP_L3R 0x01/* performs level 3 routing */ +#define LIBNET_CDP_CAP_L2B 0x02/* performs level 2 transparent bridging */ +#define LIBNET_CDP_CAP_L2SRB 0x04/* performs level 2 sourceroute bridging */ +#define LIBNET_CDP_CAP_L2S 0x08/* performs level 2 switching */ +#define LIBNET_CDP_CAP_SR 0x10/* sends and recieves packets on a network */ +#define LIBNET_CDP_CAP_NOI 0x20/* does not forward IGMP on non-router ports */ +#define LIBNET_CDP_CAP_L1F 0x40/* provides level 1 functionality */ +}; + + +/* + * Used as an overlay for type/len/values + */ +struct libnet_cdp_value_hdr +{ + u_int16_t cdp_type; + u_int16_t cdp_len; +}; + + +/* + * DHCP header + * Dynamic Host Configuration Protocol + * Static header size: f0 bytes + */ +struct libnet_dhcpv4_hdr +{ + u_int8_t dhcp_opcode; /* opcode */ +#define LIBNET_DHCP_REQUEST 0x1 +#define LIBNET_DHCP_REPLY 0x2 + u_int8_t dhcp_htype; /* hardware address type */ + u_int8_t dhcp_hlen; /* hardware address length */ + u_int8_t dhcp_hopcount; /* used by proxy servers */ + u_int32_t dhcp_xid; /* transaction ID */ + u_int16_t dhcp_secs; /* number of seconds since trying to bootstrap */ + u_int16_t dhcp_flags; /* flags for DHCP, unused for BOOTP */ + u_int32_t dhcp_cip; /* client's IP */ + u_int32_t dhcp_yip; /* your IP */ + u_int32_t dhcp_sip; /* server's IP */ + u_int32_t dhcp_gip; /* gateway IP */ + u_int8_t dhcp_chaddr[16]; /* client hardware address */ + u_int8_t dhcp_sname[64]; /* server host name */ + u_int8_t dhcp_file[128]; /* boot file name */ + u_int32_t dhcp_magic; /* BOOTP magic header */ +#define DHCP_MAGIC 0x63825363 +#define LIBNET_BOOTP_MIN_LEN 0x12c +#define LIBNET_DHCP_PAD 0x00 +#define LIBNET_DHCP_SUBNETMASK 0x01 +#define LIBNET_DHCP_TIMEOFFSET 0x02 +#define LIBNET_DHCP_ROUTER 0x03 +#define LIBNET_DHCP_TIMESERVER 0x04 +#define LIBNET_DHCP_NAMESERVER 0x05 +#define LIBNET_DHCP_DNS 0x06 +#define LIBNET_DHCP_LOGSERV 0x07 +#define LIBNET_DHCP_COOKIESERV 0x08 +#define LIBNET_DHCP_LPRSERV 0x09 +#define LIBNET_DHCP_IMPSERV 0x0a +#define LIBNET_DHCP_RESSERV 0x0b +#define LIBNET_DHCP_HOSTNAME 0x0c +#define LIBNET_DHCP_BOOTFILESIZE 0x0d +#define LIBNET_DHCP_DUMPFILE 0x0e +#define LIBNET_DHCP_DOMAINNAME 0x0f +#define LIBNET_DHCP_SWAPSERV 0x10 +#define LIBNET_DHCP_ROOTPATH 0x11 +#define LIBNET_DHCP_EXTENPATH 0x12 +#define LIBNET_DHCP_IPFORWARD 0x13 +#define LIBNET_DHCP_SRCROUTE 0x14 +#define LIBNET_DHCP_POLICYFILTER 0x15 +#define LIBNET_DHCP_MAXASMSIZE 0x16 +#define LIBNET_DHCP_IPTTL 0x17 +#define LIBNET_DHCP_MTUTIMEOUT 0x18 +#define LIBNET_DHCP_MTUTABLE 0x19 +#define LIBNET_DHCP_MTUSIZE 0x1a +#define LIBNET_DHCP_LOCALSUBNETS 0x1b +#define LIBNET_DHCP_BROADCASTADDR 0x1c +#define LIBNET_DHCP_DOMASKDISCOV 0x1d +#define LIBNET_DHCP_MASKSUPPLY 0x1e +#define LIBNET_DHCP_DOROUTEDISC 0x1f +#define LIBNET_DHCP_ROUTERSOLICIT 0x20 +#define LIBNET_DHCP_STATICROUTE 0x21 +#define LIBNET_DHCP_TRAILERENCAP 0x22 +#define LIBNET_DHCP_ARPTIMEOUT 0x23 +#define LIBNET_DHCP_ETHERENCAP 0x24 +#define LIBNET_DHCP_TCPTTL 0x25 +#define LIBNET_DHCP_TCPKEEPALIVE 0x26 +#define LIBNET_DHCP_TCPALIVEGARBAGE 0x27 +#define LIBNET_DHCP_NISDOMAIN 0x28 +#define LIBNET_DHCP_NISSERVERS 0x29 +#define LIBNET_DHCP_NISTIMESERV 0x2a +#define LIBNET_DHCP_VENDSPECIFIC 0x2b +#define LIBNET_DHCP_NBNS 0x2c +#define LIBNET_DHCP_NBDD 0x2d +#define LIBNET_DHCP_NBTCPIP 0x2e +#define LIBNET_DHCP_NBTCPSCOPE 0x2f +#define LIBNET_DHCP_XFONT 0x30 +#define LIBNET_DHCP_XDISPLAYMGR 0x31 +#define LIBNET_DHCP_DISCOVERADDR 0x32 +#define LIBNET_DHCP_LEASETIME 0x33 +#define LIBNET_DHCP_OPTIONOVERLOAD 0x34 +#define LIBNET_DHCP_MESSAGETYPE 0x35 +#define LIBNET_DHCP_SERVIDENT 0x36 +#define LIBNET_DHCP_PARAMREQUEST 0x37 +#define LIBNET_DHCP_MESSAGE 0x38 +#define LIBNET_DHCP_MAXMSGSIZE 0x39 +#define LIBNET_DHCP_RENEWTIME 0x3a +#define LIBNET_DHCP_REBINDTIME 0x3b +#define LIBNET_DHCP_CLASSSID 0x3c +#define LIBNET_DHCP_CLIENTID 0x3d +#define LIBNET_DHCP_NISPLUSDOMAIN 0x40 +#define LIBNET_DHCP_NISPLUSSERVERS 0x41 +#define LIBNET_DHCP_MOBILEIPAGENT 0x44 +#define LIBNET_DHCP_SMTPSERVER 0x45 +#define LIBNET_DHCP_POP3SERVER 0x46 +#define LIBNET_DHCP_NNTPSERVER 0x47 +#define LIBNET_DHCP_WWWSERVER 0x48 +#define LIBNET_DHCP_FINGERSERVER 0x49 +#define LIBNET_DHCP_IRCSERVER 0x4a +#define LIBNET_DHCP_STSERVER 0x4b +#define LIBNET_DHCP_STDASERVER 0x4c +#define LIBNET_DHCP_END 0xff + +#define LIBNET_DHCP_MSGDISCOVER 0x01 +#define LIBNET_DHCP_MSGOFFER 0x02 +#define LIBNET_DHCP_MSGREQUEST 0x03 +#define LIBNET_DHCP_MSGDECLINE 0x04 +#define LIBNET_DHCP_MSGACK 0x05 +#define LIBNET_DHCP_MSGNACK 0x06 +#define LIBNET_DHCP_MSGRELEASE 0x07 +#define LIBNET_DHCP_MSGINFORM 0x08 +}; + + +/* this little guy got left out in the cold */ +#define LIBNET_DNS_H LIBNET_UDP_DNSV4_H +/* + * Base DNSv4 header + * Domain Name System + * Base header size: 12/14 bytes + */ +struct libnet_dnsv4_hdr +{ + u_int16_t h_len; /* length of the packet - only used with TCP */ + u_int16_t id; /* DNS packet ID */ + u_int16_t flags; /* DNS flags */ + u_int16_t num_q; /* Number of questions */ + u_int16_t num_answ_rr; /* Number of answer resource records */ + u_int16_t num_auth_rr; /* Number of authority resource records */ + u_int16_t num_addi_rr; /* Number of additional resource records */ +}; + +#define LIBNET_DNS_H LIBNET_UDP_DNSV4_H +struct libnet_dnsv4udp_hdr +{ + u_int16_t id; /* DNS packet ID */ + u_int16_t flags; /* DNS flags */ + u_int16_t num_q; /* Number of questions */ + u_int16_t num_answ_rr; /* Number of answer resource records */ + u_int16_t num_auth_rr; /* Number of authority resource records */ + u_int16_t num_addi_rr; /* Number of additional resource records */ +}; + +/* + * Ethernet II header + * Static header size: 14 bytes + */ +struct libnet_ethernet_hdr +{ + u_int8_t ether_dhost[ETHER_ADDR_LEN];/* destination ethernet address */ + u_int8_t ether_shost[ETHER_ADDR_LEN];/* source ethernet address */ + u_int16_t ether_type; /* protocol */ +}; + +#ifndef ETHERTYPE_PUP +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#endif +#ifndef ETHERTYPE_IP +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#endif +#ifndef ETHERTYPE_ARP +#define ETHERTYPE_ARP 0x0806 /* addr. resolution protocol */ +#endif +#ifndef ETHERTYPE_REVARP +#define ETHERTYPE_REVARP 0x8035 /* reverse addr. resolution protocol */ +#endif +#ifndef ETHERTYPE_VLAN +#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ +#endif +#ifndef ETHERTYPE_EAP +#define ETHERTYPE_EAP 0x888e /* IEEE 802.1X EAP authentication */ +#endif +#ifndef ETHERTYPE_MPLS +#define ETHERTYPE_MPLS 0x8847 /* MPLS */ +#endif +#ifndef ETHERTYPE_LOOPBACK +#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ +#endif + +struct libnet_ether_addr +{ + u_int8_t ether_addr_octet[6]; /* Ethernet address */ +}; + +/* + * Fiber Distributed Data Interface header + * + * Static header size: 21 bytes (LLC and 48-bit address addr only) + * + * Note: Organization field is 3 bytes which throws off the + * alignment of type. Therefore fddi_type (19 bytes in) + * is specified as two u_int8_ts. + */ +struct libnet_fddi_hdr +{ + u_int8_t fddi_frame_control; /* Class/Format/Priority */ +#define LIBNET_FDDI_LLC_FRAME 0x10 +#define LIBNET_FDDI_48BIT_ADDR 0x40 +#define LIBNET_FDDI_FC_REQD LIBNET_FDDI_LLC_FRAME | LIBNET_FDDI_48BIT_ADDR + u_int8_t fddi_dhost[FDDI_ADDR_LEN]; /* destination fddi address */ + u_int8_t fddi_shost[FDDI_ADDR_LEN]; /* source fddi address */ + u_int8_t fddi_llc_dsap; /* DSAP */ + u_int8_t fddi_llc_ssap; /* SSAP */ + u_int8_t fddi_llc_control_field; /* Class/Format/Priority */ + u_int8_t fddi_llc_org_code[LIBNET_ORG_CODE_SIZE]; /* Organization Code 3-bytes */ + u_int8_t fddi_type; /* Protocol Type */ + u_int8_t fddi_type1; /* see note above. */ +#define FDDI_TYPE_IP 0x0800 /* IP protocol */ +#define FDDI_TYPE_ARP 0x0806 /* addr. resolution protocol */ +#define FDDI_TYPE_REVARP 0x8035 /* reverse addr. resolution protocol */ +}; + + +struct libnet_fddi_addr +{ + u_int8_t fddi_addr_octet[6]; /* FDDI address */ +}; + + +/* + * GRE header - RFC 1701 & 2637 + * Generic Routing Encapsulation (GRE) + * Base header size: 4 bytes + */ +struct libnet_gre_hdr +{ + u_int16_t flags_ver; +#define GRE_CSUM 0x8000 +#define GRE_ROUTING 0x4000 +#define GRE_KEY 0x2000 +#define GRE_SEQ 0x1000 +#define GRE_STRICT 0x0800 +#define GRE_REC 0x0700 +#define GRE_ACK 0x0080 + +#define GRE_FLAGS_MASK 0x00F8 +#define GRE_VERSION_MASK 0x0007 + +#define GRE_VERSION_0 0x0000 +#define GRE_VERSION_1 0x0001 + + u_int16_t type; +#define GRE_SNA 0x0004 +#define GRE_OSI_NETWORK_LAYER 0x00FE +#define GRE_PUP 0x0200 +#define GRE_XNS 0x0600 +#define GRE_IP 0x0800 +#define GRE_CHAOS 0x0804 +#define GRE_RFC_826_ARP 0x0806 +#define GRE_FRAME_RELAY_ARP 0x0808 +#define GRE_VINES 0x0BAD +#define GRE_VINES_ECHO 0x0BAE +#define GRE_VINES_LOOPBACK 0x0BAF +#define GRE_DECNET 0x6003 +#define GRE_TRANSPARENT_ETHERNET_BRIDGING 0x6558 +#define GRE_RAW_FRAME_RELAY 0x6559 +#define GRE_APOLLO_DOMAIN 0x8019 +#define GRE_ETHERTALK 0x809B +#define GRE_NOVELL_IPX 0x8137 +#define GRE_RFC_1144_TCP_IP_COMPRESSION 0x876B +#define GRE_IP_AUTONOMOUS_SYSTEMS 0x876C +#define GRE_SECURE_DATA 0x876D +#define GRE_PPP 0x880b /* taken from RFC 2637 */ + + union { + struct { + u_int16_t sum; /* optional */ + u_int16_t offset; /* optional */ + u_int32_t key; /* optional */ + u_int32_t seq; /* optional */ + } _gre; + + struct { + u_int16_t payload_s; /* optional */ + u_int16_t callID; /* optional */ + u_int32_t seq; /* optional */ + u_int32_t ack; /* optional */ + } _egre; + }_data; + +#define gre_sum _data._gre.sum +#define gre_offset _data._gre.offset +#define gre_key _data._gre.key +#define gre_seq _data._gre.seq + +#define egre_payload_s _data._egre.payload_s +#define egre_callID _data._egre.callID +#define egre_seq _data._egre.seq +#define egre_ack _data._egre.ack +}; + + +#ifndef IPPROTO_GRE +#define IPPROTO_GRE 47 +#endif + +/* + * Source Route Entries (SRE) + * This is used for GRE as the Routing field is a list of SREs - RFC 1701 + * Base header size: 4 bytes + */ +struct libnet_gre_sre_hdr +{ + u_int16_t af; /* address familly */ + u_int8_t sre_offset; + u_int8_t sre_length; + u_int8_t *routing; +}; + + +/* + * IPv4 header + * Internet Protocol, version 4 + * Static header size: 20 bytes + */ +struct libnet_ipv4_hdr +{ +#if (LIBNET_LIL_ENDIAN) + u_int8_t ip_hl:4, /* header length */ + ip_v:4; /* version */ +#endif +#if (LIBNET_BIG_ENDIAN) + u_int8_t ip_v:4, /* version */ + ip_hl:4; /* header length */ +#endif + u_int8_t ip_tos; /* type of service */ +#ifndef IPTOS_LOWDELAY +#define IPTOS_LOWDELAY 0x10 +#endif +#ifndef IPTOS_THROUGHPUT +#define IPTOS_THROUGHPUT 0x08 +#endif +#ifndef IPTOS_RELIABILITY +#define IPTOS_RELIABILITY 0x04 +#endif +#ifndef IPTOS_LOWCOST +#define IPTOS_LOWCOST 0x02 +#endif + u_int16_t ip_len; /* total length */ + u_int16_t ip_id; /* identification */ + u_int16_t ip_off; +#ifndef IP_RF +#define IP_RF 0x8000 /* reserved fragment flag */ +#endif +#ifndef IP_DF +#define IP_DF 0x4000 /* dont fragment flag */ +#endif +#ifndef IP_MF +#define IP_MF 0x2000 /* more fragments flag */ +#endif +#ifndef IP_OFFMASK +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ +#endif + u_int8_t ip_ttl; /* time to live */ + u_int8_t ip_p; /* protocol */ + u_int16_t ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ +}; + +/* + * IP options + */ +#ifndef IPOPT_EOL +#define IPOPT_EOL 0 /* end of option list */ +#endif +#ifndef IPOPT_NOP +#define IPOPT_NOP 1 /* no operation */ +#endif +#ifndef IPOPT_RR +#define IPOPT_RR 7 /* record packet route */ +#endif +#ifndef IPOPT_TS +#define IPOPT_TS 68 /* timestamp */ +#endif +#ifndef IPOPT_SECURITY +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#endif +#ifndef IPOPT_LSRR +#define IPOPT_LSRR 131 /* loose source route */ +#endif +#ifndef IPOPT_SATID +#define IPOPT_SATID 136 /* satnet id */ +#endif +#ifndef IPOPT_SSRR +#define IPOPT_SSRR 137 /* strict source route */ +#endif + +/* + * IPv6 address + */ +struct libnet_in6_addr +{ + union + { + u_int8_t __u6_addr8[16]; + u_int16_t __u6_addr16[8]; + u_int32_t __u6_addr32[4]; + } __u6_addr; /* 128-bit IP6 address */ +}; +#define libnet_s6_addr __u6_addr.__u6_addr8 + +/* + * IPv6 header + * Internet Protocol, version 6 + * Static header size: 40 bytes + */ +struct libnet_ipv6_hdr +{ + u_int8_t ip_flags[4]; /* version, traffic class, flow label */ + u_int16_t ip_len; /* total length */ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_hl; /* hop limit */ + struct libnet_in6_addr ip_src, ip_dst; /* source and dest address */ + +}; + +/* + * IPv6 frag header + * Internet Protocol, version 6 + * Static header size: 8 bytes + */ +#define LIBNET_IPV6_NH_FRAGMENT 44 +struct libnet_ipv6_frag_hdr +{ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_reserved; /* reserved */ + u_int16_t ip_frag; /* fragmentation stuff */ + u_int32_t ip_id; /* id */ +}; + +/* + * IPv6 routing header + * Internet Protocol, version 6 + * Base header size: 4 bytes + */ +#define LIBNET_IPV6_NH_ROUTING 43 +struct libnet_ipv6_routing_hdr +{ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_len; /* length of header in 8 octet units (sans 1st) */ + u_int8_t ip_rtype; /* routing type */ + u_int8_t ip_segments; /* segments left */ + /* routing information allocated dynamically */ +}; + +/* + * IPv6 destination options header + * Internet Protocol, version 6 + * Base header size: 2 bytes + */ +#define LIBNET_IPV6_NH_DESTOPTS 60 +struct libnet_ipv6_destopts_hdr +{ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_len; /* length of header in 8 octet units (sans 1st) */ + /* destination options information allocated dynamically */ +}; + +/* + * IPv6 hop by hop options header + * Internet Protocol, version 6 + * Base header size: 2 bytes + */ +#define LIBNET_IPV6_NH_HBH 0 +struct libnet_ipv6_hbhopts_hdr +{ + u_int8_t ip_nh; /* next header */ + u_int8_t ip_len; /* length of header in 8 octet units (sans 1st) */ + /* destination options information allocated dynamically */ +}; + +/* + * ICMP6 header + * Internet Control Message Protocol v6 + * Base header size: 8 bytes + */ +#ifndef IPPROTO_ICMP6 +#define IPPROTO_ICMP6 0x3a +#endif +struct libnet_icmpv6_hdr +{ + u_int8_t icmp_type; /* ICMP type */ +#ifndef ICMP6_ECHO +#define ICMP6_ECHO 128 +#endif +#ifndef ICMP6_ECHOREPLY +#define ICMP6_ECHOREPLY 129 +#endif +#ifndef ICMP6_UNREACH +#define ICMP6_UNREACH 1 +#endif +#ifndef ICMP6_PKTTOOBIG +#define ICMP6_PKTTOOBIG 2 +#endif +#ifndef ICMP6_TIMXCEED +#define ICMP6_TIMXCEED 3 +#endif +#ifndef ICMP6_PARAMPROB +#define ICMP6_PARAMPROB 4 +#endif + u_int8_t icmp_code; /* ICMP code */ + u_int16_t icmp_sum; /* ICMP Checksum */ + u_int16_t id; /* ICMP id */ + u_int16_t seq; /* ICMP sequence number */ +}; + + + +/* + * ICMP header + * Internet Control Message Protocol + * Base header size: 4 bytes + */ +struct libnet_icmpv4_hdr +{ + u_int8_t icmp_type; /* ICMP type */ +#ifndef ICMP_ECHOREPLY +#define ICMP_ECHOREPLY 0 +#endif +#ifndef ICMP_UNREACH +#define ICMP_UNREACH 3 +#endif +#ifndef ICMP_SOURCEQUENCH +#define ICMP_SOURCEQUENCH 4 +#endif +#ifndef ICMP_REDIRECT +#define ICMP_REDIRECT 5 +#endif +#ifndef ICMP_ECHO +#define ICMP_ECHO 8 +#endif +#ifndef ICMP_ROUTERADVERT +#define ICMP_ROUTERADVERT 9 +#endif +#ifndef ICMP_ROUTERSOLICIT +#define ICMP_ROUTERSOLICIT 10 +#endif +#ifndef ICMP_TIMXCEED +#define ICMP_TIMXCEED 11 +#endif +#ifndef ICMP_PARAMPROB +#define ICMP_PARAMPROB 12 +#endif +#ifndef ICMP_TSTAMP +#define ICMP_TSTAMP 13 +#endif +#ifndef ICMP_TSTAMPREPLY +#define ICMP_TSTAMPREPLY 14 +#endif +#ifndef ICMP_IREQ +#define ICMP_IREQ 15 +#endif +#ifndef ICMP_IREQREPLY +#define ICMP_IREQREPLY 16 +#endif +#ifndef ICMP_MASKREQ +#define ICMP_MASKREQ 17 +#endif +#ifndef ICMP_MASKREPLY +#define ICMP_MASKREPLY 18 +#endif + u_int8_t icmp_code; /* ICMP code */ +#ifndef ICMP_UNREACH_NET +#define ICMP_UNREACH_NET 0 +#endif +#ifndef ICMP_UNREACH_HOST +#define ICMP_UNREACH_HOST 1 +#endif +#ifndef ICMP_UNREACH_PROTOCOL +#define ICMP_UNREACH_PROTOCOL 2 +#endif +#ifndef ICMP_UNREACH_PORT +#define ICMP_UNREACH_PORT 3 +#endif +#ifndef ICMP_UNREACH_NEEDFRAG +#define ICMP_UNREACH_NEEDFRAG 4 +#endif +#ifndef ICMP_UNREACH_SRCFAIL +#define ICMP_UNREACH_SRCFAIL 5 +#endif +#ifndef ICMP_UNREACH_NET_UNKNOWN +#define ICMP_UNREACH_NET_UNKNOWN 6 +#endif +#ifndef ICMP_UNREACH_HOST_UNKNOWN +#define ICMP_UNREACH_HOST_UNKNOWN 7 +#endif +#ifndef ICMP_UNREACH_ISOLATED +#define ICMP_UNREACH_ISOLATED 8 +#endif +#ifndef ICMP_UNREACH_NET_PROHIB +#define ICMP_UNREACH_NET_PROHIB 9 +#endif +#ifndef ICMP_UNREACH_HOST_PROHIB +#define ICMP_UNREACH_HOST_PROHIB 10 +#endif +#ifndef ICMP_UNREACH_TOSNET +#define ICMP_UNREACH_TOSNET 11 +#endif +#ifndef ICMP_UNREACH_TOSHOST +#define ICMP_UNREACH_TOSHOST 12 +#endif +#ifndef ICMP_UNREACH_FILTER_PROHIB +#define ICMP_UNREACH_FILTER_PROHIB 13 +#endif +#ifndef ICMP_UNREACH_HOST_PRECEDENCE +#define ICMP_UNREACH_HOST_PRECEDENCE 14 +#endif +#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 +#endif +#ifndef ICMP_REDIRECT_NET +#define ICMP_REDIRECT_NET 0 +#endif +#ifndef ICMP_REDIRECT_HOST +#define ICMP_REDIRECT_HOST 1 +#endif +#ifndef ICMP_REDIRECT_TOSNET +#define ICMP_REDIRECT_TOSNET 2 +#endif +#ifndef ICMP_REDIRECT_TOSHOST +#define ICMP_REDIRECT_TOSHOST 3 +#endif +#ifndef ICMP_TIMXCEED_INTRANS +#define ICMP_TIMXCEED_INTRANS 0 +#endif +#ifndef ICMP_TIMXCEED_REASS +#define ICMP_TIMXCEED_REASS 1 +#endif +#ifndef ICMP_PARAMPROB_OPTABSENT +#define ICMP_PARAMPROB_OPTABSENT 1 +#endif + + u_int16_t icmp_sum; /* ICMP Checksum */ + + union + { + struct + { + u_int16_t id; /* ICMP id */ + u_int16_t seq;/* ICMP sequence number */ + } echo; + +#undef icmp_id +#undef icmp_seq +#define icmp_id hun.echo.id +#define icmp_seq hun.echo.seq + + u_int32_t gateway; /* gateway host */ + struct + { + u_int16_t pad;/* padding */ + u_int16_t mtu;/* MTU size */ + } frag; + } hun; + union + { + struct + { + n_time its_otime; + n_time its_rtime; + n_time its_ttime; + } ts; + struct + { + struct libnet_ipv4_hdr idi_ip; + /* options and then 64 bits of data */ + } ip; + u_int32_t mask; + int8_t data[1]; + +#undef icmp_mask +#define icmp_mask dun.mask +#undef icmp_data +#define icmp_data dun.data + +#undef icmp_otime +#define icmp_otime dun.ts.its_otime +#undef icmp_rtime +#define icmp_rtime dun.ts.its_rtime +#undef icmp_ttime +#define icmp_ttime dun.ts.its_ttime + }dun; +}; + + +/* + * IGMP header + * Internet Group Message Protocol + * Static header size: 8 bytes + */ +struct libnet_igmp_hdr +{ + u_int8_t igmp_type; /* IGMP type */ +#ifndef IGMP_MEMBERSHIP_QUERY +#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ +#endif +#ifndef IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ +#endif +#ifndef IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#endif +#ifndef IGMP_LEAVE_GROUP +#define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */ +#endif + u_int8_t igmp_code; /* IGMP code */ + u_int16_t igmp_sum; /* IGMP checksum */ + struct in_addr igmp_group;/* IGMP host IP */ +}; + + +/* + * IPSEC header + * Internet Protocol Security Protocol + * Encapsulating Security Payload Header Static header size: 12 bytes + * Encapsulating Security Payload Footer Base header size: 2 bytes + * Authentication Header Static Size: 16 bytes + */ +#ifndef IPPROTO_ESP +#define IPPROTO_ESP 50 /* not everyone's got this */ +#endif +struct libnet_esp_hdr +{ + u_int32_t esp_spi; /* security parameter index */ + u_int32_t esp_seq; /* ESP sequence number */ + u_int32_t esp_iv; /* initialization vector */ +}; + +struct libnet_esp_ftr +{ + u_int8_t esp_pad_len; /* padding length */ + u_int8_t esp_nh; /* next header pointer */ + int8_t *esp_auth; /* authentication data */ +}; + +#ifndef IPPROTO_AH +#define IPPROTO_AH 51 /* not everyone's got this */ +#endif +struct libnet_ah_hdr +{ + u_int8_t ah_nh; /* next header */ + u_int8_t ah_len; /* payload length */ + u_int16_t ah_res; /* reserved */ + u_int32_t ah_spi; /* security parameter index */ + u_int32_t ah_seq; /* AH sequence number */ + u_int32_t ah_auth; /* authentication data */ +}; + + +/* + * For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001. + * Let's hope this one stays that way for a while! + */ +#define LIBNET_PROTO_ISL 201 +/* + * ISL header + * Cisco Inter-Switch Link + * Static header size: 26 bytes + */ +struct libnet_isl_hdr +{ + u_int8_t isl_dhost[5]; /* destination address "01:00:0c:00:00" */ +#if (LIBNET_LIL_ENDIAN) + u_int8_t isl_type:4, /* type of frame */ + isl_user:4; /* user defined bits */ +#endif +#if (LIBNET_BIG_ENDIAN) + u_int8_t isl_user:4, /* user defined bits */ + isl_type:4; /* type of frame */ +#endif + u_int8_t isl_shost[6]; /* source address */ + u_int16_t isl_len; /* total length of packet - 18 bytes */ + u_int8_t isl_snap[6]; /* 0xaaaa03 + vendor code */ + u_int16_t isl_vid; /* 15 bit VLAN ID, 1 bit BPDU / CDP indicator */ + u_int16_t isl_index; /* port index */ + u_int16_t isl_reserved; /* used for FDDI and token ring */ + /* ethernet frame and 4 byte isl crc */ +}; + +#ifndef IPPROTO_OSPF +#define IPPROTO_OSPF 89 /* not everyone's got this */ +#endif +#define IPPROTO_OSPF_LSA 890 /* made this up. Hope it's unused */ +#define LIBNET_MODX 4102 /* used in LSA checksum */ + +/* + * Options used in multiple OSPF packets + * More info can be found in section A.2 of RFC 2328. + */ +#define LIBNET_OPT_EBIT 0x02 /* describes the way AS-external-LSAs are flooded */ +#define LIBNET_OPT_MCBIT 0x04 /* whether or not IP multicast dgrams are fwdd */ +#define LIBNET_OPT_NPBIT 0x08 /* describes handling of type-7 LSAs */ +#define LIBNET_OPT_EABIT 0x10 /* rtr's willingness to send/recv EA-LSAs */ +#define LIBNET_OPT_DCBIT 0x20 /* describes handling of demand circuits */ + + +/* + * MPLS header + * Multi-Protocol Label Switching + * Static header size: 4 bytes + */ +struct libnet_mpls_hdr +{ + u_int32_t mpls_les; /* 20 bits label, 3 bits exp, 1 bit bos, ttl */ +#define LIBNET_MPLS_BOS_ON 1 +#define LIBNET_MPLS_BOS_OFF 0 +}; + +/* + * NTP header + * Network Time Protocol + * Static header size: 48 bytes + */ +struct libnet_ntp_hdr_l_fp /* int32_t floating point (64-bit) */ +{ + u_int32_t integer; /* integer */ + u_int32_t fraction; /* fraction */ +}; + +struct libnet_ntp_hdr_s_fp /* int16_t floating point (32-bit) */ +{ + u_int16_t integer; /* integer */ + u_int16_t fraction; /* fraction */ +}; + + +struct libnet_ntp_hdr +{ + u_int8_t ntp_li_vn_mode; /* leap indicator, version, mode */ +#define LIBNET_NTP_LI_NW 0x0 /* no warning */ +#define LIBNET_NTP_LI_AS 0x1 /* last minute has 61 seconds */ +#define LIBNET_NTP_LI_DS 0x2 /* last minute has 59 seconds */ +#define LIBNET_NTP_LI_AC 0x3 /* alarm condition */ + +#define LIBNET_NTP_VN_2 0x2 /* version 2 */ +#define LIBNET_NTP_VN_3 0x3 /* version 3 */ +#define LIBNET_NTP_VN_4 0x4 /* version 4 */ + +#define LIBNET_NTP_MODE_R 0x0 /* reserved */ +#define LIBNET_NTP_MODE_A 0x1 /* symmetric active */ +#define LIBNET_NTP_MODE_P 0x2 /* symmetric passive */ +#define LIBNET_NTP_MODE_C 0x3 /* client */ +#define LIBNET_NTP_MODE_S 0x4 /* server */ +#define LIBNET_NTP_MODE_B 0x5 /* broadcast */ +#define LIBNET_NTP_MODE_RC 0x6 /* reserved for NTP control message */ +#define LIBNET_NTP_MODE_RP 0x7 /* reserved for private use */ + u_int8_t ntp_stratum; /* stratum */ +#define LIBNET_NTP_STRATUM_UNAVAIL 0x0 /* unspecified or unavailable */ +#define LIBNET_NTP_STRATUM_PRIMARY 0x1 /* primary reference (radio clock) */ + /* 2 - 15 is secondary */ + /* 16 - 255 is reserved */ + u_int8_t ntp_poll; /* poll interval (should be 4 - 12) */ + u_int8_t ntp_precision; /* local clock precision */ + struct libnet_ntp_hdr_s_fp ntp_delay; /* roundtrip delay */ + struct libnet_ntp_hdr_s_fp ntp_dispersion; /* nominal error */ + u_int32_t ntp_reference_id; /* reference source id */ +#define LIBNET_NTP_REF_LOCAL 0x4c4f434c /* uncalibrated local clock */ +#define LIBNET_NTP_REF_PPS 0x50505300 /* atomic / pulse-per-second clock */ +#define LIBNET_NTP_REF_ACTS 0x41435453 /* NIST dialup modem */ +#define LIBNET_NTP_REF_USNO 0x55534e4f /* USNO modem service */ +#define LIBNET_NTP_REF_PTB 0x50544200 /* PTB (German) modem service */ +#define LIBNET_NTP_REF_TDF 0x54444600 /* Allouis (French) radio */ +#define LIBNET_NTP_REF_DCF 0x44434600 /* Mainflingen (German) radio */ +#define LIBNET_NTP_REF_MSF 0x4d534600 /* Rugby (UK) radio */ +#define LIBNET_NTP_REF_WWV 0x57575600 /* Ft Collins (US) radio */ +#define LIBNET_NTP_REF_WWVB 0x57575642 /* Boulder (US) radio */ +#define LIBNET_NTP_REF_WWVH 0x57575648 /* Kaui Hawaii (US) radio */ +#define LIBNET_NTP_REF_CHU 0x43485500 /* Ottaha (Canada) radio */ +#define LIBNET_NTP_REF_LORC 0x4c4f5243 /* LORAN-C radionavigation */ +#define LIBNET_NTP_REF_OMEG 0x4f4d4547 /* OMEGA radionavigation */ +#define LIBNET_NTP_REF_GPS 0x47505300 /* global positioning system */ +#define LIBNET_NTP_REF_GOES 0x474f4553 /* geostationary orbit env satellite */ + struct libnet_ntp_hdr_l_fp ntp_ref_ts; /* reference timestamp */ + struct libnet_ntp_hdr_l_fp ntp_orig_ts; /* originate timestamp */ + struct libnet_ntp_hdr_l_fp ntp_rec_ts; /* receive timestamp */ + struct libnet_ntp_hdr_l_fp ntp_xmt_ts; /* transmit timestamp */ +}; + + +/* + * OSPFv2 header + * Open Shortest Path First + * Static header size: 16 bytes + */ +struct libnet_ospf_hdr +{ + u_int8_t ospf_v; /* version */ +#define OSPFVERSION 2 + u_int8_t ospf_type; /* type */ +#define LIBNET_OSPF_UMD 0 /* UMd monitoring packet */ +#define LIBNET_OSPF_HELLO 1 /* HELLO packet */ +#define LIBNET_OSPF_DBD 2 /* dataBase description packet */ +#define LIBNET_OSPF_LSR 3 /* link state request packet */ +#define LIBNET_OSPF_LSU 4 /* link state Update Packet */ +#define LIBNET_OSPF_LSA 5 /* link state acknowledgement packet */ + u_int16_t ospf_len; /* length */ + struct in_addr ospf_rtr_id; /* source router ID */ + struct in_addr ospf_area_id;/* roam ID */ + u_int16_t ospf_sum; /* checksum */ + u_int16_t ospf_auth_type; /* authentication type */ +#define LIBNET_OSPF_AUTH_NULL 0 /* null password */ +#define LIBNET_OSPF_AUTH_SIMPLE 1 /* simple, plaintext, 8 int8_t password */ +#define LIBNET_OSPF_AUTH_MD5 2 /* MD5 */ +}; + + +/* + * OSPF authentication header + * Open Shortest Path First + * Static header size: 8 bytes + */ +struct libnet_auth_hdr +{ + u_int16_t ospf_auth_null; /* NULL */ + u_int8_t ospf_auth_keyid; /* authentication key ID */ + u_int8_t ospf_auth_len; /* auth data length */ + u_int ospf_auth_seq; /* cryptographic sequence number */ +}; + + +/* + * OSPF hello header + * Open Shortest Path First + * Static header size: 28 bytes + */ +struct libnet_ospf_hello_hdr +{ + struct in_addr hello_nmask; /* netmask associated with the interface */ + u_int16_t hello_intrvl; /* num of seconds between routers last packet */ + u_int8_t hello_opts; /* Options for HELLO packets (look above) */ + u_int8_t hello_rtr_pri; /* router's priority (if 0, can't be backup) */ + u_int hello_dead_intvl; /* # of secs a router is silent till deemed down */ + struct in_addr hello_des_rtr; /* Designated router on the network */ + struct in_addr hello_bkup_rtr; /* Backup router */ + struct in_addr hello_nbr; /* neighbor router, memcpy more as needed */ +}; + + +/* + * Database Description header. + */ +struct libnet_dbd_hdr +{ + u_int16_t dbd_mtu_len; /* max length of IP dgram that this 'if' can use */ + u_int8_t dbd_opts; /* DBD packet options (from above) */ + u_int8_t dbd_type; /* type of exchange occurring */ +#define LIBNET_DBD_IBI 0x01 /* init */ +#define LIBNET_DBD_MBIT 0x02 /* more DBD packets are to come */ +#define LIBNET_DBD_MSBIT 0x04 /* If 1, sender is the master in the exchange */ + u_int dbd_seq; /* DBD sequence number */ +}; + + +/* + * used for the LS type field in all LS* headers + */ +#define LIBNET_LS_TYPE_RTR 1 /* router-LSA */ +#define LIBNET_LS_TYPE_NET 2 /* network-LSA */ +#define LIBNET_LS_TYPE_IP 3 /* summary-LSA (IP Network) */ +#define LIBNET_LS_TYPE_ASBR 4 /* summary-LSA (ASBR) */ +#define LIBNET_LS_TYPE_ASEXT 5 /* AS-external-LSA */ + + +/* + * Link State Request header + */ +struct libnet_lsr_hdr +{ + u_int lsr_type; /* type of LS being requested */ + u_int lsr_lsid; /* link state ID */ + struct in_addr lsr_adrtr; /* advertising router (memcpy more as needed) */ +}; + + +/* + * Link State Update header + */ +struct libnet_lsu_hdr +{ + u_int lsu_num; /* number of LSAs that will be broadcasted */ +}; + + +/* + * Link State Acknowledgement header. + */ +struct libnet_lsa_hdr +{ + u_int16_t lsa_age; /* time in seconds since the LSA was originated */ + u_int8_t lsa_opts; /* look above for OPTS_* */ + u_int8_t lsa_type; /* look below for LS_TYPE_* */ + u_int lsa_id; /* link State ID */ + struct in_addr lsa_adv; /* router ID of Advertising router */ + u_int lsa_seq; /* LSA sequence number to detect old/bad ones */ + u_int16_t lsa_sum; /* "Fletcher Checksum" of all fields minus age */ + u_int16_t lsa_len; /* length in bytes including the 20 byte header */ +}; + + +/* + * Router LSA data format + * + * Other stuff for TOS can be added for backward compatability, for this + * version, only OSPFv2 is being FULLY supported. + */ +struct libnet_rtr_lsa_hdr +{ + u_int16_t rtr_flags; /* set to help describe packet */ +#define LIBNET_RTR_FLAGS_W 0x0100 /* W bit */ +#define LIBNET_RTR_FLAGS_E 0x0200 /* E bit */ +#define LIBNET_RTR_FLAGS_B 0x0400 /* B bit */ + u_int16_t rtr_num; /* number of links within that packet */ + u_int rtr_link_id; /* describes link_data (look below) */ +#define LIBNET_LINK_ID_NBR_ID 1 /* Neighbors router ID, also can be 4 */ +#define LIBNET_LINK_ID_IP_DES 2 /* IP address of designated router */ +#define LIBNET_LINK_ID_SUB 3 /* IP subnet number */ + u_int rtr_link_data; /* Depending on link_id, info is here */ + u_int8_t rtr_type; /* Description of router link */ +#define LIBNET_RTR_TYPE_PTP 1 /* Point-To-Point */ +#define LIBNET_RTR_TYPE_TRANS 2 /* Connection to a "transit network" */ +#define LIBNET_RTR_TYPE_STUB 3 /* Connectin to a "stub network" */ +#define RTR_TYPE_VRTL 4 /* connects to a "virtual link" */ + u_int8_t rtr_tos_num; /* number of different TOS metrics for this link */ + u_int16_t rtr_metric; /* the "cost" of using this link */ +}; + + +/* + * Network LSA data format. + */ +struct libnet_net_lsa_hdr +{ + struct in_addr net_nmask; /* Netmask for that network */ + u_int net_rtr_id; /* ID of router attached to that network */ +}; + + +/* + * Summary LSA data format. + */ +struct libnet_sum_lsa_hdr +{ + struct in_addr sum_nmask; /* Netmask of destination IP address */ + u_int sum_metric; /* Same as in rtr_lsa (&0xfff to use last 24bit */ + u_int sum_tos_metric; /* first 8bits are TOS, 24bits are TOS Metric */ +}; + + +/* + * AS External LSA data format. + * & 0xfff logic operator for as_metric to get last 24bits. + */ +struct libnet_as_lsa_hdr +{ + struct in_addr as_nmask; /* Netmask for advertised destination */ + u_int as_metric; /* May have to set E bit in first 8bits */ +#define LIBNET_AS_E_BIT_ON 0x80000000 /* as_metric */ + struct in_addr as_fwd_addr; /* Forwarding address */ + u_int as_rte_tag; /* External route tag */ +}; + + +/* + * Base RIP header + * Routing Information Protocol + * Base header size: 24 bytes + */ +struct libnet_rip_hdr +{ + u_int8_t rip_cmd; /* RIP command */ +#define RIPCMD_REQUEST 1 /* want info */ +#define RIPCMD_RESPONSE 2 /* responding to request */ +#define RIPCMD_TRACEON 3 /* turn tracing on */ +#define RIPCMD_TRACEOFF 4 /* turn it off */ +#define RIPCMD_POLL 5 /* like request, but anyone answers */ +#define RIPCMD_POLLENTRY 6 /* like poll, but for entire entry */ +#define RIPCMD_MAX 7 /* ? command */ + u_int8_t rip_ver; /* RIP version */ +#define RIPVER_0 0 +#define RIPVER_1 1 +#define RIPVER_2 2 + u_int16_t rip_rd; /* Zero (v1) or Routing Domain (v2) */ + u_int16_t rip_af; /* Address family */ + u_int16_t rip_rt; /* Zero (v1) or Route Tag (v2) */ + u_int32_t rip_addr; /* IP address */ + u_int32_t rip_mask; /* Zero (v1) or Subnet Mask (v2) */ + u_int32_t rip_next_hop; /* Zero (v1) or Next hop IP address (v2) */ + u_int32_t rip_metric; /* Metric */ +}; + +/* + * RPC headers + * Remote Procedure Call + */ +#define LIBNET_RPC_CALL 0 +#define LIBNET_RPC_REPLY 1 +#define LIBNET_RPC_VERS 2 +#define LIBNET_RPC_LAST_FRAG 0x80000000 + +/* + * Portmap defines + */ +#define LIBNET_PMAP_PROGRAM 100000 +#define LIBNET_PMAP_PROC_NULL 0 +#define LIBNET_PMAP_PROC_SET 1 +#define LIBNET_PMAP_PROC_UNSET 2 +#define LIBNET_PMAP_PROC_GETADDR 3 +#define LIBNET_PMAP_PROC_DUMP 4 +#define LIBNET_PMAP_PROC_CALLIT 5 +#define LIBNET_PMAP_PROC_BCAST 5 /* Not a typo */ +#define LIBNET_PMAP_PROC_GETTIME 6 +#define LIBNET_PMAP_PROC_UADDR2TADDR 7 +#define LIBNET_PMAP_PROC_TADDR2UADDR 8 +#define LIBNET_PMAP_PROC_GETVERSADDR 9 +#define LIBNET_PMAP_PROC_INDIRECT 10 +#define LIBNET_PMAP_PROC_GETADDRLIST 11 +#define LIBNET_PMAP_PROC_GETSTAT 12 + +/* There will be more to add... */ + +struct libnet_rpc_opaque_auth +{ + u_int32_t rpc_auth_flavor; + u_int32_t rpc_auth_length; +#if 0 + u_int8_t *rpc_auth_data; +#endif +}; + +struct libnet_rpc_call +{ + u_int32_t rpc_rpcvers; /* RPC version - must be 2 */ + u_int32_t rpc_prognum; /* Program Number */ + u_int32_t rpc_vers; /* Program Version */ + u_int32_t rpc_procedure; /* RPC procedure */ + struct libnet_rpc_opaque_auth rpc_credentials; + struct libnet_rpc_opaque_auth rpc_verifier; +}; + +struct libnet_rpc_call_hdr +{ + u_int32_t rpc_xid; /* xid (transaction identifier) */ + u_int32_t rpc_type; + struct libnet_rpc_call rpc_call; +}; + +struct libnet_rpc_call_tcp_hdr +{ + u_int32_t rpc_record_marking; /* used with byte stream protocols */ + struct libnet_rpc_call_hdr rpc_common; +}; + +/* + * STP configuration header + * Spanning Tree Protocol + * Static header size: 35 bytes + */ +struct libnet_stp_conf_hdr +{ + u_int16_t stp_id; /* protocol id */ + u_int8_t stp_version; /* protocol version */ + u_int8_t stp_bpdu_type; /* bridge protocol data unit type */ + u_int8_t stp_flags; /* control flags */ + u_int8_t stp_rootid[8]; /* root id */ + u_int32_t stp_rootpc; /* root path cost */ + u_int8_t stp_bridgeid[8]; /* bridge id */ + u_int16_t stp_portid; /* port id */ + u_int16_t stp_mage; /* message age */ + u_int16_t stp_maxage; /* max age */ + u_int16_t stp_hellot; /* hello time */ + u_int16_t stp_fdelay; /* forward delay */ +}; + + +/* + * STP topology change notification header + * Spanning Tree Protocol + * Static header size: 4 bytes + */ +struct libnet_stp_tcn_hdr +{ + u_int16_t stp_id; /* protocol id */ + u_int8_t stp_version; /* protocol version */ + u_int8_t stp_bpdu_type; /* bridge protocol data unit type */ +}; + + +/* + * TCP header + * Transmission Control Protocol + * Static header size: 20 bytes + */ +struct libnet_tcp_hdr +{ + u_int16_t th_sport; /* source port */ + u_int16_t th_dport; /* destination port */ + u_int32_t th_seq; /* sequence number */ + u_int32_t th_ack; /* acknowledgement number */ +#if (LIBNET_LIL_ENDIAN) + u_int8_t th_x2:4, /* (unused) */ + th_off:4; /* data offset */ +#endif +#if (LIBNET_BIG_ENDIAN) + u_int8_t th_off:4, /* data offset */ + th_x2:4; /* (unused) */ +#endif + u_int8_t th_flags; /* control flags */ +#ifndef TH_FIN +#define TH_FIN 0x01 /* finished send data */ +#endif +#ifndef TH_SYN +#define TH_SYN 0x02 /* synchronize sequence numbers */ +#endif +#ifndef TH_RST +#define TH_RST 0x04 /* reset the connection */ +#endif +#ifndef TH_PUSH +#define TH_PUSH 0x08 /* push data to the app layer */ +#endif +#ifndef TH_ACK +#define TH_ACK 0x10 /* acknowledge */ +#endif +#ifndef TH_URG +#define TH_URG 0x20 /* urgent! */ +#endif +#ifndef TH_ECE +#define TH_ECE 0x40 +#endif +#ifndef TH_CWR +#define TH_CWR 0x80 +#endif + u_int16_t th_win; /* window */ + u_int16_t th_sum; /* checksum */ + u_int16_t th_urp; /* urgent pointer */ +}; + +/* + * Token Ring Header + */ +struct libnet_token_ring_hdr +{ + u_int8_t token_ring_access_control; +#define LIBNET_TOKEN_RING_FRAME 0x10 + u_int8_t token_ring_frame_control; +#define LIBNET_TOKEN_RING_LLC_FRAME 0x40 + u_int8_t token_ring_dhost[TOKEN_RING_ADDR_LEN]; + u_int8_t token_ring_shost[TOKEN_RING_ADDR_LEN]; + u_int8_t token_ring_llc_dsap; + u_int8_t token_ring_llc_ssap; + u_int8_t token_ring_llc_control_field; + u_int8_t token_ring_llc_org_code[LIBNET_ORG_CODE_SIZE]; + u_int16_t token_ring_type; +#define TOKEN_RING_TYPE_IP 0x0800 /* IP protocol */ +#define TOKEN_RING_TYPE_ARP 0x0806 /* addr. resolution protocol */ +#define TOKEN_RING_TYPE_REVARP 0x8035 /* reverse addr. resolution protocol */ +}; + +struct libnet_token_ring_addr +{ + u_int8_t token_ring_addr_octet[6]; /* Token Ring address */ +}; + +/* + * UDP header + * User Data Protocol + * Static header size: 8 bytes + */ +struct libnet_udp_hdr +{ + u_int16_t uh_sport; /* soure port */ + u_int16_t uh_dport; /* destination port */ + u_int16_t uh_ulen; /* length */ + u_int16_t uh_sum; /* checksum */ +}; + +/* + * Sebek header + * Static header size: 48 bytes + */ +struct libnet_sebek_hdr +{ + u_int32_t magic; /* identify packets that should be hidden */ + u_int16_t version; /* protocol version, currently 1 */ +#define SEBEK_PROTO_VERSION 1 + u_int16_t type; /* type of record (read data is type 0, write data is type 1) */ +#define SEBEK_TYPE_READ 0 /* Currently, only read is supported */ +#define SEBEK_TYPE_WRITE 1 + u_int32_t counter; /* PDU counter used to identify when packet are lost */ + u_int32_t time_sec; /* seconds since EPOCH according to the honeypot */ + u_int32_t time_usec; /* residual microseconds */ + u_int32_t pid; /* PID */ + u_int32_t uid; /* UID */ + u_int32_t fd; /* FD */ +#define SEBEK_CMD_LENGTH 12 + u_int8_t cmd[SEBEK_CMD_LENGTH]; /* 12 first characters of the command */ + u_int32_t length; /* length in bytes of the PDU's body */ +}; + + +/* + * VRRP header + * Virtual Router Redundancy Protocol + * Static header size: 8 bytes + */ +#ifndef IPPROTO_VRRP +#define IPPROTO_VRRP 112 /* not everyone's got this */ +#endif +struct libnet_vrrp_hdr +{ +#if (LIBNET_LIL_ENDIAN) + u_int8_t vrrp_v:4, /* protocol version */ + vrrp_t:4; /* packet type */ +#endif +#if (LIBNET_BIG_ENDIAN) + u_int8_t vrrp_t:4, /* packet type */ + vrrp_v:4; /* protocol version */ +#endif +#define LIBNET_VRRP_VERSION_01 0x1 +#define LIBNET_VRRP_VERSION_02 0x2 +#define LIBNET_VRRP_TYPE_ADVERT 0x1 + u_int8_t vrrp_vrouter_id; /* virtual router id */ + u_int8_t vrrp_priority; /* priority */ + u_int8_t vrrp_ip_count; /* number of IP addresses */ + u_int8_t vrrp_auth_type; /* authorization type */ +#define LIBNET_VRRP_AUTH_NONE 0x1 +#define LIBNET_VRRP_AUTH_PASSWD 0x2 +#define LIBNET_VRRP_AUTH_IPAH 0x3 + u_int8_t vrrp_advert_int; /* advertisement interval */ + u_int16_t vrrp_sum; /* checksum */ + /* additional addresses */ + /* authentication info */ +}; + + +/* + * HSRP header + * Static header size: 20 bytes + */ +struct libnet_hsrp_hdr +{ +#define LIBNET_HSRP_VERSION 0x0 + u_int8_t version; /* Version of the HSRP messages */ +#define LIBNET_HSRP_TYPE_HELLO 0x0 +#define LIBNET_HSRP_TYPE_COUP 0x1 +#define LIBNET_HSRP_TYPE_RESIGN 0x2 + u_int8_t opcode; /* Type of message */ +#define LIBNET_HSRP_STATE_INITIAL 0x0 +#define LIBNET_HSRP_STATE_LEARN 0x1 +#define LIBNET_HSRP_STATE_LISTEN 0x2 +#define LIBNET_HSRP_STATE_SPEAK 0x4 +#define LIBNET_HSRP_STATE_STANDBY 0x8 +#define LIBNET_HSRP_STATE_ACTIVE 0x10 + u_int8_t state; /* Current state of the router */ + u_int8_t hello_time; /* Period in seconds between hello messages */ + u_int8_t hold_time; /* Seconds that the current hello message is valid */ + u_int8_t priority; /* Priority for the election proccess */ + u_int8_t group; /* Standby group */ + u_int8_t reserved; /* Reserved field */ +#define HSRP_AUTHDATA_LENGTH 8 + u_int8_t authdata[HSRP_AUTHDATA_LENGTH]; /* Password */ + u_int32_t virtual_ip; /* Virtual IP address */ +}; + +#endif /* __LIBNET_HEADERS_H */ + +/* EOF */ diff --git a/unmerged/debian/tmp/usr/include/libnet/libnet-macros.h b/unmerged/debian/tmp/usr/include/libnet/libnet-macros.h new file mode 100644 index 0000000..c4695f3 --- /dev/null +++ b/unmerged/debian/tmp/usr/include/libnet/libnet-macros.h @@ -0,0 +1,204 @@ +/* + * $Id: libnet-macros.h,v 1.7 2004/04/13 17:32:28 mike Exp $ + * + * libnet-macros.h - Network routine library macro header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_MACROS_H +#define __LIBNET_MACROS_H +/** + * @file libnet-macros.h + * @brief libnet macros and symbolic constants + */ + +/* for systems without snprintf */ +#if defined(NO_SNPRINTF) +#define snprintf(buf, len, args...) sprintf(buf, ##args) +#endif + + +/** + * Used for libnet's name resolution functions, specifies that no DNS lookups + * should be performed and the IP address should be kept in numeric form. + */ +#define LIBNET_DONT_RESOLVE 0 + +/** + * Used for libnet's name resolution functions, specifies that a DNS lookup + * can be performed if needed to resolve the IP address to a canonical form. + */ +#define LIBNET_RESOLVE 1 + +/** + * Used several places, to specify "on" or "one" + */ +#define LIBNET_ON 0 + +/** + * Used several places, to specify "on" or "one" + */ +#define LIBNET_OFF 1 + +/** + * IPv6 error code + */ +#ifndef IN6ADDR_ERROR_INIT +#define IN6ADDR_ERROR_INIT { { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff } } } +#endif + +/** + * Used for libnet_get_prand() to specify function disposition + */ +#define LIBNET_PR2 0 +#define LIBNET_PR8 1 +#define LIBNET_PR16 2 +#define LIBNET_PRu16 3 +#define LIBNET_PR32 4 +#define LIBNET_PRu32 5 +#define LIBNET_PRAND_MAX 0xffffffff + +/** + * The biggest an IP packet can be -- 65,535 bytes. + */ +#define LIBNET_MAX_PACKET 0xffff +#ifndef IP_MAXPACKET +#define IP_MAXPACKET 0xffff +#endif + + +/* ethernet addresses are 6 octets long */ +#ifndef ETHER_ADDR_LEN +#define ETHER_ADDR_LEN 0x6 +#endif + +/* FDDI addresses are 6 octets long */ +#ifndef FDDI_ADDR_LEN +#define FDDI_ADDR_LEN 0x6 +#endif + +/* token ring addresses are 6 octets long */ +#ifndef TOKEN_RING_ADDR_LEN +#define TOKEN_RING_ADDR_LEN 0x6 +#endif + +/* LLC Organization Code is 3 bytes long */ +#define LIBNET_ORG_CODE_SIZE 0x3 + +/** + * The libnet error buffer is 256 bytes long. + */ +#define LIBNET_ERRBUF_SIZE 0x100 + +/** + * IP and TCP options can be up to 40 bytes long. + */ +#define LIBNET_MAXOPTION_SIZE 0x28 + +/* some BSD variants have this endianess problem */ +#if (LIBNET_BSD_BYTE_SWAP) +#define FIX(n) ntohs(n) +#define UNFIX(n) htons(n) +#else +#define FIX(n) (n) +#define UNFIX(n) (n) +#endif + +/* used internally for packet builders */ +#define LIBNET_DO_PAYLOAD(l, p) \ +if ((payload && !payload_s) || (!payload && payload_s)) \ +{ \ + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, \ + "%s(): payload inconsistency\n", __func__); \ + goto bad; \ +} \ +if (payload && payload_s) \ +{ \ + n = libnet_pblock_append(l, p, payload, payload_s); \ + if (n == (u_int32_t) - 1) \ + { \ + goto bad; \ + } \ +} \ + + +/* used internally for checksum stuff */ +#define LIBNET_CKSUM_CARRY(x) \ + (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff)) + +/* used interally for OSPF stuff */ +#define LIBNET_OSPF_AUTHCPY(x, y) \ + memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y)) +#define LIBNET_OSPF_CKSUMBUF(x, y) \ + memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y)) + +/* used internally for NTP leap indicator, version, and mode */ +#define LIBNET_NTP_DO_LI_VN_MODE(li, vn, md) \ + ((u_int8_t)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7))) + +/* Not all systems have IFF_LOOPBACK */ +#ifdef IFF_LOOPBACK +#define LIBNET_ISLOOPBACK(p) ((p)->ifr_flags & IFF_LOOPBACK) +#else +#define LIBNET_ISLOOPBACK(p) (strcmp((p)->ifr_name, "lo0") == 0) +#endif + +/* advanced mode check */ +#define LIBNET_ISADVMODE(x) (x & 0x08) + +/* context queue macros and constants */ +#define LIBNET_LABEL_SIZE 64 +#define LIBNET_LABEL_DEFAULT "cardshark" +#define CQ_LOCK_UNLOCKED (u_int)0x00000000 +#define CQ_LOCK_READ (u_int)0x00000001 +#define CQ_LOCK_WRITE (u_int)0x00000002 + +/** + * Provides an interface to iterate through the context queue of libnet + * contexts. Before calling this macro, be sure to set the queue using + * libnet_cq_head(). + */ +#define for_each_context_in_cq(l) \ + for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next()) + +/* return 1 if write lock is set on cq */ +#define cq_is_wlocked() (l_cqd.cq_lock & CQ_LOCK_WRITE) + +/* return 1 if read lock is set on cq */ +#define cq_is_rlocked() (l_cqd.cq_lock & CQ_LOCK_READ) + +/* return 1 if any lock is set on cq */ +#define cq_is_locked() (l_cqd.cq_lock & (CQ_LOCK_READ | CQ_LOCK_WRITE)) + +/* check if a context queue is locked */ +#define check_cq_lock(x) (l_cqd.cq_lock & x) + +#endif /* __LIBNET_MACROS_H */ + +/* EOF */ diff --git a/unmerged/debian/tmp/usr/include/libnet/libnet-structures.h b/unmerged/debian/tmp/usr/include/libnet/libnet-structures.h new file mode 100644 index 0000000..477190e --- /dev/null +++ b/unmerged/debian/tmp/usr/include/libnet/libnet-structures.h @@ -0,0 +1,234 @@ +/* + * $Id: libnet-structures.h,v 1.19 2004/11/09 07:05:07 mike Exp $ + * + * libnet-structures.h - Network routine library structures header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_STRUCTURES_H +#define __LIBNET_STRUCTURES_H + +#if ((__WIN32__) && !(__CYGWIN__)) +#include "Packet32.h" +#endif + +/* port list chain structure */ +typedef struct libnet_port_list_chain libnet_plist_t; +struct libnet_port_list_chain +{ + u_int16_t node; /* node number */ + u_int16_t bport; /* beggining port */ + u_int16_t eport; /* terminating port */ + u_int8_t id; /* global array offset */ + libnet_plist_t *next; /* next node in the list */ +}; + + +/* libnet statistics structure */ +struct libnet_stats +{ +#if (!defined(__WIN32__) || (__CYGWIN__)) + u_int64_t packets_sent; /* packets sent */ + u_int64_t packet_errors; /* packets errors */ + u_int64_t bytes_written; /* bytes written */ +#else + __int64 packets_sent; /* packets sent */ + __int64 packet_errors; /* packets errors */ + __int64 bytes_written; /* bytes written */ +#endif +}; + + +/* + * Libnet ptags are how we identify specific protocol blocks inside the + * list. + */ +typedef int32_t libnet_ptag_t; +#define LIBNET_PTAG_INITIALIZER 0 + + +/* + * Libnet generic protocol block memory object. Sort of a poor man's mbuf. + */ +struct libnet_protocol_block +{ + u_int8_t *buf; /* protocol buffer */ + u_int32_t b_len; /* length of buf */ + u_int16_t h_len; /* header length (for checksumming) */ + /* Unused for IPV4_H block types. + * For protocols that sit on top of IP, it should be the the amount of + * buf that is the header, and will be included in the checksum. + */ + u_int32_t ip_offset; /* offset from end of pkt to beginning of IP header for csums */ + /* Unused for IPV4_H block types. + * For protocols that sit on top of IP (UDP, ICMP, ...), they often + * include some information from the IP header (in the form of a "pseudo + * header") in their own checksum calculation. To build that + * pseudo-header, thet need to find the real header. + */ + u_int32_t copied; /* bytes copied - the amount of data copied into buf */ + /* Used and updated by libnet_pblock_append(). */ + u_int8_t type; /* type of pblock */ +/* this needs to be updated every time a new packet builder is added */ +#define LIBNET_PBLOCK_ARP_H 0x01 /* ARP header */ +#define LIBNET_PBLOCK_DHCPV4_H 0x02 /* DHCP v4 header */ +#define LIBNET_PBLOCK_DNSV4_H 0x03 /* DNS v4 header */ +#define LIBNET_PBLOCK_ETH_H 0x04 /* Ethernet header */ +#define LIBNET_PBLOCK_ICMPV4_H 0x05 /* ICMP v4 base header */ +#define LIBNET_PBLOCK_ICMPV4_ECHO_H 0x06 /* ICMP v4 echo header */ +#define LIBNET_PBLOCK_ICMPV4_MASK_H 0x07 /* ICMP v4 mask header */ +#define LIBNET_PBLOCK_ICMPV4_UNREACH_H 0x08 /* ICMP v4 unreach header */ +#define LIBNET_PBLOCK_ICMPV4_TIMXCEED_H 0x09 /* ICMP v4 exceed header */ +#define LIBNET_PBLOCK_ICMPV4_REDIRECT_H 0x0a /* ICMP v4 redirect header */ +#define LIBNET_PBLOCK_ICMPV4_TS_H 0x0b /* ICMP v4 timestamp header */ +#define LIBNET_PBLOCK_IGMP_H 0x0c /* IGMP header */ +#define LIBNET_PBLOCK_IPV4_H 0x0d /* IP v4 header */ +#define LIBNET_PBLOCK_IPO_H 0x0e /* IP v4 options */ +#define LIBNET_PBLOCK_IPDATA 0x0f /* IP data */ +#define LIBNET_PBLOCK_OSPF_H 0x10 /* OSPF base header */ +#define LIBNET_PBLOCK_OSPF_HELLO_H 0x11 /* OSPF hello header */ +#define LIBNET_PBLOCK_OSPF_DBD_H 0x12 /* OSPF dbd header */ +#define LIBNET_PBLOCK_OSPF_LSR_H 0x13 /* OSPF lsr header */ +#define LIBNET_PBLOCK_OSPF_LSU_H 0x14 /* OSPF lsu header */ +#define LIBNET_PBLOCK_OSPF_LSA_H 0x15 /* OSPF lsa header */ +#define LIBNET_PBLOCK_OSPF_AUTH_H 0x16 /* OSPF auth header */ +#define LIBNET_PBLOCK_OSPF_CKSUM 0x17 /* OSPF checksum header */ +#define LIBNET_PBLOCK_LS_RTR_H 0x18 /* linkstate rtr header */ +#define LIBNET_PBLOCK_LS_NET_H 0x19 /* linkstate net header */ +#define LIBNET_PBLOCK_LS_SUM_H 0x1a /* linkstate as sum header */ +#define LIBNET_PBLOCK_LS_AS_EXT_H 0x1b /* linkstate as ext header */ +#define LIBNET_PBLOCK_NTP_H 0x1c /* NTP header */ +#define LIBNET_PBLOCK_RIP_H 0x1d /* RIP header */ +#define LIBNET_PBLOCK_TCP_H 0x1e /* TCP header */ +#define LIBNET_PBLOCK_TCPO_H 0x1f /* TCP options */ +#define LIBNET_PBLOCK_TCPDATA 0x20 /* TCP data */ +#define LIBNET_PBLOCK_UDP_H 0x21 /* UDP header */ +#define LIBNET_PBLOCK_VRRP_H 0x22 /* VRRP header */ +#define LIBNET_PBLOCK_DATA_H 0x23 /* generic data */ +#define LIBNET_PBLOCK_CDP_H 0x24 /* CDP header */ +#define LIBNET_PBLOCK_IPSEC_ESP_HDR_H 0x25 /* IPSEC ESP header */ +#define LIBNET_PBLOCK_IPSEC_ESP_FTR_H 0x26 /* IPSEC ESP footer */ +#define LIBNET_PBLOCK_IPSEC_AH_H 0x27 /* IPSEC AH header */ +#define LIBNET_PBLOCK_802_1Q_H 0x28 /* 802.1q header */ +#define LIBNET_PBLOCK_802_2_H 0x29 /* 802.2 header */ +#define LIBNET_PBLOCK_802_2SNAP_H 0x2a /* 802.2 SNAP header */ +#define LIBNET_PBLOCK_802_3_H 0x2b /* 802.3 header */ +#define LIBNET_PBLOCK_STP_CONF_H 0x2c /* STP configuration header */ +#define LIBNET_PBLOCK_STP_TCN_H 0x2d /* STP TCN header */ +#define LIBNET_PBLOCK_ISL_H 0x2e /* ISL header */ +#define LIBNET_PBLOCK_IPV6_H 0x2f /* IP v6 header */ +#define LIBNET_PBLOCK_802_1X_H 0x30 /* 802.1x header */ +#define LIBNET_PBLOCK_RPC_CALL_H 0x31 /* RPC Call header */ +#define LIBNET_PBLOCK_MPLS_H 0x32 /* MPLS header */ +#define LIBNET_PBLOCK_FDDI_H 0x33 /* FDDI header */ +#define LIBNET_PBLOCK_TOKEN_RING_H 0x34 /* TOKEN RING header */ +#define LIBNET_PBLOCK_BGP4_HEADER_H 0x35 /* BGP4 header */ +#define LIBNET_PBLOCK_BGP4_OPEN_H 0x36 /* BGP4 open header */ +#define LIBNET_PBLOCK_BGP4_UPDATE_H 0x37 /* BGP4 update header */ +#define LIBNET_PBLOCK_BGP4_NOTIFICATION_H 0x38 /* BGP4 notification header */ +#define LIBNET_PBLOCK_GRE_H 0x39 /* GRE header */ +#define LIBNET_PBLOCK_GRE_SRE_H 0x3a /* GRE SRE header */ +#define LIBNET_PBLOCK_IPV6_FRAG_H 0x3b /* IPv6 frag header */ +#define LIBNET_PBLOCK_IPV6_ROUTING_H 0x3c /* IPv6 routing header */ +#define LIBNET_PBLOCK_IPV6_DESTOPTS_H 0x3d /* IPv6 dest opts header */ +#define LIBNET_PBLOCK_IPV6_HBHOPTS_H 0x3e /* IPv6 hop/hop opts header */ +#define LIBNET_PBLOCK_SEBEK_H 0x3f /* Sebek header */ +#define LIBNET_PBLOCK_HSRP_H 0x40 /* HSRP header */ + u_int8_t flags; /* control flags */ +#define LIBNET_PBLOCK_DO_CHECKSUM 0x01 /* needs a checksum */ + libnet_ptag_t ptag; /* protocol block tag */ + struct libnet_protocol_block *next; /* next pblock */ + struct libnet_protocol_block *prev; /* prev pblock */ +}; +typedef struct libnet_protocol_block libnet_pblock_t; + + +/* + * Libnet context + * Opaque structure. Nothing in here should ever been touched first hand by + * the applications programmer. + */ +struct libnet_context +{ +#if ((__WIN32__) && !(__CYGWIN__)) + SOCKET fd; + LPADAPTER lpAdapter; +#else + int fd; /* file descriptor of packet device */ +#endif + int injection_type; /* raw (ipv4 or ipv6) or link */ +#define LIBNET_LINK 0x00 /* link-layer interface */ +#define LIBNET_RAW4 0x01 /* raw socket interface (ipv4) */ +#define LIBNET_RAW6 0x02 /* raw socket interface (ipv6) */ +/* the following should actually set a flag in the flags variable above */ +#define LIBNET_LINK_ADV 0x08 /* advanced mode link-layer */ +#define LIBNET_RAW4_ADV 0x09 /* advanced mode raw socket (ipv4) */ +#define LIBNET_RAW6_ADV 0x0a /* advanced mode raw socket (ipv6) */ +#define LIBNET_ADV_MASK 0x08 /* mask to determine adv mode */ + + libnet_pblock_t *protocol_blocks; /* protocol headers / data */ + libnet_pblock_t *pblock_end; /* last node in list */ + u_int32_t n_pblocks; /* number of pblocks */ + + int link_type; /* link-layer type */ + int link_offset; /* link-layer header size */ + int aligner; /* used to align packets */ + char *device; /* device name */ + + struct libnet_stats stats; /* statistics */ + libnet_ptag_t ptag_state; /* state holder for pblock tag */ + char label[LIBNET_LABEL_SIZE]; /* textual label for cq interface */ + + char err_buf[LIBNET_ERRBUF_SIZE]; /* error buffer */ + u_int32_t total_size; /* total size */ +}; +typedef struct libnet_context libnet_t; + +/* + * Libnet context queue structure + * Opaque structure. Nothing in here should ever been touched first hand by + * the applications programmer. + */ +typedef struct _libnet_context_queue libnet_cq_t; +struct _libnet_context_queue +{ + libnet_t *context; /* pointer to libnet context */ + libnet_cq_t *next; /* next node in the list */ + libnet_cq_t *prev; /* previous node in the list */ +}; + +struct _libnet_context_queue_descriptor +{ + u_int32_t node; /* number of nodes in the list */ + u_int32_t cq_lock; /* lock status */ + libnet_cq_t *current; /* current context */ +}; +typedef struct _libnet_context_queue_descriptor libnet_cqd_t; + +#endif /* __LIBNET_STRUCTURES_H */ + +/* EOF */ diff --git a/unmerged/debian/tmp/usr/include/libnet/libnet-types.h b/unmerged/debian/tmp/usr/include/libnet/libnet-types.h new file mode 100644 index 0000000..cc5897e --- /dev/null +++ b/unmerged/debian/tmp/usr/include/libnet/libnet-types.h @@ -0,0 +1,48 @@ +/* + * $Id: libnet-types.h,v 1.3 2004/01/03 20:31:00 mike Exp $ + * + * libnet-types.h - Network routine library macro header file + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef __LIBNET_TYPES_H +#define __LIBNET_TYPES_H + +#if (__sun__ && __svr4__) +/* libnet should be using the standard type names, but in the short term + * define our non-standard type names in terms of the standard names. + */ +#include <inttypes.h> +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; +#endif + +#endif /* __LIBNET_TYPES_H */ + +/* EOF */ diff --git a/unmerged/debian/tmp/usr/lib/libnet.so b/unmerged/debian/tmp/usr/lib/libnet.so new file mode 120000 index 0000000..501e384 --- /dev/null +++ b/unmerged/debian/tmp/usr/lib/libnet.so @@ -0,0 +1 @@ +libnet.so.1.5.0
\ No newline at end of file diff --git a/unmerged/debian/tmp/usr/lib/libnet.so.1 b/unmerged/debian/tmp/usr/lib/libnet.so.1 new file mode 120000 index 0000000..501e384 --- /dev/null +++ b/unmerged/debian/tmp/usr/lib/libnet.so.1 @@ -0,0 +1 @@ +libnet.so.1.5.0
\ No newline at end of file diff --git a/unmerged/debian/tmp/usr/lib/libnet.so.1.5.0 b/unmerged/debian/tmp/usr/lib/libnet.so.1.5.0 Binary files differnew file mode 100755 index 0000000..385290d --- /dev/null +++ b/unmerged/debian/tmp/usr/lib/libnet.so.1.5.0 diff --git a/unmerged/debian/tmp/usr/share/man/man3/libnet-functions.h.3 b/unmerged/debian/tmp/usr/share/man/man3/libnet-functions.h.3 new file mode 100644 index 0000000..3ba2c49 --- /dev/null +++ b/unmerged/debian/tmp/usr/share/man/man3/libnet-functions.h.3 @@ -0,0 +1,3363 @@ +.TH "libnet-functions.h" 3 "9 Jun 2009" "Version 1.1.4" "libnet" \" -*- nroff -*- +.ad l +.nh +.SH NAME +libnet-functions.h \- libnet exported function prototypes +.SH SYNOPSIS +.br +.PP +.SS "Functions" + +.in +1c +.ti -1c +.RI "libnet_t * \fBlibnet_init\fP (int injection_type, char *device, char *err_buf)" +.br +.ti -1c +.RI "void \fBlibnet_destroy\fP (libnet_t *l)" +.br +.ti -1c +.RI "void \fBlibnet_clear_packet\fP (libnet_t *l)" +.br +.ti -1c +.RI "void \fBlibnet_stats\fP (libnet_t *l, struct libnet_stats *ls)" +.br +.ti -1c +.RI "int \fBlibnet_getfd\fP (libnet_t *l)" +.br +.ti -1c +.RI "const char * \fBlibnet_getdevice\fP (libnet_t *l)" +.br +.ti -1c +.RI "u_int8_t * \fBlibnet_getpbuf\fP (libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_getpbuf_size\fP (libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "char * \fBlibnet_geterror\fP (libnet_t *l)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_getpacket_size\fP (libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_seed_prand\fP (libnet_t *l)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_get_prand\fP (int mod)" +.br +.ti -1c +.RI "int \fBlibnet_toggle_checksum\fP (libnet_t *l, libnet_ptag_t ptag, int mode)" +.br +.ti -1c +.RI "char * \fBlibnet_addr2name4\fP (u_int32_t in, u_int8_t use_name)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_name2addr4\fP (libnet_t *l, char *host_name, u_int8_t use_name)" +.br +.ti -1c +.RI "struct libnet_in6_addr \fBlibnet_name2addr6\fP (libnet_t *l, char *host_name, u_int8_t use_name)" +.br +.ti -1c +.RI "void \fBlibnet_addr2name6_r\fP (struct libnet_in6_addr addr, u_int8_t use_name, char *host_name, int host_name_len)" +.br +.ti -1c +.RI "int \fBlibnet_plist_chain_new\fP (libnet_t *l, libnet_plist_t **plist, char *token_list)" +.br +.ti -1c +.RI "int \fBlibnet_plist_chain_next_pair\fP (libnet_plist_t *plist, u_int16_t *bport, u_int16_t *eport)" +.br +.ti -1c +.RI "int \fBlibnet_plist_chain_dump\fP (libnet_plist_t *plist)" +.br +.ti -1c +.RI "char * \fBlibnet_plist_chain_dump_string\fP (libnet_plist_t *plist)" +.br +.ti -1c +.RI "int \fBlibnet_plist_chain_free\fP (libnet_plist_t *plist)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_802_1q\fP (u_int8_t *dst, u_int8_t *src, u_int16_t tpi, u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_802_1x\fP (u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_802_2\fP (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_802_2snap\fP (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_802_3\fP (u_int8_t *dst, u_int8_t *src, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ethernet\fP (u_int8_t *dst, u_int8_t *src, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_autobuild_ethernet\fP (u_int8_t *dst, u_int16_t type, libnet_t *l)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_fddi\fP (u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_autobuild_fddi\fP (u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, libnet_t *l)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_arp\fP (u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_autobuild_arp\fP (u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, libnet_t *l)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_tcp\fP (u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_tcp_options\fP (u_int8_t *options, u_int32_t options_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_udp\fP (u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_cdp\fP (u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_icmpv4_echo\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_icmpv4_mask\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_icmpv4_unreach\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_icmpv4_redirect\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t gateway, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_icmpv4_timeexceed\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_icmpv4_timestamp\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_igmp\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipv4\fP (u_int16_t ip_len, u_int8_t tos, u_int16_t id, u_int16_t frag, u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipv4_options\fP (u_int8_t *options, u_int32_t options_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_autobuild_ipv4\fP (u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t *l)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipv6\fP (u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipv6_frag\fP (u_int8_t nh, u_int8_t reserved, u_int16_t frag, u_int32_t id, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipv6_routing\fP (u_int8_t nh, u_int8_t len, u_int8_t rtype, u_int8_t segments, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipv6_destopts\fP (u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipv6_hbhopts\fP (u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_autobuild_ipv6\fP (u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_isl\fP (u_int8_t *dhost, u_int8_t type, u_int8_t user, u_int8_t *shost, u_int16_t len, u_int8_t *snap, u_int16_t vid, u_int16_t portindex, u_int16_t reserved, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipsec_esp_hdr\fP (u_int32_t spi, u_int32_t seq, u_int32_t iv, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipsec_esp_ftr\fP (u_int8_t len, u_int8_t nh, int8_t *auth, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ipsec_ah\fP (u_int8_t nh, u_int8_t len, u_int16_t res, u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_dnsv4\fP (u_int16_t h_len, u_int16_t id, u_int16_t flags, u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, u_int16_t num_addi_rr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_rip\fP (u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, u_int32_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_rpc_call\fP (u_int32_t rm, u_int32_t xid, u_int32_t prog_num, u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_stp_conf\fP (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id, u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_stp_tcn\fP (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_token_ring\fP (u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_autobuild_token_ring\fP (u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *oui, u_int16_t type, libnet_t *l)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_vrrp\fP (u_int8_t version, u_int8_t type, u_int8_t vrouter_id, u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_mpls\fP (u_int32_t label, u_int8_t experimental, u_int8_t bos, u_int8_t ttl, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ntp\fP (u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2\fP (u_int16_t len, u_int8_t type, u_int32_t rtr_id, u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_hello\fP (u_int32_t netmask, u_int16_t interval, u_int8_t opts, u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_dbd\fP (u_int16_t dgram_len, u_int8_t opts, u_int8_t type, u_int seqnum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsr\fP (u_int type, u_int lsid, u_int32_t advrtr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsu\fP (u_int num, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa\fP (u_int16_t age, u_int8_t opts, u_int8_t type, u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_rtr\fP (u_int16_t flags, u_int16_t num, u_int id, u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_net\fP (u_int32_t nmask, u_int rtrid, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_sum\fP (u_int32_t nmask, u_int metric, u_int tos, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_as\fP (u_int32_t nmask, u_int metric, u_int32_t fwdaddr, u_int tag, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_data\fP (u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_dhcpv4\fP (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_bootpv4\fP (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_getgre_length\fP (u_int16_t fv)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_gre\fP (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_egre\fP (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_gre_sre\fP (u_int16_t af, u_int8_t offset, u_int8_t length, u_int8_t *routing, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_gre_last_sre\fP (libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_bgp4_header\fP (u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_bgp4_open\fP (u_int8_t version, u_int16_t src_as, u_int16_t hold_time, u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_bgp4_update\fP (u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt, u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len, u_int8_t *reachability_info, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_bgp4_notification\fP (u_int8_t err_code, u_int8_t err_subcode, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_sebek\fP (u_int32_t magic, u_int16_t version, u_int16_t type, u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_hsrp\fP (u_int8_t version, u_int8_t opcode, u_int8_t state, u_int8_t hello_time, u_int8_t hold_time, u_int8_t priority, u_int8_t group, u_int8_t reserved, u_int8_t authdata[HSRP_AUTHDATA_LENGTH], u_int32_t virtual_ip, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_build_link\fP (u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_autobuild_link\fP (u_int8_t *dst, u_int8_t *oui, u_int16_t type, libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_write\fP (libnet_t *l)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_get_ipaddr4\fP (libnet_t *l)" +.br +.ti -1c +.RI "struct libnet_in6_addr \fBlibnet_get_ipaddr6\fP (libnet_t *l)" +.br +.ti -1c +.RI "struct libnet_ether_addr * \fBlibnet_get_hwaddr\fP (libnet_t *l)" +.br +.ti -1c +.RI "u_int8_t * \fBlibnet_hex_aton\fP (const char *s, int *len)" +.br +.ti -1c +.RI "const char * \fBlibnet_version\fP (void)" +.br +.ti -1c +.RI "int \fBlibnet_adv_cull_packet\fP (libnet_t *l, u_int8_t **packet, u_int32_t *packet_s)" +.br +.ti -1c +.RI "int \fBlibnet_adv_cull_header\fP (libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, u_int32_t *header_s)" +.br +.ti -1c +.RI "int \fBlibnet_adv_write_link\fP (libnet_t *l, u_int8_t *packet, u_int32_t packet_s)" +.br +.ti -1c +.RI "int \fBlibnet_adv_write_raw_ipv4\fP (libnet_t *l, u_int8_t *packet, u_int32_t packet_s)" +.br +.ti -1c +.RI "void \fBlibnet_adv_free_packet\fP (libnet_t *l, u_int8_t *packet)" +.br +.ti -1c +.RI "int \fBlibnet_cq_add\fP (libnet_t *l, char *label)" +.br +.ti -1c +.RI "libnet_t * \fBlibnet_cq_remove\fP (libnet_t *l)" +.br +.ti -1c +.RI "libnet_t * \fBlibnet_cq_remove_by_label\fP (char *label)" +.br +.ti -1c +.RI "const char * \fBlibnet_cq_getlabel\fP (libnet_t *l)" +.br +.ti -1c +.RI "libnet_t * \fBlibnet_cq_find_by_label\fP (char *label)" +.br +.ti -1c +.RI "void \fBlibnet_cq_destroy\fP (void)" +.br +.ti -1c +.RI "libnet_t * \fBlibnet_cq_head\fP (void)" +.br +.ti -1c +.RI "int \fBlibnet_cq_last\fP (void)" +.br +.ti -1c +.RI "libnet_t * \fBlibnet_cq_next\fP (void)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_cq_size\fP (void)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_cq_end_loop\fP (void)" +.br +.ti -1c +.RI "void \fBlibnet_diag_dump_context\fP (libnet_t *l)" +.br +.ti -1c +.RI "void \fBlibnet_diag_dump_pblock\fP (libnet_t *l)" +.br +.ti -1c +.RI "char * \fBlibnet_diag_dump_pblock_type\fP (u_int8_t type)" +.br +.ti -1c +.RI "void \fBlibnet_diag_dump_hex\fP (u_int8_t *packet, u_int32_t len, int swap, FILE *stream)" +.br +.ti -1c +.RI "int \fBlibnet_write_raw_ipv4\fP (libnet_t *l, u_int8_t *packet, u_int32_t size)" +.br +.ti -1c +.RI "int \fBlibnet_write_raw_ipv6\fP (libnet_t *l, u_int8_t *packet, u_int32_t size)" +.br +.ti -1c +.RI "int \fBlibnet_write_link\fP (libnet_t *l, u_int8_t *packet, u_int32_t size)" +.br +.ti -1c +.RI "int \fBlibnet_open_raw4\fP (libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_close_raw4\fP (libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_open_raw6\fP (libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_close_raw6\fP (libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_select_device\fP (libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_open_link\fP (libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_close_link\fP (libnet_t *l)" +.br +.ti -1c +.RI "int \fBlibnet_do_checksum\fP (libnet_t *l, u_int8_t *packet, int protocol, int len)" +.br +.ti -1c +.RI "u_int32_t \fBlibnet_compute_crc\fP (u_int8_t *buf, u_int32_t len)" +.br +.ti -1c +.RI "u_int16_t \fBlibnet_ip_check\fP (u_int16_t *addr, int len)" +.br +.ti -1c +.RI "int \fBlibnet_in_cksum\fP (u_int16_t *addr, int len)" +.br +.ti -1c +.RI "libnet_pblock_t * \fBlibnet_pblock_probe\fP (libnet_t *l, libnet_ptag_t ptag, u_int32_t n, u_int8_t type)" +.br +.ti -1c +.RI "libnet_pblock_t * \fBlibnet_pblock_new\fP (libnet_t *l, u_int32_t size)" +.br +.ti -1c +.RI "int \fBlibnet_pblock_swap\fP (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)" +.br +.ti -1c +.RI "int \fBlibnet_pblock_insert_before\fP (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)" +.br +.ti -1c +.RI "void \fBlibnet_pblock_delete\fP (libnet_t *l, libnet_pblock_t *p)" +.br +.ti -1c +.RI "libnet_ptag_t \fBlibnet_pblock_update\fP (libnet_t *l, libnet_pblock_t *p, u_int32_t h, u_int8_t type)" +.br +.ti -1c +.RI "void \fBlibnet_pblock_record_ip_offset\fP (libnet_t *l, libnet_pblock_t *p)" +.br +.ti -1c +.RI "libnet_pblock_t * \fBlibnet_pblock_find\fP (libnet_t *l, libnet_ptag_t ptag)" +.br +.ti -1c +.RI "int \fBlibnet_pblock_append\fP (libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, u_int32_t len)" +.br +.ti -1c +.RI "void \fBlibnet_pblock_setflags\fP (libnet_pblock_t *p, u_int8_t flags)" +.br +.ti -1c +.RI "int \fBlibnet_pblock_p2p\fP (u_int8_t type)" +.br +.ti -1c +.RI "int \fBlibnet_pblock_coalesce\fP (libnet_t *l, u_int8_t **packet, u_int32_t *size)" +.br +.ti -1c +.RI "int \fBlibnet_check_iface\fP (libnet_t *l)" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "struct libnet_in6_addr \fBin6addr_error\fP" +.br +.in -1c +.SH "Detailed Description" +.PP +libnet exported function prototypes + + +.SH "Function Documentation" +.PP +.SS "char* libnet_addr2name4 (u_int32_t in, u_int8_t use_name)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIin\fP network byte ordered IPv4 address +.br +\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE +.RE +.PP +\fBReturns:\fP +.RS 4 +a pointer to presentation format string +.RE +.PP + +.SS "void libnet_addr2name6_r (struct libnet_in6_addr addr, u_int8_t use_name, char * host_name, int host_name_len)" +.PP +Should document this baby right here. +.SS "int libnet_adv_cull_header (libnet_t * l, libnet_ptag_t ptag, u_int8_t ** header, u_int32_t * header_s)" +.PP +[Advanced Interface] Pulls the header from the specified ptag from the given libnet context. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIptag\fP the ptag referencing the header to pull +.br +\fIheader\fP will contain the header +.br +\fIheader_s\fP will contain the header size +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "int libnet_adv_cull_packet (libnet_t * l, u_int8_t ** packet, u_int32_t * packet_s)" +.PP +[Advanced Interface] Yanks a prebuilt, wire-ready packet from the given libnet context. If libnet was configured to do so (which it is by default) the packet will have all checksums written in. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. It is important to note that the function performs an implicit malloc() and a corresponding call to \fBlibnet_adv_free_packet()\fP should be made to free the memory packet occupies. If the function fails \fBlibnet_geterror()\fP can tell you why. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIpacket\fP will contain the wire-ready packet +.br +\fIpacket_s\fP will contain the packet size +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "void libnet_adv_free_packet (libnet_t * l, u_int8_t * packet)" +.PP +[Advanced Interface] Frees the memory allocated when \fBlibnet_adv_cull_packet()\fP is called. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIpacket\fP a pointer to the packet to free +.RE +.PP + +.SS "int libnet_adv_write_link (libnet_t * l, u_int8_t * packet, u_int32_t packet_s)" +.PP +[Advanced Interface] Writes a packet the network at the link layer. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIpacket\fP a pointer to the packet to inject +.br +\fIpacket_s\fP the size of the packet +.RE +.PP +\fBReturns:\fP +.RS 4 +the number of bytes written, or -1 on failure +.RE +.PP + +.SS "int libnet_adv_write_raw_ipv4 (libnet_t * l, u_int8_t * packet, u_int32_t packet_s)" +.PP +[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 \fBlibnet_adv_cull_packet()\fP. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIpacket\fP a pointer to the packet to inject +.br +\fIpacket_s\fP the size of the packet +.RE +.PP +\fBReturns:\fP +.RS 4 +the number of bytes written, or -1 on failure +.RE +.PP + +.SS "libnet_ptag_t libnet_autobuild_arp (u_int16_t op, u_int8_t * sha, u_int8_t * spa, u_int8_t * tha, u_int8_t * tpa, libnet_t * l)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIop\fP ARP operation type +.br +\fIsha\fP sender's hardware address +.br +\fIspa\fP sender's protocol address +.br +\fItha\fP target hardware address +.br +\fItpa\fP targer protocol address +.br +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_autobuild_ethernet (u_int8_t * dst, u_int16_t type, libnet_t * l)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIdst\fP destination ethernet address +.br +\fItype\fP upper layer protocol type +.br +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_autobuild_fddi (u_int8_t fc, u_int8_t * dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * oui, u_int16_t type, libnet_t * l)" +.PP +Autobuilds a Fiber Distributed Data Interface (FDDI) header. +.PP +\fBParameters:\fP +.RS 4 +\fIfc\fP class format and priority +.br +\fIdst\fP destination fddi address +.br +\fIdsap\fP destination service access point +.br +\fIssap\fP source service access point +.br +\fIcf\fP cf +.br +\fIoui\fP IEEE organizational code +.br +\fItype\fP upper layer protocol +.br +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_autobuild_ipv4 (u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t * l)" +.PP +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 \fBlibnet_build_ipv4()\fP. The function does not accept a ptag argument, but it does return a ptag. In other words, you can use it to build a new IP header but not to modify an existing one. +.PP +\fBParameters:\fP +.RS 4 +\fIlen\fP total length of the IP packet including all subsequent data +.br +\fIprot\fP upper layer protocol +.br +\fIdst\fP destination IPv4 address (little endian) +.br +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_autobuild_ipv6 (u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, libnet_t * l, libnet_ptag_t ptag)" +.PP +This function is not yet implement and is a NOOP. +.PP +\fBParameters:\fP +.RS 4 +\fIlen\fP length +.br +\fInh\fP next header +.br +\fIdst\fP destination IPv6 address +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_autobuild_link (u_int8_t * dst, u_int8_t * oui, u_int16_t type, libnet_t * l)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIdst\fP the destination MAC address +.br +\fIoui\fP Organizationally Unique Identifier (unused for Ethernet) +.br +\fItype\fP the upper layer protocol type +.br +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_autobuild_token_ring (u_int8_t ac, u_int8_t fc, u_int8_t * dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * oui, u_int16_t type, libnet_t * l)" +.PP +Auto-builds a token ring header. +.PP +\fBParameters:\fP +.RS 4 +\fIac\fP access control +.br +\fIfc\fP frame control +.br +\fIdst\fP destination address +.br +\fIdsap\fP destination service access point +.br +\fIssap\fP source service access point +.br +\fIcf\fP control field +.br +\fIoui\fP Organizationally Unique Identifier +.br +\fItype\fP upper layer protocol type +.br +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_802_1q (u_int8_t * dst, u_int8_t * src, u_int16_t tpi, u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +.SH "Packet Builder Functions" +.PP +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. \fBlibnet_build_ntp()\fP 2. \fBlibnet_build_udp()\fP 3. \fBlibnet_build_ipv4()\fP 4. \fBlibnet_build_ethernet()\fP This ordering is essential for libnet 1.1.x to properly link together the packet internally (previous libnet versions did not have the requirement). +.SS "The Payload Interface" +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: +.IP "\(bu" 2 +Including additional or arbitrary protocol header information that is not available from a libnet interface +.IP "\(bu" 2 +Including a packet payload (data segment) +.IP "\(bu" 2 +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 u_int8_t * to this data and its size to the desired libnet_build() function. Libnet handles the rest. +.PP +.PP +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. +.SS "Protocol Tags and Packet Builder Return Values" +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; \fBlibnet_geterror()\fP 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. +.PP +\fBParameters:\fP +.RS 4 +\fIdst\fP pointer to a six byte source ethernet address +.br +\fIsrc\fP pointer to a six byte destination ethernet address +.br +\fItpi\fP tag protocol identifier +.br +\fIpriority\fP priority +.br +\fIcfi\fP canonical format indicator +.br +\fIvlan_id\fP vlan identifier +.br +\fIlen_proto\fP length (802.3) protocol (Ethernet II) +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_802_1x (u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an IEEE 802.1x extended authentication protocol header. +.PP +\fBParameters:\fP +.RS 4 +\fIeap_ver\fP the EAP version +.br +\fIeap_type\fP the EAP type +.br +\fIlength\fP frame length +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_802_2 (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an IEEE 802.2 LLC header. +.PP +\fBParameters:\fP +.RS 4 +\fIdsap\fP destination service access point +.br +\fIssap\fP source service access point +.br +\fIcontrol\fP control field +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_802_2snap (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t * oui, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an IEEE 802.2 LLC SNAP header. +.PP +\fBParameters:\fP +.RS 4 +\fIdsap\fP destination service access point +.br +\fIssap\fP source service access point +.br +\fIcontrol\fP control field +.br +\fIoui\fP Organizationally Unique Identifier +.br +\fItype\fP upper layer protocol +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_802_3 (u_int8_t * dst, u_int8_t * src, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIdst\fP destination ethernet address +.br +\fIsrc\fP source ethernet address +.br +\fIlen\fP frame length sans header +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_arp (u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, u_int16_t op, u_int8_t * sha, u_int8_t * spa, u_int8_t * tha, u_int8_t * tpa, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIhrd\fP hardware address format +.br +\fIpro\fP protocol address format +.br +\fIhln\fP hardware address length +.br +\fIpln\fP protocol address length +.br +\fIop\fP ARP operation type +.br +\fIsha\fP sender's hardware address +.br +\fIspa\fP sender's protocol address +.br +\fItha\fP target hardware address +.br +\fItpa\fP targer protocol address +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_bgp4_header (u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fImarker\fP 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) +.br +\fIlen\fP total length of the BGP message, including the header +.br +\fItype\fP type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE) +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_bgp4_notification (u_int8_t err_code, u_int8_t err_subcode, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIerr_code\fP type of notification +.br +\fIerr_subcode\fP more specific information about the reported error. +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_bgp4_open (u_int8_t version, u_int16_t src_as, u_int16_t hold_time, u_int32_t bgp_id, u_int8_t opt_len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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). +.PP +\fBParameters:\fP +.RS 4 +\fIversion\fP protocol version (should be set to 4) +.br +\fIsrc_as\fP Autonomous System of the sender +.br +\fIhold_time\fP used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender +.br +\fIbgp_id\fP BGP identifier of the sender +.br +\fIopt_len\fP total length of the optional parameters field in bytes +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_bgp4_update (u_int16_t unfeasible_rt_len, u_int8_t * withdrawn_rt, u_int16_t total_path_attr_len, u_int8_t * path_attributes, u_int16_t info_len, u_int8_t * reachability_info, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header. Update messages are used to transfer routing information between BGP peers. +.PP +\fBParameters:\fP +.RS 4 +\fIunfeasible_rt_len\fP indicates the length of the (next) 'withdrawn routes' field in bytes +.br +\fIwithdrawn_rt\fP 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)> +.br +\fItotal_path_attr_len\fP indicates the length of the (next) 'path attributes' field in bytes +.br +\fIpath_attributes\fP each attribute is a 3-tuple <type (2 bytes), length, value> +.br +\fIinfo_len\fP indicates the length of the (next) 'network layer reachability information' field in bytes (needed for internal memory size calculation) +.br +\fIreachability_info\fP 2-tuples <length (1 byte), prefix (variable)>. +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_bootpv4 (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t * chaddr, u_int8_t * sname, u_int8_t * file, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fIopcode\fP +.br +\fIhtype\fP +.br +\fIhlen\fP +.br +\fIhopcount\fP +.br +\fIxid\fP +.br +\fIsecs\fP +.br +\fIflags\fP +.br +\fIcip\fP +.br +\fIyip\fP +.br +\fIsip\fP +.br +\fIgip\fP +.br +\fIchaddr\fP +.br +\fIsname\fP +.br +\fIfile\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_cdp (u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, u_int16_t len, u_int8_t * value, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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 \fBlibnet_build_data()\fP to construct them. +.PP +\fBParameters:\fP +.RS 4 +\fIversion\fP CDP version +.br +\fIttl\fP time to live (time information should be cached by recipient) +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fItype\fP type of data contained in value +.br +\fIlen\fP length of value arugment +.br +\fIvalue\fP the CDP information string +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_data (u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_dhcpv4 (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t * chaddr, u_int8_t * sname, u_int8_t * file, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fIopcode\fP +.br +\fIhtype\fP +.br +\fIhlen\fP +.br +\fIhopcount\fP +.br +\fIxid\fP +.br +\fIsecs\fP +.br +\fIflags\fP +.br +\fIcip\fP +.br +\fIyip\fP +.br +\fIsip\fP +.br +\fIgip\fP +.br +\fIchaddr\fP +.br +\fIsname\fP +.br +\fIfile\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_dnsv4 (u_int16_t h_len, u_int16_t id, u_int16_t flags, u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, u_int16_t num_addi_rr, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an RFC 1035 version 4 DNS header. Additional DNS payload information should be specified using the payload interface. +.PP +\fBParameters:\fP +.RS 4 +\fIh_len\fP +.br +\fIid\fP DNS packet id +.br +\fIflags\fP control flags +.br +\fInum_q\fP number of questions +.br +\fInum_anws_rr\fP number of answer resource records +.br +\fInum_auth_rr\fP number of authority resource records +.br +\fInum_addi_rr\fP number of additional resource records +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_egre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIfv\fP 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. +.br +\fItype\fP which protocol is encapsulated (PPP, IP, ...) +.br +\fIsum\fP checksum (0 for libnet to autofill). +.br +\fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE +.br +\fIkey\fP inserted by the encapsulator to authenticate the source +.br +\fIseq\fP sequence number used by the receiver to sort the packets +.br +\fIlen\fP size of the GRE packet +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ethernet (u_int8_t * dst, u_int8_t * src, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIdst\fP destination ethernet address +.br +\fIsrc\fP source ethernet address +.br +\fItype\fP upper layer protocol type +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_fddi (u_int8_t fc, u_int8_t * dst, u_int8_t * src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * oui, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a Fiber Distributed Data Interface (FDDI) header. +.PP +\fBParameters:\fP +.RS 4 +\fIfc\fP class format and priority +.br +\fIdst\fP destination fddi address +.br +\fIsrc\fP source fddi address +.br +\fIdsap\fP destination service access point +.br +\fIssap\fP source service access point +.br +\fIcf\fP cf +.br +\fIoui\fP 3 byte IEEE organizational code +.br +\fItype\fP upper layer protocol +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_gre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIfv\fP 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. +.br +\fItype\fP which protocol is encapsulated (PPP, IP, ...) +.br +\fIsum\fP checksum (0 for libnet to autofill). +.br +\fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE +.br +\fIkey\fP inserted by the encapsulator to authenticate the source +.br +\fIseq\fP sequence number used by the receiver to sort the packets +.br +\fIlen\fP size of the GRE packet +.br +\fIpayload\fP +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_gre_last_sre (libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_gre_sre (u_int16_t af, u_int8_t offset, u_int8_t length, u_int8_t * routing, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fIaf\fP +.br +\fIoffset\fP +.br +\fIlength\fP +.br +\fIrouting\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_hsrp (u_int8_t version, u_int8_t opcode, u_int8_t state, u_int8_t hello_time, u_int8_t hold_time, u_int8_t priority, u_int8_t group, u_int8_t reserved, u_int8_t authdata[HSRP_AUTHDATA_LENGTH], u_int32_t virtual_ip, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a HSRP header. HSRP is a Cisco propietary protocol defined in RFC 2281 +.PP +\fBParameters:\fP +.RS 4 +\fIversion\fP version of the HSRP messages +.br +\fIopcode\fP type of message +.br +\fIstate\fP current state of the router +.br +\fIhello_time\fP period in seconds between hello messages +.br +\fIhold_time\fP seconds that the current hello message is valid +.br +\fIpriority\fP priority for the election proccess +.br +\fIgroup\fP standby group +.br +\fIreserved\fP reserved field +.br +\fIauthdata\fP password +.br +\fIvirtual_ip\fP virtual ip address +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_icmpv4_echo (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO) +.br +\fIcode\fP code of ICMP packet (should be 0) +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIid\fP identification number +.br +\fIseq\fP packet sequence number +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_icmpv4_mask (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) IP netmask request/reply header. +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY) +.br +\fIcode\fP code of ICMP packet (should be 0) +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIid\fP identification number +.br +\fIseq\fP packet sequence number +.br +\fImask\fP subnet mask +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_icmpv4_redirect (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t gateway, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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 \fBlibnet_build_ipv4()\fP. +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP type of ICMP packet (should be ICMP_REDIRECT) +.br +\fIcode\fP code of ICMP packet (should be one of the four redirect codes) +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIgateway\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_icmpv4_timeexceed (u_int8_t type, u_int8_t code, u_int16_t sum, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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 \fBlibnet_build_ipv4()\fP. +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP type of ICMP packet (should be ICMP_TIMXCEED) +.br +\fIcode\fP code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS) +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_icmpv4_timestamp (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header. +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY) +.br +\fIcode\fP code of ICMP packet (should be 0) +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIid\fP identification number +.br +\fIseq\fP sequence number +.br +\fIotime\fP originate timestamp +.br +\fIrtime\fP receive timestamp +.br +\fIttime\fP transmit timestamp +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_icmpv4_unreach (u_int8_t type, u_int8_t code, u_int16_t sum, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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 \fBlibnet_build_ipv4()\fP. +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP type of ICMP packet (should be ICMP_UNREACH) +.br +\fIcode\fP code of ICMP packet (should be one of the 16 unreachable codes) +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_igmp (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header. +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP packet type +.br +\fIcode\fP packet code (should be 0) +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIip\fP IPv4 address +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipsec_ah (u_int8_t nh, u_int8_t len, u_int16_t res, u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an Internet Protocol Security Authentication header. +.PP +\fBParameters:\fP +.RS 4 +\fInh\fP next header +.br +\fIlen\fP payload length +.br +\fIres\fP reserved +.br +\fIspi\fP security parameter index +.br +\fIseq\fP sequence number +.br +\fIauth\fP authentication data +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipsec_esp_ftr (u_int8_t len, u_int8_t nh, int8_t * auth, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an Internet Protocol Security Encapsulating Security Payload footer. +.PP +\fBParameters:\fP +.RS 4 +\fIlen\fP padding length +.br +\fInh\fP next header +.br +\fIauth\fP authentication data +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipsec_esp_hdr (u_int32_t spi, u_int32_t seq, u_int32_t iv, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an Internet Protocol Security Encapsulating Security Payload header. +.PP +\fBParameters:\fP +.RS 4 +\fIspi\fP security parameter index +.br +\fIseq\fP ESP sequence number +.br +\fIiv\fP initialization vector +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipv4 (u_int16_t ip_len, u_int8_t tos, u_int16_t id, u_int16_t frag, u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a version 4 RFC 791 Internet Protocol (IP) header. +.PP +\fBParameters:\fP +.RS 4 +\fIip_len\fP total length of the IP packet including all subsequent data (subsequent data includes any IP options and IP options padding) +.br +\fItos\fP type of service bits +.br +\fIid\fP IP identification number +.br +\fIfrag\fP fragmentation bits and offset +.br +\fIttl\fP time to live in the network +.br +\fIprot\fP upper layer protocol +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIsrc\fP source IPv4 address (little endian) +.br +\fIdst\fP destination IPv4 address (little endian) +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipv4_options (u_int8_t * options, u_int32_t options_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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). +.PP +When building a chain, the options must be built, then the IPv4 header. +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIoptions\fP byte string of IP options (it will be padded up to be an integral multiple of 32-bit words). +.br +\fIoptions_s\fP length of options string +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipv6 (u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a version 6 RFC 2460 Internet Protocol (IP) header. +.PP +\fBParameters:\fP +.RS 4 +\fItc\fP traffic class +.br +\fIfl\fP flow label +.br +\fIlen\fP total length of the IP packet +.br +\fInh\fP next header +.br +\fIhl\fP hop limit +.br +\fIsrc\fP source IPv6 address +.br +\fIdst\fP destination IPv6 address +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipv6_destopts (u_int8_t nh, u_int8_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fInh\fP next header +.br +\fIlen\fP length of the header in 8-byte octets not including the first 8 octets +.br +\fIpayload\fP options payload +.br +\fIpayload_s\fP payload length +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipv6_frag (u_int8_t nh, u_int8_t reserved, u_int16_t frag, u_int32_t id, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header. +.PP +\fBParameters:\fP +.RS 4 +\fInh\fP next header +.br +\fIreserved\fP unused value... OR IS IT! +.br +\fIfrag\fP fragmentation bits (ala ipv4) +.br +\fIid\fP packet identification +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipv6_hbhopts (u_int8_t nh, u_int8_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fInh\fP next header +.br +\fIlen\fP length of the header in 8-byte octets not including the first 8 octets +.br +\fIpayload\fP options payload +.br +\fIpayload_s\fP payload length +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ipv6_routing (u_int8_t nh, u_int8_t len, u_int8_t rtype, u_int8_t segments, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fInh\fP next header +.br +\fIlen\fP length of the header in 8-byte octets not including the first 8 octets +.br +\fIrtype\fP routing header type +.br +\fIsegments\fP number of routing segments that follow +.br +\fIpayload\fP optional payload of routing information +.br +\fIpayload_s\fP payload length +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_isl (u_int8_t * dhost, u_int8_t type, u_int8_t user, u_int8_t * shost, u_int16_t len, u_int8_t * snap, u_int16_t vid, u_int16_t portindex, u_int16_t reserved, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a Cisco Inter-Switch Link (ISL) header. +.PP +\fBParameters:\fP +.RS 4 +\fIdhost\fP destination address (should be 01:00:0c:00:00) +.br +\fItype\fP type of frame +.br +\fIuser\fP user defined data +.br +\fIshost\fP source mac address +.br +\fIlen\fP total length of the encapuslated packet less 18 bytes +.br +\fIsnap\fP SNAP information (0xaaaa03 + vendor code) +.br +\fIvid\fP 15 bit VLAN ID, 1 bit BPDU or CDP indicator +.br +\fIportindex\fP port index +.br +\fIreserved\fP used for FDDI and token ring +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_link (u_int8_t * dst, u_int8_t * src, u_int8_t * oui, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a link layer header for an initialized l. The function determines the proper link layer header format from how l was initialized. The function current supports Ethernet and Token Ring link layers. +.PP +\fBParameters:\fP +.RS 4 +\fIdst\fP the destination MAC address +.br +\fIsrc\fP the source MAC address +.br +\fIoui\fP Organizationally Unique Identifier (unused for Ethernet) +.br +\fItype\fP the upper layer protocol type +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_mpls (u_int32_t label, u_int8_t experimental, u_int8_t bos, u_int8_t ttl, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header. +.PP +\fBParameters:\fP +.RS 4 +\fIlabel\fP 20-bit label value +.br +\fIexperimental\fP 3-bit reserved field +.br +\fIbos\fP 1-bit bottom of stack identifier +.br +\fIttl\fP time to live +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ntp (u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an RFC 958 Network Time Protocol (NTP) header. +.PP +\fBParameters:\fP +.RS 4 +\fIleap_indicator\fP the leap indicator +.br +\fIversion\fP NTP protocol version +.br +\fImode\fP NTP mode +.br +\fIstratum\fP stratum +.br +\fIpoll\fP polling interval +.br +\fIprecision\fP precision +.br +\fIdelay_int\fP delay interval +.br +\fIdelay_frac\fP delay fraction +.br +\fIdispersion_int\fP dispersion interval +.br +\fIdispersion_frac\fP dispersion fraction +.br +\fIreference_id\fP reference id +.br +\fIref_ts_int\fP reference timestamp integer +.br +\fIref_ts_frac\fP reference timestamp fraction +.br +\fIorig_ts_int\fP original timestamp integer +.br +\fIorig_ts_frac\fP original timestamp fraction +.br +\fIrec_ts_int\fP receiver timestamp integer +.br +\fIrec_ts_frac\fP reciever timestamp fraction +.br +\fIxmt_ts_int\fP transmit timestamp integer +.br +\fIxmt_ts_frac\fP transmit timestamp integer +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2 (u_int16_t len, u_int8_t type, u_int32_t rtr_id, u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fIlen\fP +.br +\fItype\fP +.br +\fIrtr_id\fP +.br +\fIarea_id\fP +.br +\fIsum\fP +.br +\fIautype\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_dbd (u_int16_t dgram_len, u_int8_t opts, u_int8_t type, u_int seqnum, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fIdgram_len\fP +.br +\fIopts\fP +.br +\fItype\fP +.br +\fIseqnum\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_hello (u_int32_t netmask, u_int16_t interval, u_int8_t opts, u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fInetmask\fP +.br +\fIinterval\fP +.br +\fIopts\fP +.br +\fIpriority\fP +.br +\fIdead_int\fP +.br +\fIdes_rtr\fP +.br +\fIbkup_rtr\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_lsa (u_int16_t age, u_int8_t opts, u_int8_t type, u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fIage\fP +.br +\fIopts\fP +.br +\fItype\fP +.br +\fIlsid\fP +.br +\fIadvrtr\fP +.br +\fIseqnum\fP +.br +\fIsum\fP +.br +\fIlen\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_lsa_as (u_int32_t nmask, u_int metric, u_int32_t fwdaddr, u_int tag, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fInmask\fP +.br +\fImetric\fP +.br +\fIfwdaddr\fP +.br +\fItag\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_lsa_net (u_int32_t nmask, u_int rtrid, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fInmask\fP +.br +\fIrtrid\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_lsa_rtr (u_int16_t flags, u_int16_t num, u_int id, u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fIflags\fP +.br +\fInum\fP +.br +\fIid\fP +.br +\fIdata\fP +.br +\fItype\fP +.br +\fItos\fP +.br +\fImetric\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_lsa_sum (u_int32_t nmask, u_int metric, u_int tos, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fInmask\fP +.br +\fImetric\fP +.br +\fItos\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_lsr (u_int type, u_int lsid, u_int32_t advrtr, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP +.br +\fIlsid\fP +.br +\fIadvrtr\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_ospfv2_lsu (u_int num, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +\fBParameters:\fP +.RS 4 +\fInum\fP +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_rip (u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, u_int32_t metric, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a Routing Information Protocol header (RFCs 1058 and 2453). +.PP +\fBParameters:\fP +.RS 4 +\fIcmd\fP command +.br +\fIversion\fP protocol version +.br +\fIrd\fP version one: 0, version two: routing domain +.br +\fIaf\fP address family +.br +\fIrt\fP version one: 0, version two: route tag +.br +\fIaddr\fP IPv4 address +.br +\fImask\fP version one: 0, version two: subnet mask +.br +\fInext_hop\fP version one: 0, version two: next hop address +.br +\fImetric\fP routing metric +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_rpc_call (u_int32_t rm, u_int32_t xid, u_int32_t prog_num, u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, u_int8_t * cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t * vdata, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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). +.PP +\fBParameters:\fP +.RS 4 +\fIrm\fP record marking indicating the position in a stream, 0 otherwise +.br +\fIxid\fP transaction identifier used to link calls and replies +.br +\fIprog_num\fP remote program specification typically between 0 - 1fffffff +.br +\fIprog_vers\fP remote program version specification +.br +\fIprocedure\fP procedure to be performed by remote program +.br +\fIcflavor\fP authentication credential type +.br +\fIclength\fP credential length (should be 0) +.br +\fIcdata\fP opaque credential data (currently unused) +.br +\fIvflavor\fP authentication verifier type +.br +\fIvlength\fP verifier length (should be 0) +.br +\fIvdata\fP opaque verifier data (currently unused) +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_sebek (u_int32_t magic, u_int16_t version, u_int16_t type, u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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: http://www.honeynet.org/papers/sebek.pdf. +.PP +\fBParameters:\fP +.RS 4 +\fImagic\fP identify packets that should be hidden +.br +\fIversion\fP protocol version, currently 1 +.br +\fItype\fP type of record (read data is type 0, write data is type 1) +.br +\fIcounter\fP PDU counter used to identify when packet are lost +.br +\fItime_sec\fP seconds since EPOCH according to the honeypot +.br +\fItime_usec\fP residual microseconds +.br +\fIpid\fP PID +.br +\fIuid\fP UID +.br +\fIfd\fP FD +.br +\fIcmd\fP 12 first characters of the command +.br +\fIlength\fP length in bytes of the PDU's body +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_stp_conf (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t flags, u_int8_t * root_id, u_int32_t root_pc, u_int8_t * bridge_id, u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, u_int16_t hello_time, u_int16_t f_delay, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIid\fP protocol id +.br +\fIversion\fP protocol version +.br +\fIbpdu_type\fP bridge protocol data unit type +.br +\fIflags\fP flags +.br +\fIroot_id\fP root id +.br +\fIroot_pc\fP root path cost +.br +\fIbridge_id\fP bridge id +.br +\fIport_id\fP port id +.br +\fImessage_age\fP message age +.br +\fImax_age\fP max age +.br +\fIhello_time\fP hello time +.br +\fIf_delay\fP forward delay +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_stp_tcn (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIid\fP protocol id +.br +\fIversion\fP protocol version +.br +\fIbpdu_type\fP bridge protocol data unit type +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_tcp (u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an RFC 793 Transmission Control Protocol (TCP) header. +.PP +\fBParameters:\fP +.RS 4 +\fIsp\fP source port +.br +\fIdp\fP destination port +.br +\fIseq\fP sequence number +.br +\fIack\fP acknowledgement number +.br +\fIcontrol\fP control flags +.br +\fIwin\fP window size +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIurg\fP urgent pointer +.br +\fIlen\fP total length of the TCP packet (for checksum calculation) +.br +\fIpayload\fP +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_tcp_options (u_int8_t * options, u_int32_t options_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIoptions\fP byte string of TCP options +.br +\fIoptions_s\fP length of options string +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_token_ring (u_int8_t ac, u_int8_t fc, u_int8_t * dst, u_int8_t * src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * oui, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds a token ring header. +.PP +\fBParameters:\fP +.RS 4 +\fIac\fP access control +.br +\fIfc\fP frame control +.br +\fIdst\fP destination address +.br +\fIsrc\fP source address +.br +\fIdsap\fP destination service access point +.br +\fIssap\fP source service access point +.br +\fIcf\fP control field +.br +\fIoui\fP Organizationally Unique Identifier +.br +\fItype\fP upper layer protocol type +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_udp (u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +Builds an RFC 768 User Datagram Protocol (UDP) header. +.PP +\fBParameters:\fP +.RS 4 +\fIsp\fP source port +.br +\fIdp\fP destination port +.br +\fIlen\fP total length of the UDP packet +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "libnet_ptag_t libnet_build_vrrp (u_int8_t version, u_int8_t type, u_int8_t vrouter_id, u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, u_int16_t sum, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIversion\fP VRRP version (should be 2) +.br +\fItype\fP VRRP packet type (should be 1 -- ADVERTISEMENT) +.br +\fIvrouter_id\fP virtual router identification +.br +\fIpriority\fP priority (higher numbers indicate higher priority) +.br +\fIip_count\fP number of IPv4 addresses contained in this advertisement +.br +\fIauth_type\fP type of authentication (0, 1, 2 -- see RFC) +.br +\fIadvert_int\fP interval between advertisements +.br +\fIsum\fP checksum (0 for libnet to autofill) +.br +\fIpayload\fP optional payload or NULL +.br +\fIpayload_s\fP payload length or 0 +.br +\fIl\fP pointer to a libnet context +.br +\fIptag\fP protocol tag to modify an existing header, 0 to build a new one +.RE +.PP +\fBReturns:\fP +.RS 4 +protocol tag value on success, -1 on error +.RE +.PP + +.SS "void libnet_clear_packet (libnet_t * l)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP + +.SS "int libnet_cq_add (libnet_t * l, char * label)" +.PP +[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 \fBlibnet_init()\fP. If the context queue in write locked, this function will fail. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIlabel\fP a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "void libnet_cq_destroy (void)" +.PP +[Context Queue] Destroys the entire context queue, calling \fBlibnet_destroy()\fP on each member context. +.SS "u_int32_t libnet_cq_end_loop (void)" +.PP +[Context Queue] +.SS "libnet_t* libnet_cq_find_by_label (char * label)" +.PP +[Context Queue] Locates a libnet context from the queue, indexed by a canonical label. +.PP +\fBParameters:\fP +.RS 4 +\fIlabel\fP canonical label of the libnet context to retrieve +.RE +.PP +\fBReturns:\fP +.RS 4 +the expected libnet context, NULL on failure +.RE +.PP + +.SS "const char* libnet_cq_getlabel (libnet_t * l)" +.PP +[Context Queue] Returns the canonical label associated with the context. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +pointer to the libnet context's label +.RE +.PP + +.SS "libnet_t* libnet_cq_head (void)" +.PP +[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: +.PP +for (l = \fBlibnet_cq_head()\fP; \fBlibnet_cq_last()\fP; l = \fBlibnet_cq_next()\fP) { ... } +.PP +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, \fBfor_each_context_in_cq(l)\fP. Warning: do not call the iterator more than once in a single loop. +.PP +\fBReturns:\fP +.RS 4 +the head of the context queue +.RE +.PP + +.SS "int libnet_cq_last (void)" +.PP +[Context Queue] Check whether the iterator is at the last context in the queue. +.PP +\fBReturns:\fP +.RS 4 +1 if at the end of the context queue, 0 otherwise +.RE +.PP + +.SS "libnet_t* libnet_cq_next (void)" +.PP +[Context Queue] Get next context from the context queue. +.PP +\fBReturns:\fP +.RS 4 +the next context from the context queue +.RE +.PP + +.SS "libnet_t* libnet_cq_remove (libnet_t * l)" +.PP +[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 \fBlibnet_destroy()\fP. 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 \fBlibnet_cq_remove_by_label()\fP. If the context queue is write locked, this function will fail. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +the pointer to the removed libnet context, NULL on failure +.RE +.PP + +.SS "libnet_t* libnet_cq_remove_by_label (char * label)" +.PP +[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 \fBlibnet_destroy()\fP. If the context queue is write locked, this function will fail. +.PP +\fBParameters:\fP +.RS 4 +\fIlabel\fP canonical name of the context to remove +.RE +.PP +\fBReturns:\fP +.RS 4 +the pointer to the removed libnet context, NULL on failure +.RE +.PP + +.SS "u_int32_t libnet_cq_size (void)" +.PP +[Context Queue] Function returns the number of libnet contexts that are in the queue. +.PP +\fBReturns:\fP +.RS 4 +the number of libnet contexts currently in the queue +.RE +.PP + +.SS "void libnet_destroy (libnet_t * l)" +.PP +Shuts down the libnet session referenced by l. It closes the network interface and frees all internal memory structures associated with l. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP + +.SS "void libnet_diag_dump_context (libnet_t * l)" +.PP +[Diagnostic] Prints the contents of the given context. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP + +.SS "void libnet_diag_dump_hex (u_int8_t * packet, u_int32_t len, int swap, FILE * stream)" +.PP +[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. +.PP +\fBParameters:\fP +.RS 4 +\fIpacket\fP the packet to print +.br +\fIlen\fP length of the packet in bytes +.br +\fIswap\fP 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). +.br +\fIstream\fP a stream pointer to print to +.RE +.PP + +.SS "void libnet_diag_dump_pblock (libnet_t * l)" +.PP +[Diagnostic] Prints the contents of every pblock. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP + +.SS "char* libnet_diag_dump_pblock_type (u_int8_t type)" +.PP +[Diagnostic] Returns the canonical name of the pblock type. +.PP +\fBParameters:\fP +.RS 4 +\fItype\fP pblock type +.RE +.PP +\fBReturns:\fP +.RS 4 +a string representing the pblock type type or 'unknown' for an unknown value +.RE +.PP + +.SS "struct libnet_ether_addr* libnet_get_hwaddr (libnet_t * l)\fC [read]\fP" +.PP +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 \fBlibnet_geterror()\fP will tell you why. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +a pointer to the MAC address or NULL +.RE +.PP + +.SS "u_int32_t libnet_get_ipaddr4 (libnet_t * l)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +a big endian IP address suitable for use in a libnet_build function or -1 +.RE +.PP + +.SS "struct libnet_in6_addr libnet_get_ipaddr6 (libnet_t * l)\fC [read]\fP" +.PP +This function is not yet implemented under IPv6. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +well, nothing yet +.RE +.PP + +.SS "u_int32_t libnet_get_prand (int mod)" +.PP +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 +.PP +\fBParameters:\fP +.RS 4 +\fImod\fP one the of LIBNET_PR* constants +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "const char* libnet_getdevice (libnet_t * l)" +.PP +Returns the canonical name of the device used for packet injection. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +the canonical name of the device used for packet injection. Note it can be NULL without being an error. +.RE +.PP + +.SS "char* libnet_geterror (libnet_t * l)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +an error string or NULL if no error has occured +.RE +.PP + +.SS "int libnet_getfd (libnet_t * l)" +.PP +Returns the FILENO of the file descriptor used for packet injection. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +the file number of the file descriptor used for packet injection +.RE +.PP + +.SS "u_int32_t libnet_getgre_length (u_int16_t fv)" +.PP +\fBParameters:\fP +.RS 4 +\fIfv\fP see \fBlibnet_build_gre()\fP. +.RE +.PP +\fBReturns:\fP +.RS 4 +size, see \fBlibnet_build_gre()\fP. +.RE +.PP + +.SS "u_int32_t libnet_getpacket_size (libnet_t * l)" +.PP +Returns the sum of the size of all of the pblocks inside of l (this should be the resuling packet size). +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +the size of the packet in l +.RE +.PP + +.SS "u_int8_t* libnet_getpbuf (libnet_t * l, libnet_ptag_t ptag)" +.PP +Returns the pblock buffer contents for the specified ptag; a subsequent call to \fBlibnet_getpbuf_size()\fP should be made to determine the size of the buffer. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIptag\fP the ptag reference number +.RE +.PP +\fBReturns:\fP +.RS 4 +a pointer to the pblock buffer or NULL on error +.RE +.PP + +.SS "u_int32_t libnet_getpbuf_size (libnet_t * l, libnet_ptag_t ptag)" +.PP +Returns the pblock buffer size for the specified ptag; a previous call to \fBlibnet_getpbuf()\fP should be made to pull the actual buffer contents. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIptag\fP the ptag reference number +.RE +.PP +\fBReturns:\fP +.RS 4 +the size of the pblock buffer +.RE +.PP + +.SS "u_int8_t* libnet_hex_aton (const char * s, int * len)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIs\fP the string to be parsed +.br +\fIlen\fP the resulting size of the returned byte string +.RE +.PP +\fBReturns:\fP +.RS 4 +a byte string or NULL on failure +.RE +.PP + +.SS "libnet_t* libnet_init (int injection_type, char * device, char * err_buf)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIinjection_type\fP packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV) +.br +\fIdevice\fP the interface to use (NULL and libnet will choose one) +.br +\fIerr_buf\fP will contain an error message on failure +.RE +.PP +\fBReturns:\fP +.RS 4 +libnet context ready for use or NULL on error. +.RE +.PP + +.SS "u_int32_t libnet_name2addr4 (libnet_t * l, char * host_name, u_int8_t use_name)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIhost_name\fP pointer to a string containing a presentation format host name +.br +\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE +.RE +.PP +\fBReturns:\fP +.RS 4 +network byte ordered IPv4 address or -1 (2^32 - 1) on error +.RE +.PP + +.SS "struct libnet_in6_addr libnet_name2addr6 (libnet_t * l, char * host_name, u_int8_t use_name)\fC [read]\fP" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIhost_name\fP pointer to a string containing a presentation format host name +.br +\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE +.RE +.PP +\fBReturns:\fP +.RS 4 +network byte ordered IPv6 address structure +.RE +.PP + +.SS "int libnet_plist_chain_dump (libnet_plist_t * plist)" +.PP +Runs through the port list and prints the contents of the port list chain list to stdout. +.PP +\fBParameters:\fP +.RS 4 +\fIplist\fP previously created portlist +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "char* libnet_plist_chain_dump_string (libnet_plist_t * plist)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIplist\fP previously created portlist +.RE +.PP +\fBReturns:\fP +.RS 4 +a printable string containing the port list contents on success NULL on error +.RE +.PP + +.SS "int libnet_plist_chain_free (libnet_plist_t * plist)" +.PP +Frees all memory associated with port list chain. +.PP +\fBParameters:\fP +.RS 4 +\fIplist\fP previously created portlist +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "int libnet_plist_chain_new (libnet_t * l, libnet_plist_t ** plist, char * token_list)" +.PP +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 \fBlibnet_geterror()\fP can tell you why. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIplist\fP if successful, will refer to the portlist, if not, NULL +.br +\fItoken_list\fP string containing the port list primitive +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "int libnet_plist_chain_next_pair (libnet_plist_t * plist, u_int16_t * bport, u_int16_t * eport)" +.PP +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. +.PP +\fBParameters:\fP +.RS 4 +\fIplist\fP previously created portlist +.br +\fIbport\fP will contain the beginning port number or 0 +.br +\fIeport\fP will contain the ending port number or 0 +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, 0 if empty, -1 on failure +.RE +.PP + +.SS "int libnet_seed_prand (libnet_t * l)" +.PP +Seeds the psuedo-random number generator. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "void libnet_stats (libnet_t * l, struct libnet_stats * ls)" +.PP +Fills in a libnet_stats structure with packet injection statistics (packets written, bytes written, packet sending errors). +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIls\fP pointer to a libnet statistics structure +.RE +.PP + +.SS "int libnet_toggle_checksum (libnet_t * l, libnet_ptag_t ptag, int mode)" +.PP +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 \fBlibnet_toggle_checksum()\fP. 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. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.br +\fIptag\fP the ptag reference number +.br +\fImode\fP LIBNET_ON or LIBNET_OFF +.RE +.PP +\fBReturns:\fP +.RS 4 +1 on success, -1 on failure +.RE +.PP + +.SS "const char* libnet_version (void)" +.PP +Returns the version of libnet. +.PP +\fBReturns:\fP +.RS 4 +the libnet version +.RE +.PP + +.SS "int libnet_write (libnet_t * l)" +.PP +Writes a prebuilt packet to the network. The function assumes that l was previously initialized (via a call to \fBlibnet_init()\fP) 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 \fBlibnet_stats()\fP. +.PP +\fBParameters:\fP +.RS 4 +\fIl\fP pointer to a libnet context +.RE +.PP +\fBReturns:\fP +.RS 4 +the number of bytes written, -1 on error +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for libnet from the source code. diff --git a/unmerged/debian/tmp/usr/share/man/man3/libnet-macros.h.3 b/unmerged/debian/tmp/usr/share/man/man3/libnet-macros.h.3 new file mode 100644 index 0000000..b6389a5 --- /dev/null +++ b/unmerged/debian/tmp/usr/share/man/man3/libnet-macros.h.3 @@ -0,0 +1,196 @@ +.TH "libnet-macros.h" 3 "9 Jun 2009" "Version 1.1.4" "libnet" \" -*- nroff -*- +.ad l +.nh +.SH NAME +libnet-macros.h \- libnet macros and symbolic constants +.SH SYNOPSIS +.br +.PP +.SS "Defines" + +.in +1c +.ti -1c +.RI "#define \fBLIBNET_DONT_RESOLVE\fP 0" +.br +.ti -1c +.RI "#define \fBLIBNET_RESOLVE\fP 1" +.br +.ti -1c +.RI "#define \fBLIBNET_ON\fP 0" +.br +.ti -1c +.RI "#define \fBLIBNET_OFF\fP 1" +.br +.ti -1c +.RI "#define \fBIN6ADDR_ERROR_INIT\fP" +.br +.ti -1c +.RI "#define \fBLIBNET_PR2\fP 0" +.br +.ti -1c +.RI "#define \fBLIBNET_PR8\fP 1" +.br +.ti -1c +.RI "#define \fBLIBNET_PR16\fP 2" +.br +.ti -1c +.RI "#define \fBLIBNET_PRu16\fP 3" +.br +.ti -1c +.RI "#define \fBLIBNET_PR32\fP 4" +.br +.ti -1c +.RI "#define \fBLIBNET_PRu32\fP 5" +.br +.ti -1c +.RI "#define \fBLIBNET_PRAND_MAX\fP 0xffffffff" +.br +.ti -1c +.RI "#define \fBLIBNET_MAX_PACKET\fP 0xffff" +.br +.ti -1c +.RI "#define \fBIP_MAXPACKET\fP 0xffff" +.br +.ti -1c +.RI "#define \fBETHER_ADDR_LEN\fP 0x6" +.br +.ti -1c +.RI "#define \fBFDDI_ADDR_LEN\fP 0x6" +.br +.ti -1c +.RI "#define \fBTOKEN_RING_ADDR_LEN\fP 0x6" +.br +.ti -1c +.RI "#define \fBLIBNET_ORG_CODE_SIZE\fP 0x3" +.br +.ti -1c +.RI "#define \fBLIBNET_ERRBUF_SIZE\fP 0x100" +.br +.ti -1c +.RI "#define \fBLIBNET_MAXOPTION_SIZE\fP 0x28" +.br +.ti -1c +.RI "#define \fBFIX\fP(n) (n)" +.br +.ti -1c +.RI "#define \fBUNFIX\fP(n) (n)" +.br +.ti -1c +.RI "#define \fBLIBNET_DO_PAYLOAD\fP(l, p)" +.br +.ti -1c +.RI "#define \fBLIBNET_CKSUM_CARRY\fP(x) (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff))" +.br +.ti -1c +.RI "#define \fBLIBNET_OSPF_AUTHCPY\fP(x, y) memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))" +.br +.ti -1c +.RI "#define \fBLIBNET_OSPF_CKSUMBUF\fP(x, y) memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))" +.br +.ti -1c +.RI "#define \fBLIBNET_NTP_DO_LI_VN_MODE\fP(li, vn, md) ((u_int8_t)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7)))" +.br +.ti -1c +.RI "#define \fBLIBNET_ISLOOPBACK\fP(p) (strcmp((p)->ifr_name, 'lo0') == 0)" +.br +.ti -1c +.RI "#define \fBLIBNET_ISADVMODE\fP(x) (x & 0x08)" +.br +.ti -1c +.RI "#define \fBLIBNET_LABEL_SIZE\fP 64" +.br +.ti -1c +.RI "#define \fBLIBNET_LABEL_DEFAULT\fP 'cardshark'" +.br +.ti -1c +.RI "#define \fBCQ_LOCK_UNLOCKED\fP (u_int)0x00000000" +.br +.ti -1c +.RI "#define \fBCQ_LOCK_READ\fP (u_int)0x00000001" +.br +.ti -1c +.RI "#define \fBCQ_LOCK_WRITE\fP (u_int)0x00000002" +.br +.ti -1c +.RI "#define \fBfor_each_context_in_cq\fP(l) for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next())" +.br +.ti -1c +.RI "#define \fBcq_is_wlocked\fP() (l_cqd.cq_lock & CQ_LOCK_WRITE)" +.br +.ti -1c +.RI "#define \fBcq_is_rlocked\fP() (l_cqd.cq_lock & CQ_LOCK_READ)" +.br +.ti -1c +.RI "#define \fBcq_is_locked\fP() (l_cqd.cq_lock & (CQ_LOCK_READ | CQ_LOCK_WRITE))" +.br +.ti -1c +.RI "#define \fBcheck_cq_lock\fP(x) (l_cqd.cq_lock & x)" +.br +.in -1c +.SH "Detailed Description" +.PP +libnet macros and symbolic constants + + +.SH "Define Documentation" +.PP +.SS "#define for_each_context_in_cq(l) for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next())" +.PP +Provides an interface to iterate through the context queue of libnet contexts. Before calling this macro, be sure to set the queue using \fBlibnet_cq_head()\fP. +.SS "#define IN6ADDR_ERROR_INIT" +.PP +\fBValue:\fP +.PP +.nf +{ { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff } } } +.fi +IPv6 error code +.SS "#define LIBNET_DO_PAYLOAD(l, p)" +.PP +\fBValue:\fP +.PP +.nf +if ((payload && !payload_s) || (!payload && payload_s)) \ +{ \ + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, \ + '%s(): payload inconsistency\n', __func__); \ + goto bad; \ +} \ +if (payload && payload_s) \ +{ \ + n = libnet_pblock_append(l, p, payload, payload_s); \ + if (n == (u_int32_t) - 1) \ + { \ + goto bad; \ + } \ +} \ +.fi +.SS "#define LIBNET_DONT_RESOLVE 0" +.PP +Used for libnet's name resolution functions, specifies that no DNS lookups should be performed and the IP address should be kept in numeric form. +.SS "#define LIBNET_ERRBUF_SIZE 0x100" +.PP +The libnet error buffer is 256 bytes long. +.SS "#define LIBNET_MAX_PACKET 0xffff" +.PP +The biggest an IP packet can be -- 65,535 bytes. +.SS "#define LIBNET_MAXOPTION_SIZE 0x28" +.PP +IP and TCP options can be up to 40 bytes long. +.SS "#define LIBNET_OFF 1" +.PP +Used several places, to specify 'on' or 'one' +.SS "#define LIBNET_ON 0" +.PP +Used several places, to specify 'on' or 'one' +.SS "#define LIBNET_PR2 0" +.PP +Used for \fBlibnet_get_prand()\fP to specify function disposition +.SS "#define LIBNET_RESOLVE 1" +.PP +Used for libnet's name resolution functions, specifies that a DNS lookup can be performed if needed to resolve the IP address to a canonical form. +.SH "Author" +.PP +Generated automatically by Doxygen for libnet from the source code. diff --git a/unmerged/debian/tmp/usr/share/man/man3/libnet.h.3 b/unmerged/debian/tmp/usr/share/man/man3/libnet.h.3 new file mode 100644 index 0000000..51fcc4a --- /dev/null +++ b/unmerged/debian/tmp/usr/share/man/man3/libnet.h.3 @@ -0,0 +1,90 @@ +.TH "libnet.h" 3 "9 Jun 2009" "Version 1.1.4" "libnet" \" -*- nroff -*- +.ad l +.nh +.SH NAME +libnet.h \- toplevel libnet header file +.SH SYNOPSIS +.br +.PP +\fC#include <stdio.h>\fP +.br +\fC#include <string.h>\fP +.br +\fC#include <unistd.h>\fP +.br +\fC#include <fcntl.h>\fP +.br +\fC#include <signal.h>\fP +.br +\fC#include <stdlib.h>\fP +.br +\fC#include <sys/ioctl.h>\fP +.br +\fC#include <sys/stat.h>\fP +.br +\fC#include <sys/types.h>\fP +.br +\fC#include <ctype.h>\fP +.br +\fC#include <sys/socket.h>\fP +.br +\fC#include <netinet/in.h>\fP +.br +\fC#include <netinet/in_systm.h>\fP +.br +\fC#include <netinet/ip.h>\fP +.br +\fC#include <net/if.h>\fP +.br +\fC#include <netinet/ip_var.h>\fP +.br +\fC#include <netinet/tcp.h>\fP +.br +\fC#include <netinet/udp.h>\fP +.br +\fC#include <netinet/igmp.h>\fP +.br +\fC#include <arpa/inet.h>\fP +.br +\fC#include <sys/time.h>\fP +.br +\fC#include <netdb.h>\fP +.br +\fC#include <errno.h>\fP +.br +\fC#include <stdarg.h>\fP +.br +\fC#include './libnet/libnet-types.h'\fP +.br +\fC#include './libnet/libnet-macros.h'\fP +.br +\fC#include './libnet/libnet-headers.h'\fP +.br +\fC#include './libnet/libnet-structures.h'\fP +.br +\fC#include './libnet/libnet-asn1.h'\fP +.br +\fC#include './libnet/libnet-functions.h'\fP +.br + +.SS "Defines" + +.in +1c +.ti -1c +.RI "#define \fB_GNU_SOURCE\fP" +.br +.ti -1c +.RI "#define \fBLIBNET_VERSION\fP '1.1.4'" +.br +.ti -1c +.RI "#define \fBLIBNET_LIL_ENDIAN\fP 1" +.br +.in -1c +.SH "Detailed Description" +.PP +toplevel libnet header file + + +.SH "Author" +.PP +Generated automatically by Doxygen for libnet from the source code. diff --git a/unmerged/debian/watch b/unmerged/debian/watch new file mode 100644 index 0000000..d903ca9 --- /dev/null +++ b/unmerged/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://www.packetfactory.net/libnet/dist/libnet-(\d+.*)\.tar\.gz |