libnet4r 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +15 -0
- data/LICENSE +28 -0
- data/README +187 -0
- data/Rakefile +110 -0
- data/ext/extconf.rb +60 -0
- data/ext/libnet.c +705 -0
- data/ext/libnet_arp.c +152 -0
- data/ext/libnet_ethernet.c +115 -0
- data/ext/libnet_ipv4.c +140 -0
- data/ext/libnet_ipv6.c +138 -0
- data/ext/libnet_udp.c +112 -0
- data/ext/libnet_vlan.c +131 -0
- data/lib/libnet4r/header.rb +609 -0
- data/lib/libnet4r/helpers.rb +19 -0
- data/lib/libnet4r/libnet.rb +39 -0
- data/libnet/CVS/Entries +24 -0
- data/libnet/CVS/Repository +1 -0
- data/libnet/CVS/Root +1 -0
- data/libnet/Makefile.am +15 -0
- data/libnet/Makefile.am.common +10 -0
- data/libnet/Makefile.in +443 -0
- data/libnet/README +21 -0
- data/libnet/VERSION +1 -0
- data/libnet/acconfig.h +36 -0
- data/libnet/acinclude.m4 +463 -0
- data/libnet/aclocal.m4 +1337 -0
- data/libnet/autom4te.cache/CVS/Entries +1 -0
- data/libnet/autom4te.cache/CVS/Repository +1 -0
- data/libnet/autom4te.cache/CVS/Root +1 -0
- data/libnet/autom4te.cache/output.0 +6225 -0
- data/libnet/autom4te.cache/requests +111 -0
- data/libnet/autom4te.cache/traces.0 +272 -0
- data/libnet/config.guess +1314 -0
- data/libnet/config.sub +1410 -0
- data/libnet/configure +6225 -0
- data/libnet/configure.in +235 -0
- data/libnet/doc/BUGS +19 -0
- data/libnet/doc/CHANGELOG +527 -0
- data/libnet/doc/CONTRIB +53 -0
- data/libnet/doc/COPYING +31 -0
- data/libnet/doc/CVS/Entries +12 -0
- data/libnet/doc/CVS/Repository +1 -0
- data/libnet/doc/CVS/Root +1 -0
- data/libnet/doc/DESIGN_NOTES +134 -0
- data/libnet/doc/MIGRATION +172 -0
- data/libnet/doc/PACKET_BUILDING +161 -0
- data/libnet/doc/PORTED +45 -0
- data/libnet/doc/RAWSOCKET_NON_SEQUITUR +41 -0
- data/libnet/doc/TODO +96 -0
- data/libnet/doc/html/acconfig_8h-source.html +49 -0
- data/libnet/doc/html/annotated.html +17 -0
- data/libnet/doc/html/bpf_8h-source.html +277 -0
- data/libnet/doc/html/config_8h-source.html +125 -0
- data/libnet/doc/html/doxygen.css +169 -0
- data/libnet/doc/html/doxygen.png +0 -0
- data/libnet/doc/html/files.html +29 -0
- data/libnet/doc/html/functions.html +26 -0
- data/libnet/doc/html/functions_vars.html +26 -0
- data/libnet/doc/html/getopt_8h-source.html +97 -0
- data/libnet/doc/html/globals.html +219 -0
- data/libnet/doc/html/globals_defs.html +104 -0
- data/libnet/doc/html/globals_func.html +136 -0
- data/libnet/doc/html/gnuc_8h-source.html +56 -0
- data/libnet/doc/html/graph_legend.dot +22 -0
- data/libnet/doc/html/graph_legend.html +75 -0
- data/libnet/doc/html/ifaddrlist_8h-source.html +65 -0
- data/libnet/doc/html/in__systm_8h-source.html +90 -0
- data/libnet/doc/html/index.html +17 -0
- data/libnet/doc/html/libnet-asn1_8h-source.html +268 -0
- data/libnet/doc/html/libnet-functions_8h-source.html +742 -0
- data/libnet/doc/html/libnet-functions_8h.html +8844 -0
- data/libnet/doc/html/libnet-headers_8h-source.html +1655 -0
- data/libnet/doc/html/libnet-headers_8h.html +3053 -0
- data/libnet/doc/html/libnet-macros_8h-source.html +161 -0
- data/libnet/doc/html/libnet-macros_8h.html +358 -0
- data/libnet/doc/html/libnet-structures_8h-source.html +233 -0
- data/libnet/doc/html/libnet-types_8h-source.html +58 -0
- data/libnet/doc/html/libnet_8h-source.html +119 -0
- data/libnet/doc/html/libnet_8h.html +24 -0
- data/libnet/doc/html/structlibnet__802__1q__hdr.html +145 -0
- data/libnet/doc/html/structlibnet__802__1x__hdr.html +97 -0
- data/libnet/doc/libnet.doxygen.conf +1102 -0
- data/libnet/doc/man/CVS/Entries +1 -0
- data/libnet/doc/man/CVS/Repository +1 -0
- data/libnet/doc/man/CVS/Root +1 -0
- data/libnet/doc/man/man3/libnet-functions.h.3 +3136 -0
- data/libnet/doc/man/man3/libnet-headers.h.3 +1872 -0
- data/libnet/doc/man/man3/libnet-macros.h.3 +172 -0
- data/libnet/doc/man/man3/libnet.h.3 +17 -0
- data/libnet/doc/man/man3/libnet_802_1q_hdr.3 +53 -0
- data/libnet/doc/man/man3/libnet_802_1x_hdr.3 +41 -0
- data/libnet/include/CVS/Entries +10 -0
- data/libnet/include/CVS/Repository +1 -0
- data/libnet/include/CVS/Root +1 -0
- data/libnet/include/Makefile.am +7 -0
- data/libnet/include/Makefile.in +395 -0
- data/libnet/include/bpf.h +264 -0
- data/libnet/include/config.h.in +118 -0
- data/libnet/include/gnuc.h +43 -0
- data/libnet/include/ifaddrlist.h +52 -0
- data/libnet/include/libnet/CVS/Entries +9 -0
- data/libnet/include/libnet/CVS/Repository +1 -0
- data/libnet/include/libnet/CVS/Root +1 -0
- data/libnet/include/libnet/Makefile.am +12 -0
- data/libnet/include/libnet/Makefile.in +294 -0
- data/libnet/include/libnet/libnet-asn1.h +255 -0
- data/libnet/include/libnet/libnet-functions.h +2157 -0
- data/libnet/include/libnet/libnet-headers.h +1662 -0
- data/libnet/include/libnet/libnet-macros.h +186 -0
- data/libnet/include/libnet/libnet-structures.h +222 -0
- data/libnet/include/libnet/libnet-types.h +45 -0
- data/libnet/include/libnet.h.in +132 -0
- data/libnet/include/stamp-h.in +1 -0
- data/libnet/include/win32/CVS/Entries +5 -0
- data/libnet/include/win32/CVS/Repository +1 -0
- data/libnet/include/win32/CVS/Root +1 -0
- data/libnet/include/win32/config.h +112 -0
- data/libnet/include/win32/getopt.h +84 -0
- data/libnet/include/win32/in_systm.h +77 -0
- data/libnet/include/win32/libnet.h +106 -0
- data/libnet/install-sh +250 -0
- data/libnet/libnet-config.in +62 -0
- data/libnet/libnet.doxygen.conf +1102 -0
- data/libnet/man/CVS/Entries +1 -0
- data/libnet/man/CVS/Repository +1 -0
- data/libnet/man/CVS/Root +1 -0
- data/libnet/missing +283 -0
- data/libnet/mkinstalldirs +40 -0
- data/libnet/sample/CVS/Entries +47 -0
- data/libnet/sample/CVS/Repository +1 -0
- data/libnet/sample/CVS/Root +1 -0
- data/libnet/sample/Makefile.am +63 -0
- data/libnet/sample/Makefile.in +729 -0
- data/libnet/sample/arp-new.c +144 -0
- data/libnet/sample/arp.c +151 -0
- data/libnet/sample/bgp4_hdr.c +225 -0
- data/libnet/sample/bgp4_notification.c +242 -0
- data/libnet/sample/bgp4_open.c +266 -0
- data/libnet/sample/bgp4_update.c +337 -0
- data/libnet/sample/cdp.c +187 -0
- data/libnet/sample/dhcp_discover.c +257 -0
- data/libnet/sample/dns.c +260 -0
- data/libnet/sample/dot1x.c +113 -0
- data/libnet/sample/fddi_tcp1.c +213 -0
- data/libnet/sample/fddi_tcp2.c +209 -0
- data/libnet/sample/get_addr.c +112 -0
- data/libnet/sample/gre.c +410 -0
- data/libnet/sample/icmp6_echoreq.c +184 -0
- data/libnet/sample/icmp_echo_cq.c +201 -0
- data/libnet/sample/icmp_redirect.c +200 -0
- data/libnet/sample/icmp_timeexceed.c +190 -0
- data/libnet/sample/icmp_timestamp.c +157 -0
- data/libnet/sample/icmp_unreach.c +204 -0
- data/libnet/sample/ieee.c +177 -0
- data/libnet/sample/ip_link.c +201 -0
- data/libnet/sample/ip_raw.c +180 -0
- data/libnet/sample/isl.c +167 -0
- data/libnet/sample/libnet_test.h +60 -0
- data/libnet/sample/mpls.c +251 -0
- data/libnet/sample/ntp.c +193 -0
- data/libnet/sample/ospf_hello.c +179 -0
- data/libnet/sample/ospf_lsa.c +190 -0
- data/libnet/sample/ping_of_death.c +171 -0
- data/libnet/sample/rpc_tcp.c +214 -0
- data/libnet/sample/rpc_udp.c +213 -0
- data/libnet/sample/sebek.c +299 -0
- data/libnet/sample/smurf.c +194 -0
- data/libnet/sample/stp.c +227 -0
- data/libnet/sample/synflood.c +200 -0
- data/libnet/sample/synflood6.c +209 -0
- data/libnet/sample/synflood6_frag.c +234 -0
- data/libnet/sample/tcp1.c +227 -0
- data/libnet/sample/tcp2.c +192 -0
- data/libnet/sample/tftp.c +207 -0
- data/libnet/sample/tring_tcp1.c +214 -0
- data/libnet/sample/tring_tcp2.c +210 -0
- data/libnet/sample/udp1.c +223 -0
- data/libnet/sample/udp2.c +232 -0
- data/libnet/sample/win32/CVS/Entries +9 -0
- data/libnet/sample/win32/CVS/Repository +1 -0
- data/libnet/sample/win32/CVS/Root +1 -0
- data/libnet/sample/win32/arp/CVS/Entries +2 -0
- data/libnet/sample/win32/arp/CVS/Repository +1 -0
- data/libnet/sample/win32/arp/CVS/Root +1 -0
- data/libnet/sample/win32/arp/arp.vcproj +136 -0
- data/libnet/sample/win32/cdp/CVS/Entries +2 -0
- data/libnet/sample/win32/cdp/CVS/Repository +1 -0
- data/libnet/sample/win32/cdp/CVS/Root +1 -0
- data/libnet/sample/win32/cdp/cdp.vcproj +136 -0
- data/libnet/sample/win32/dhcp_discover/CVS/Entries +2 -0
- data/libnet/sample/win32/dhcp_discover/CVS/Repository +1 -0
- data/libnet/sample/win32/dhcp_discover/CVS/Root +1 -0
- data/libnet/sample/win32/dhcp_discover/dhcp_discover.vcproj +139 -0
- data/libnet/sample/win32/dns/CVS/Entries +2 -0
- data/libnet/sample/win32/dns/CVS/Repository +1 -0
- data/libnet/sample/win32/dns/CVS/Root +1 -0
- data/libnet/sample/win32/dns/dns.vcproj +139 -0
- data/libnet/sample/win32/get_addr/CVS/Entries +2 -0
- data/libnet/sample/win32/get_addr/CVS/Repository +1 -0
- data/libnet/sample/win32/get_addr/CVS/Root +1 -0
- data/libnet/sample/win32/get_addr/get_addr.vcproj +139 -0
- data/libnet/sample/win32/getopt.c +121 -0
- data/libnet/sample/win32/icmp_echo_cq/CVS/Entries +2 -0
- data/libnet/sample/win32/icmp_echo_cq/CVS/Repository +1 -0
- data/libnet/sample/win32/icmp_echo_cq/CVS/Root +1 -0
- data/libnet/sample/win32/icmp_echo_cq/icmp_echo_cq.vcproj +139 -0
- data/libnet/sample/win32/tcp1/CVS/Entries +2 -0
- data/libnet/sample/win32/tcp1/CVS/Repository +1 -0
- data/libnet/sample/win32/tcp1/CVS/Root +1 -0
- data/libnet/sample/win32/tcp1/tcp1.vcproj +142 -0
- data/libnet/sample/win32/udp1/CVS/Entries +3 -0
- data/libnet/sample/win32/udp1/CVS/Repository +1 -0
- data/libnet/sample/win32/udp1/CVS/Root +1 -0
- data/libnet/sample/win32/udp1/dns.vcproj +125 -0
- data/libnet/sample/win32/udp1/udp1.vcproj +139 -0
- data/libnet/src/CVS/Entries +60 -0
- data/libnet/src/CVS/Repository +1 -0
- data/libnet/src/CVS/Root +1 -0
- data/libnet/src/Makefile.am +71 -0
- data/libnet/src/Makefile.in +428 -0
- data/libnet/src/libnet_advanced.c +136 -0
- data/libnet/src/libnet_asn1.c +436 -0
- data/libnet/src/libnet_build_802.1q.c +115 -0
- data/libnet/src/libnet_build_802.1x.c +103 -0
- data/libnet/src/libnet_build_802.2.c +167 -0
- data/libnet/src/libnet_build_802.3.c +101 -0
- data/libnet/src/libnet_build_arp.c +169 -0
- data/libnet/src/libnet_build_bgp.c +350 -0
- data/libnet/src/libnet_build_cdp.c +191 -0
- data/libnet/src/libnet_build_data.c +90 -0
- data/libnet/src/libnet_build_dhcp.c +156 -0
- data/libnet/src/libnet_build_dns.c +129 -0
- data/libnet/src/libnet_build_ethernet.c +173 -0
- data/libnet/src/libnet_build_fddi.c +191 -0
- data/libnet/src/libnet_build_gre.c +427 -0
- data/libnet/src/libnet_build_icmp.c +437 -0
- data/libnet/src/libnet_build_igmp.c +112 -0
- data/libnet/src/libnet_build_ip.c +892 -0
- data/libnet/src/libnet_build_ipsec.c +232 -0
- data/libnet/src/libnet_build_isl.c +113 -0
- data/libnet/src/libnet_build_link.c +90 -0
- data/libnet/src/libnet_build_mpls.c +112 -0
- data/libnet/src/libnet_build_ntp.c +121 -0
- data/libnet/src/libnet_build_ospf.c +699 -0
- data/libnet/src/libnet_build_rip.c +108 -0
- data/libnet/src/libnet_build_rpc.c +138 -0
- data/libnet/src/libnet_build_sebek.c +108 -0
- data/libnet/src/libnet_build_snmp.c +52 -0
- data/libnet/src/libnet_build_stp.c +222 -0
- data/libnet/src/libnet_build_tcp.c +365 -0
- data/libnet/src/libnet_build_token_ring.c +193 -0
- data/libnet/src/libnet_build_udp.c +111 -0
- data/libnet/src/libnet_build_vrrp.c +117 -0
- data/libnet/src/libnet_checksum.c +376 -0
- data/libnet/src/libnet_cq.c +395 -0
- data/libnet/src/libnet_crc.c +113 -0
- data/libnet/src/libnet_dll.c +47 -0
- data/libnet/src/libnet_error.c +55 -0
- data/libnet/src/libnet_if_addr.c +415 -0
- data/libnet/src/libnet_init.c +234 -0
- data/libnet/src/libnet_internal.c +310 -0
- data/libnet/src/libnet_link_bpf.c +348 -0
- data/libnet/src/libnet_link_dlpi.c +785 -0
- data/libnet/src/libnet_link_linux.c +310 -0
- data/libnet/src/libnet_link_nit.c +125 -0
- data/libnet/src/libnet_link_none.c +66 -0
- data/libnet/src/libnet_link_pf.c +179 -0
- data/libnet/src/libnet_link_snit.c +149 -0
- data/libnet/src/libnet_link_snoop.c +166 -0
- data/libnet/src/libnet_link_win32.c +346 -0
- data/libnet/src/libnet_pblock.c +511 -0
- data/libnet/src/libnet_port_list.c +295 -0
- data/libnet/src/libnet_prand.c +106 -0
- data/libnet/src/libnet_raw.c +257 -0
- data/libnet/src/libnet_resolve.c +414 -0
- data/libnet/src/libnet_version.c +54 -0
- data/libnet/src/libnet_write.c +502 -0
- data/libnet/version.h.in +6 -0
- data/libnet/win32/CVS/Entries +15 -0
- data/libnet/win32/CVS/Repository +1 -0
- data/libnet/win32/CVS/Root +1 -0
- data/libnet/win32/Libnet-1.1.1-2002.sln +77 -0
- data/libnet/win32/Libnet-1.1.1-2003.ncb +0 -0
- data/libnet/win32/Libnet-1.1.1-2003.sln +84 -0
- data/libnet/win32/Libnet-1.1.1-2003.suo +0 -0
- data/libnet/win32/Libnet-1.1.1.vcproj +311 -0
- data/libnet/win32/Libnet-latest.ncb +0 -0
- data/libnet/win32/Libnet-latest.opt +0 -0
- data/libnet/win32/Libnet-latest.sln +77 -0
- data/libnet/win32/Libnet-latest.suo +0 -0
- data/libnet/win32/Libnet-latest.vcproj +311 -0
- data/libnet/win32/Libnet.dsp +337 -0
- data/libnet/win32/Libnet.dsw +32 -0
- data/libnet/win32/README.txt +57 -0
- data/libnet/win32/libnet_dll.def +164 -0
- data/test/tc_arp.rb +169 -0
- data/test/tc_class.rb +219 -0
- data/test/tc_ethernet.rb +97 -0
- data/test/tc_header.rb +163 -0
- data/test/tc_init.rb +25 -0
- data/test/tc_ipv4.rb +219 -0
- data/test/tc_ipv6.rb +235 -0
- data/test/tc_udp.rb +229 -0
- data/test/tc_vlan.rb +118 -0
- data/test/ts_all.rb +15 -0
- metadata +401 -0
@@ -0,0 +1,186 @@
|
|
1
|
+
/*
|
2
|
+
* $Id: libnet-macros.h,v 1.6 2004/03/01 20:26:12 mike Exp $
|
3
|
+
*
|
4
|
+
* libnet-macros.h - Network routine library macro header file
|
5
|
+
*
|
6
|
+
* Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com>
|
7
|
+
* All rights reserved.
|
8
|
+
*
|
9
|
+
* Redistribution and use in source and binary forms, with or without
|
10
|
+
* modification, are permitted provided that the following conditions
|
11
|
+
* are met:
|
12
|
+
* 1. Redistributions of source code must retain the above copyright
|
13
|
+
* notice, this list of conditions and the following disclaimer.
|
14
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
* notice, this list of conditions and the following disclaimer in the
|
16
|
+
* documentation and/or other materials provided with the distribution.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
22
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
24
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
25
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
27
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
28
|
+
* SUCH DAMAGE.
|
29
|
+
*
|
30
|
+
*/
|
31
|
+
|
32
|
+
#ifndef __LIBNET_MACROS_H
|
33
|
+
#define __LIBNET_MACROS_H
|
34
|
+
/**
|
35
|
+
* @file libnet-macros.h
|
36
|
+
* @brief libnet macros and symbloc constants
|
37
|
+
*/
|
38
|
+
|
39
|
+
/* for systems without snprintf */
|
40
|
+
#if defined(NO_SNPRINTF)
|
41
|
+
#define snprintf(buf, len, args...) sprintf(buf, ##args)
|
42
|
+
#endif
|
43
|
+
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Used for libnet's name resolution functions, specifies that no DNS lookups
|
47
|
+
* should be performed and the IP address should be kept in numeric form.
|
48
|
+
*/
|
49
|
+
#define LIBNET_DONT_RESOLVE 0
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Used for libnet's name resolution functions, specifies that a DNS lookup
|
53
|
+
* can be performed if needed to resolve the IP address to a canonical form.
|
54
|
+
*/
|
55
|
+
#define LIBNET_RESOLVE 1
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Used several places, to specify "on" or "one"
|
59
|
+
*/
|
60
|
+
#define LIBNET_ON 0
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Used several places, to specify "on" or "one"
|
64
|
+
*/
|
65
|
+
#define LIBNET_OFF 1
|
66
|
+
|
67
|
+
/**
|
68
|
+
* IPv6 error code
|
69
|
+
*/
|
70
|
+
#ifndef IN6ADDR_ERROR_INIT
|
71
|
+
#define IN6ADDR_ERROR_INIT { { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
72
|
+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
73
|
+
0xff, 0xff } } }
|
74
|
+
#endif
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Used for libnet_get_prand() to specify function disposition
|
78
|
+
*/
|
79
|
+
#define LIBNET_PR2 0
|
80
|
+
#define LIBNET_PR8 1
|
81
|
+
#define LIBNET_PR16 2
|
82
|
+
#define LIBNET_PRu16 3
|
83
|
+
#define LIBNET_PR32 4
|
84
|
+
#define LIBNET_PRu32 5
|
85
|
+
#define LIBNET_PRAND_MAX 0xffffffff
|
86
|
+
|
87
|
+
/**
|
88
|
+
* The biggest an IP packet can be -- 65,535 bytes.
|
89
|
+
*/
|
90
|
+
#define LIBNET_MAX_PACKET 0xffff
|
91
|
+
#ifndef IP_MAXPACKET
|
92
|
+
#define IP_MAXPACKET 0xffff
|
93
|
+
#endif
|
94
|
+
|
95
|
+
|
96
|
+
/* ethernet addresses are 6 octets long */
|
97
|
+
#ifndef ETHER_ADDR_LEN
|
98
|
+
#define ETHER_ADDR_LEN 0x6
|
99
|
+
#endif
|
100
|
+
|
101
|
+
/* FDDI addresses are 6 octets long */
|
102
|
+
#ifndef FDDI_ADDR_LEN
|
103
|
+
#define FDDI_ADDR_LEN 0x6
|
104
|
+
#endif
|
105
|
+
|
106
|
+
/* token ring addresses are 6 octets long */
|
107
|
+
#ifndef TOKEN_RING_ADDR_LEN
|
108
|
+
#define TOKEN_RING_ADDR_LEN 0x6
|
109
|
+
#endif
|
110
|
+
|
111
|
+
/* LLC Organization Code is 3 bytes long */
|
112
|
+
#define LIBNET_ORG_CODE_SIZE 0x3
|
113
|
+
|
114
|
+
/**
|
115
|
+
* The libnet error buffer is 256 bytes long.
|
116
|
+
*/
|
117
|
+
#define LIBNET_ERRBUF_SIZE 0x100
|
118
|
+
|
119
|
+
/**
|
120
|
+
* IP and TCP options can be up to 40 bytes long.
|
121
|
+
*/
|
122
|
+
#define LIBNET_MAXOPTION_SIZE 0x28
|
123
|
+
|
124
|
+
/* some BSD variants have this endianess problem */
|
125
|
+
#if (LIBNET_BSD_BYTE_SWAP)
|
126
|
+
#define FIX(n) ntohs(n)
|
127
|
+
#define UNFIX(n) htons(n)
|
128
|
+
#else
|
129
|
+
#define FIX(n) (n)
|
130
|
+
#define UNFIX(n) (n)
|
131
|
+
#endif
|
132
|
+
|
133
|
+
/* used internally for checksum stuff */
|
134
|
+
#define LIBNET_CKSUM_CARRY(x) \
|
135
|
+
(x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff))
|
136
|
+
|
137
|
+
/* used interally for OSPF stuff */
|
138
|
+
#define LIBNET_OSPF_AUTHCPY(x, y) \
|
139
|
+
memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))
|
140
|
+
#define LIBNET_OSPF_CKSUMBUF(x, y) \
|
141
|
+
memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))
|
142
|
+
|
143
|
+
/* used internally for NTP leap indicator, version, and mode */
|
144
|
+
#define LIBNET_NTP_DO_LI_VN_MODE(li, vn, md) \
|
145
|
+
((u_int8_t)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7)))
|
146
|
+
|
147
|
+
/* Not all systems have IFF_LOOPBACK */
|
148
|
+
#ifdef IFF_LOOPBACK
|
149
|
+
#define LIBNET_ISLOOPBACK(p) ((p)->ifr_flags & IFF_LOOPBACK)
|
150
|
+
#else
|
151
|
+
#define LIBNET_ISLOOPBACK(p) (strcmp((p)->ifr_name, "lo0") == 0)
|
152
|
+
#endif
|
153
|
+
|
154
|
+
/* advanced mode check */
|
155
|
+
#define LIBNET_ISADVMODE(x) (x & 0x08)
|
156
|
+
|
157
|
+
/* context queue macros and constants */
|
158
|
+
#define LIBNET_LABEL_SIZE 64
|
159
|
+
#define LIBNET_LABEL_DEFAULT "cardshark"
|
160
|
+
#define CQ_LOCK_UNLOCKED (u_int)0x00000000
|
161
|
+
#define CQ_LOCK_READ (u_int)0x00000001
|
162
|
+
#define CQ_LOCK_WRITE (u_int)0x00000002
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Provides an interface to iterate through the context queue of libnet
|
166
|
+
* contexts. Before calling this macro, be sure to set the queue using
|
167
|
+
* libnet_cq_head().
|
168
|
+
*/
|
169
|
+
#define for_each_context_in_cq(l) \
|
170
|
+
for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next())
|
171
|
+
|
172
|
+
/* return 1 if write lock is set on cq */
|
173
|
+
#define cq_is_wlocked() (l_cqd.cq_lock & CQ_LOCK_WRITE)
|
174
|
+
|
175
|
+
/* return 1 if read lock is set on cq */
|
176
|
+
#define cq_is_rlocked() (l_cqd.cq_lock & CQ_LOCK_READ)
|
177
|
+
|
178
|
+
/* return 1 if any lock is set on cq */
|
179
|
+
#define cq_is_locked() (l_cqd.cq_lock & (CQ_LOCK_READ | CQ_LOCK_WRITE))
|
180
|
+
|
181
|
+
/* check if a context queue is locked */
|
182
|
+
#define check_cq_lock(x) (l_cqd.cq_lock & x)
|
183
|
+
|
184
|
+
#endif /* __LIBNET_MACROS_H */
|
185
|
+
|
186
|
+
/* EOF */
|
@@ -0,0 +1,222 @@
|
|
1
|
+
/*
|
2
|
+
* $Id: libnet-structures.h,v 1.18 2004/03/16 18:40:58 mike Exp $
|
3
|
+
*
|
4
|
+
* libnet-structures.h - Network routine library structures header file
|
5
|
+
*
|
6
|
+
* Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com>
|
7
|
+
* All rights reserved.
|
8
|
+
*
|
9
|
+
* Redistribution and use in source and binary forms, with or without
|
10
|
+
* modification, are permitted provided that the following conditions
|
11
|
+
* are met:
|
12
|
+
* 1. Redistributions of source code must retain the above copyright
|
13
|
+
* notice, this list of conditions and the following disclaimer.
|
14
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
* notice, this list of conditions and the following disclaimer in the
|
16
|
+
* documentation and/or other materials provided with the distribution.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
22
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
24
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
25
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
27
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
28
|
+
* SUCH DAMAGE.
|
29
|
+
*
|
30
|
+
*/
|
31
|
+
|
32
|
+
#ifndef __LIBNET_STRUCTURES_H
|
33
|
+
#define __LIBNET_STRUCTURES_H
|
34
|
+
|
35
|
+
#if ((__WIN32__) && !(__CYGWIN__))
|
36
|
+
#include "Packet32.h"
|
37
|
+
#endif
|
38
|
+
|
39
|
+
/* port list chain structure */
|
40
|
+
typedef struct libnet_port_list_chain libnet_plist_t;
|
41
|
+
struct libnet_port_list_chain
|
42
|
+
{
|
43
|
+
u_int16_t node; /* node number */
|
44
|
+
u_int16_t bport; /* beggining port */
|
45
|
+
u_int16_t eport; /* terminating port */
|
46
|
+
u_int8_t id; /* global array offset */
|
47
|
+
libnet_plist_t *next; /* next node in the list */
|
48
|
+
};
|
49
|
+
|
50
|
+
|
51
|
+
/* libnet statistics structure */
|
52
|
+
struct libnet_stats
|
53
|
+
{
|
54
|
+
#if (!defined(__WIN32__) || (__CYGWIN__))
|
55
|
+
u_int64_t packets_sent; /* packets sent */
|
56
|
+
u_int64_t packet_errors; /* packets errors */
|
57
|
+
u_int64_t bytes_written; /* bytes written */
|
58
|
+
#else
|
59
|
+
__int64 packets_sent; /* packets sent */
|
60
|
+
__int64 packet_errors; /* packets errors */
|
61
|
+
__int64 bytes_written; /* bytes written */
|
62
|
+
#endif
|
63
|
+
};
|
64
|
+
|
65
|
+
|
66
|
+
/*
|
67
|
+
* Libnet ptags are how we identify specific protocol blocks inside the
|
68
|
+
* list.
|
69
|
+
*/
|
70
|
+
typedef int32_t libnet_ptag_t;
|
71
|
+
#define LIBNET_PTAG_INITIALIZER 0
|
72
|
+
|
73
|
+
|
74
|
+
/*
|
75
|
+
* Libnet generic protocol block memory object. Sort of a poor man's mbuf.
|
76
|
+
*/
|
77
|
+
struct libnet_protocol_block
|
78
|
+
{
|
79
|
+
u_int8_t *buf; /* protocol buffer */
|
80
|
+
u_int32_t b_len; /* length of buf */
|
81
|
+
u_int16_t h_len; /* header length (for checksumming) */
|
82
|
+
u_int32_t ip_offset; /* offset to IP header for csums */
|
83
|
+
u_int32_t copied; /* bytes copied */
|
84
|
+
u_int8_t type; /* type of pblock */
|
85
|
+
/* this needs to be updated every time a new packet builder is added */
|
86
|
+
#define LIBNET_PBLOCK_ARP_H 0x01 /* ARP header */
|
87
|
+
#define LIBNET_PBLOCK_DHCPV4_H 0x02 /* DHCP v4 header */
|
88
|
+
#define LIBNET_PBLOCK_DNSV4_H 0x03 /* DNS v4 header */
|
89
|
+
#define LIBNET_PBLOCK_ETH_H 0x04 /* Ethernet header */
|
90
|
+
#define LIBNET_PBLOCK_ICMPV4_H 0x05 /* ICMP v4 base header */
|
91
|
+
#define LIBNET_PBLOCK_ICMPV4_ECHO_H 0x06 /* ICMP v4 echo header */
|
92
|
+
#define LIBNET_PBLOCK_ICMPV4_MASK_H 0x07 /* ICMP v4 mask header */
|
93
|
+
#define LIBNET_PBLOCK_ICMPV4_UNREACH_H 0x08 /* ICMP v4 unreach header */
|
94
|
+
#define LIBNET_PBLOCK_ICMPV4_TIMXCEED_H 0x09 /* ICMP v4 exceed header */
|
95
|
+
#define LIBNET_PBLOCK_ICMPV4_REDIRECT_H 0x0a /* ICMP v4 redirect header */
|
96
|
+
#define LIBNET_PBLOCK_ICMPV4_TS_H 0x0b /* ICMP v4 timestamp header */
|
97
|
+
#define LIBNET_PBLOCK_IGMP_H 0x0c /* IGMP header */
|
98
|
+
#define LIBNET_PBLOCK_IPV4_H 0x0d /* IP v4 header */
|
99
|
+
#define LIBNET_PBLOCK_IPO_H 0x0e /* IP v4 options */
|
100
|
+
#define LIBNET_PBLOCK_IPDATA 0x0f /* IP data */
|
101
|
+
#define LIBNET_PBLOCK_OSPF_H 0x10 /* OSPF base header */
|
102
|
+
#define LIBNET_PBLOCK_OSPF_HELLO_H 0x11 /* OSPF hello header */
|
103
|
+
#define LIBNET_PBLOCK_OSPF_DBD_H 0x12 /* OSPF dbd header */
|
104
|
+
#define LIBNET_PBLOCK_OSPF_LSR_H 0x13 /* OSPF lsr header */
|
105
|
+
#define LIBNET_PBLOCK_OSPF_LSU_H 0x14 /* OSPF lsu header */
|
106
|
+
#define LIBNET_PBLOCK_OSPF_LSA_H 0x15 /* OSPF lsa header */
|
107
|
+
#define LIBNET_PBLOCK_OSPF_AUTH_H 0x16 /* OSPF auth header */
|
108
|
+
#define LIBNET_PBLOCK_OSPF_CKSUM 0x17 /* OSPF checksum header */
|
109
|
+
#define LIBNET_PBLOCK_LS_RTR_H 0x18 /* linkstate rtr header */
|
110
|
+
#define LIBNET_PBLOCK_LS_NET_H 0x19 /* linkstate net header */
|
111
|
+
#define LIBNET_PBLOCK_LS_SUM_H 0x1a /* linkstate as sum header */
|
112
|
+
#define LIBNET_PBLOCK_LS_AS_EXT_H 0x1b /* linkstate as ext header */
|
113
|
+
#define LIBNET_PBLOCK_NTP_H 0x1c /* NTP header */
|
114
|
+
#define LIBNET_PBLOCK_RIP_H 0x1d /* RIP header */
|
115
|
+
#define LIBNET_PBLOCK_TCP_H 0x1e /* TCP header */
|
116
|
+
#define LIBNET_PBLOCK_TCPO_H 0x1f /* TCP options */
|
117
|
+
#define LIBNET_PBLOCK_TCPDATA 0x20 /* TCP data */
|
118
|
+
#define LIBNET_PBLOCK_UDP_H 0x21 /* UDP header */
|
119
|
+
#define LIBNET_PBLOCK_VRRP_H 0x22 /* VRRP header */
|
120
|
+
#define LIBNET_PBLOCK_DATA_H 0x23 /* generic data */
|
121
|
+
#define LIBNET_PBLOCK_CDP_H 0x24 /* CDP header */
|
122
|
+
#define LIBNET_PBLOCK_IPSEC_ESP_HDR_H 0x25 /* IPSEC ESP header */
|
123
|
+
#define LIBNET_PBLOCK_IPSEC_ESP_FTR_H 0x26 /* IPSEC ESP footer */
|
124
|
+
#define LIBNET_PBLOCK_IPSEC_AH_H 0x27 /* IPSEC AH header */
|
125
|
+
#define LIBNET_PBLOCK_802_1Q_H 0x28 /* 802.1q header */
|
126
|
+
#define LIBNET_PBLOCK_802_2_H 0x29 /* 802.2 header */
|
127
|
+
#define LIBNET_PBLOCK_802_2SNAP_H 0x2a /* 802.2 SNAP header */
|
128
|
+
#define LIBNET_PBLOCK_802_3_H 0x2b /* 802.3 header */
|
129
|
+
#define LIBNET_PBLOCK_STP_CONF_H 0x2c /* STP configuration header */
|
130
|
+
#define LIBNET_PBLOCK_STP_TCN_H 0x2d /* STP TCN header */
|
131
|
+
#define LIBNET_PBLOCK_ISL_H 0x2e /* ISL header */
|
132
|
+
#define LIBNET_PBLOCK_IPV6_H 0x2f /* IP v6 header */
|
133
|
+
#define LIBNET_PBLOCK_802_1X_H 0x30 /* 802.1x header */
|
134
|
+
#define LIBNET_PBLOCK_RPC_CALL_H 0x31 /* RPC Call header */
|
135
|
+
#define LIBNET_PBLOCK_MPLS_H 0x32 /* MPLS header */
|
136
|
+
#define LIBNET_PBLOCK_FDDI_H 0x33 /* FDDI header */
|
137
|
+
#define LIBNET_PBLOCK_TOKEN_RING_H 0x34 /* TOKEN RING header */
|
138
|
+
#define LIBNET_PBLOCK_BGP4_HEADER_H 0x35 /* BGP4 header */
|
139
|
+
#define LIBNET_PBLOCK_BGP4_OPEN_H 0x36 /* BGP4 open header */
|
140
|
+
#define LIBNET_PBLOCK_BGP4_UPDATE_H 0x37 /* BGP4 update header */
|
141
|
+
#define LIBNET_PBLOCK_BGP4_NOTIFICATION_H 0x38 /* BGP4 notification header */
|
142
|
+
#define LIBNET_PBLOCK_GRE_H 0x39 /* GRE header */
|
143
|
+
#define LIBNET_PBLOCK_GRE_SRE_H 0x3a /* GRE SRE header */
|
144
|
+
#define LIBNET_PBLOCK_IPV6_FRAG_H 0x3b /* IPv6 frag header */
|
145
|
+
#define LIBNET_PBLOCK_IPV6_ROUTING_H 0x3c /* IPv6 routing header */
|
146
|
+
#define LIBNET_PBLOCK_IPV6_DESTOPTS_H 0x3d /* IPv6 dest opts header */
|
147
|
+
#define LIBNET_PBLOCK_IPV6_HBHOPTS_H 0x3e /* IPv6 hop/hop opts header */
|
148
|
+
#define LIBNET_PBLOCK_SEBEK_H 0x3f /* Sebek header */
|
149
|
+
u_int8_t flags; /* control flags */
|
150
|
+
#define LIBNET_PBLOCK_DO_CHECKSUM 0x01 /* needs a checksum */
|
151
|
+
libnet_ptag_t ptag; /* protocol block tag */
|
152
|
+
struct libnet_protocol_block *next; /* next pblock */
|
153
|
+
struct libnet_protocol_block *prev; /* prev pblock */
|
154
|
+
};
|
155
|
+
typedef struct libnet_protocol_block libnet_pblock_t;
|
156
|
+
|
157
|
+
|
158
|
+
/*
|
159
|
+
* Libnet context
|
160
|
+
* Opaque structure. Nothing in here should ever been touched first hand by
|
161
|
+
* the applications programmer.
|
162
|
+
*/
|
163
|
+
struct libnet_context
|
164
|
+
{
|
165
|
+
#if ((__WIN32__) && !(__CYGWIN__))
|
166
|
+
SOCKET fd;
|
167
|
+
LPADAPTER lpAdapter;
|
168
|
+
#else
|
169
|
+
int fd; /* file descriptor of packet device */
|
170
|
+
#endif
|
171
|
+
int injection_type; /* raw (ipv4 or ipv6) or link */
|
172
|
+
#define LIBNET_LINK 0x00 /* link-layer interface */
|
173
|
+
#define LIBNET_RAW4 0x01 /* raw socket interface (ipv4) */
|
174
|
+
#define LIBNET_RAW6 0x02 /* raw socket interface (ipv6) */
|
175
|
+
/* the following should actually set a flag in the flags variable above */
|
176
|
+
#define LIBNET_LINK_ADV 0x08 /* advanced mode link-layer */
|
177
|
+
#define LIBNET_RAW4_ADV 0x09 /* advanced mode raw socket (ipv4) */
|
178
|
+
#define LIBNET_RAW6_ADV 0x0a /* advanced mode raw socket (ipv6) */
|
179
|
+
#define LIBNET_ADV_MASK 0x08 /* mask to determine adv mode */
|
180
|
+
|
181
|
+
libnet_pblock_t *protocol_blocks; /* protocol headers / data */
|
182
|
+
libnet_pblock_t *pblock_end; /* last node in list */
|
183
|
+
u_int32_t n_pblocks; /* number of pblocks */
|
184
|
+
|
185
|
+
int link_type; /* link-layer type */
|
186
|
+
int link_offset; /* link-layer header size */
|
187
|
+
int aligner; /* used to align packets */
|
188
|
+
char *device; /* device name */
|
189
|
+
|
190
|
+
struct libnet_stats stats; /* statistics */
|
191
|
+
libnet_ptag_t ptag_state; /* state holder for pblock tag */
|
192
|
+
char label[LIBNET_LABEL_SIZE]; /* textual label for cq interface */
|
193
|
+
|
194
|
+
char err_buf[LIBNET_ERRBUF_SIZE]; /* error buffer */
|
195
|
+
u_int32_t total_size; /* total size */
|
196
|
+
};
|
197
|
+
typedef struct libnet_context libnet_t;
|
198
|
+
|
199
|
+
/*
|
200
|
+
* Libnet context queue structure
|
201
|
+
* Opaque structure. Nothing in here should ever been touched first hand by
|
202
|
+
* the applications programmer.
|
203
|
+
*/
|
204
|
+
typedef struct _libnet_context_queue libnet_cq_t;
|
205
|
+
struct _libnet_context_queue
|
206
|
+
{
|
207
|
+
libnet_t *context; /* pointer to libnet context */
|
208
|
+
libnet_cq_t *next; /* next node in the list */
|
209
|
+
libnet_cq_t *prev; /* previous node in the list */
|
210
|
+
};
|
211
|
+
|
212
|
+
struct _libnet_context_queue_descriptor
|
213
|
+
{
|
214
|
+
u_int32_t node; /* number of nodes in the list */
|
215
|
+
u_int32_t cq_lock; /* lock status */
|
216
|
+
libnet_cq_t *current; /* current context */
|
217
|
+
};
|
218
|
+
typedef struct _libnet_context_queue_descriptor libnet_cqd_t;
|
219
|
+
|
220
|
+
#endif /* __LIBNET_STRUCTURES_H */
|
221
|
+
|
222
|
+
/* EOF */
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*
|
2
|
+
* $Id: libnet-types.h,v 1.3 2004/01/03 20:31:00 mike Exp $
|
3
|
+
*
|
4
|
+
* libnet-types.h - Network routine library macro header file
|
5
|
+
*
|
6
|
+
* Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com>
|
7
|
+
* All rights reserved.
|
8
|
+
*
|
9
|
+
* Redistribution and use in source and binary forms, with or without
|
10
|
+
* modification, are permitted provided that the following conditions
|
11
|
+
* are met:
|
12
|
+
* 1. Redistributions of source code must retain the above copyright
|
13
|
+
* notice, this list of conditions and the following disclaimer.
|
14
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
* notice, this list of conditions and the following disclaimer in the
|
16
|
+
* documentation and/or other materials provided with the distribution.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
22
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
24
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
25
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
27
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
28
|
+
* SUCH DAMAGE.
|
29
|
+
*
|
30
|
+
*/
|
31
|
+
|
32
|
+
#ifndef __LIBNET_TYPES_H
|
33
|
+
#define __LIBNET_TYPES_H
|
34
|
+
|
35
|
+
/* Solaris has messed up POSIX nomenclature for these */
|
36
|
+
#if (__sun__ && __svr4__)
|
37
|
+
typedef uint8_t u_int8_t;
|
38
|
+
typedef uint16_t u_int16_t;
|
39
|
+
typedef uint32_t u_int32_t;
|
40
|
+
typedef uint64_t u_int64_t;
|
41
|
+
#endif
|
42
|
+
|
43
|
+
#endif /* __LIBNET_TYPES_H */
|
44
|
+
|
45
|
+
/* EOF */
|
@@ -0,0 +1,132 @@
|
|
1
|
+
/*
|
2
|
+
* $Id: libnet.h.in,v 1.5 2004/01/17 07:51:19 mike Exp $
|
3
|
+
*
|
4
|
+
* libnet.h - Network routine library header file
|
5
|
+
*
|
6
|
+
* Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com>
|
7
|
+
* All rights reserved.
|
8
|
+
*
|
9
|
+
* Redistribution and use in source and binary forms, with or without
|
10
|
+
* modification, are permitted provided that the following conditions
|
11
|
+
* are met:
|
12
|
+
* 1. Redistributions of source code must retain the above copyright
|
13
|
+
* notice, this list of conditions and the following disclaimer.
|
14
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
* notice, this list of conditions and the following disclaimer in the
|
16
|
+
* documentation and/or other materials provided with the distribution.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
22
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
24
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
25
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
27
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
28
|
+
* SUCH DAMAGE.
|
29
|
+
*
|
30
|
+
*/
|
31
|
+
|
32
|
+
#ifndef __LIBNET_H
|
33
|
+
#define __LIBNET_H
|
34
|
+
/**
|
35
|
+
* @file libnet.h
|
36
|
+
* @brief toplevel libnet header file
|
37
|
+
*/
|
38
|
+
|
39
|
+
/**
|
40
|
+
* @mainpage Libnet Packet Assembly Library
|
41
|
+
*
|
42
|
+
* @section intro Overview
|
43
|
+
*
|
44
|
+
* Libnet is a high-level API (toolkit) allowing the application programmer to
|
45
|
+
* construct and inject network packets. It provides a portable and simplified
|
46
|
+
* interface for low-level network packet shaping, handling and injection.
|
47
|
+
* Libnet hides much of the tedium of packet creation from the application
|
48
|
+
* programmer such as multiplexing, buffer management, arcane packet header
|
49
|
+
* information, byte-ordering, OS-dependent issues, and much more. Libnet
|
50
|
+
* features portable packet creation interfaces at the IP layer and link layer,
|
51
|
+
* as well as a host of supplementary and complementary functionality. Using
|
52
|
+
* libnet, quick and simple packet assembly applications can be whipped up with
|
53
|
+
* little effort. With a bit more time, more complex programs can be written
|
54
|
+
* (Traceroute and ping were easily rewritten using libnet and
|
55
|
+
* <a href="www.tcpdump.org">libpcap</a>).
|
56
|
+
*/
|
57
|
+
|
58
|
+
#ifdef __cplusplus
|
59
|
+
extern "C" {
|
60
|
+
#endif
|
61
|
+
|
62
|
+
#define _GNU_SOURCE
|
63
|
+
#include <stdio.h>
|
64
|
+
#include <string.h>
|
65
|
+
#include <unistd.h>
|
66
|
+
#include <fcntl.h>
|
67
|
+
#include <signal.h>
|
68
|
+
#include <stdlib.h>
|
69
|
+
#if !defined(__WIN32__)
|
70
|
+
#include <sys/ioctl.h>
|
71
|
+
#endif /* __WIN32__ */
|
72
|
+
#if defined(HAVE_SYS_SOCKIO_H) && !defined(SIOCGIFADDR)
|
73
|
+
#include <sys/sockio.h>
|
74
|
+
#endif
|
75
|
+
#include <sys/stat.h>
|
76
|
+
#include <sys/types.h>
|
77
|
+
#include <ctype.h>
|
78
|
+
#if !defined(__WIN32__)
|
79
|
+
#include <sys/socket.h>
|
80
|
+
#include <netinet/in.h>
|
81
|
+
#include <netinet/in_systm.h>
|
82
|
+
#include <netinet/ip.h>
|
83
|
+
#include <net/if.h>
|
84
|
+
#else /* __WIN32__ */
|
85
|
+
#if (__CYGWIN__)
|
86
|
+
#include <sys/socket.h>
|
87
|
+
#endif
|
88
|
+
#include <ws2tcpip.h>
|
89
|
+
#include <windows.h>
|
90
|
+
#include <winsock2.h>
|
91
|
+
#include <win32/in_systm.h>
|
92
|
+
#endif /* __WIN32__ */
|
93
|
+
#if !(__linux__) && !(__WIN32__) && !(__APPLE__) && !(__CYGWIN__)
|
94
|
+
#include <netinet/ip_var.h>
|
95
|
+
#else /* __linux__ */
|
96
|
+
#if (HAVE_NET_ETHERNET_H)
|
97
|
+
#include <net/ethernet.h>
|
98
|
+
#endif /* HAVE_NET_ETHERNET_H */
|
99
|
+
#endif /* __linux__ */
|
100
|
+
#if !defined(__WIN32__)
|
101
|
+
#include <netinet/tcp.h>
|
102
|
+
#include <netinet/udp.h>
|
103
|
+
#if (__linux__) && !(__GLIBC__)
|
104
|
+
/* we get multiple definitions of IGMP_AGE_THRESHOLD if we include netinet */
|
105
|
+
#include <linux/igmp.h>
|
106
|
+
#else
|
107
|
+
#include <netinet/igmp.h>
|
108
|
+
#endif
|
109
|
+
#include <arpa/inet.h>
|
110
|
+
#include <sys/time.h>
|
111
|
+
#include <netdb.h>
|
112
|
+
#endif /* __WIN32__ */
|
113
|
+
#include <errno.h>
|
114
|
+
#include <stdarg.h>
|
115
|
+
|
116
|
+
#define LIBNET_VERSION "@LIBNET_VERSION@"
|
117
|
+
#define @ENDIANESS@ 1
|
118
|
+
|
119
|
+
#include "./libnet/libnet-types.h"
|
120
|
+
#include "./libnet/libnet-macros.h"
|
121
|
+
#include "./libnet/libnet-headers.h"
|
122
|
+
#include "./libnet/libnet-structures.h"
|
123
|
+
#include "./libnet/libnet-asn1.h"
|
124
|
+
#include "./libnet/libnet-functions.h"
|
125
|
+
|
126
|
+
#ifdef __cplusplus
|
127
|
+
}
|
128
|
+
#endif
|
129
|
+
|
130
|
+
#endif /* __LIBNET_H */
|
131
|
+
|
132
|
+
/* EOF */
|
@@ -0,0 +1 @@
|
|
1
|
+
timestamp
|
@@ -0,0 +1 @@
|
|
1
|
+
/usr/local/CVS/libnet/include/win32
|
@@ -0,0 +1 @@
|
|
1
|
+
mike@66.234.207.232:/usr/local/CVS
|