summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
Diffstat (limited to 'sample')
-rw-r--r--sample/Makefile.am178
-rw-r--r--sample/dns.c2
-rw-r--r--sample/isl.c2
-rw-r--r--sample/libnet_test.h35
-rw-r--r--sample/test_ipv6_icmpv4.c5
5 files changed, 130 insertions, 92 deletions
diff --git a/sample/Makefile.am b/sample/Makefile.am
index 62d1ab5..79460d1 100644
--- a/sample/Makefile.am
+++ b/sample/Makefile.am
@@ -1,4 +1,3 @@
-# $Id: Makefile.am,v 1.6 2004/11/09 07:05:07 mike Exp $
#
# Libnet automake information file
# Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com>
@@ -6,80 +5,117 @@
#
# Process this file with automake to produce a Makefile.in script.
-include $(top_srcdir)/Makefile.am.common
+samples = arp \
+ bgp4_hdr \
+ bgp4_open \
+ bgp4_update \
+ bgp4_notification \
+ cdp \
+ dhcp_discover \
+ dns \
+ dot1x \
+ fddi_tcp1 \
+ fddi_tcp2 \
+ get_addr \
+ gre \
+ hsrp \
+ icmp_echo_cq \
+ icmp_redirect \
+ icmp_timeexceed \
+ icmp_timestamp \
+ icmp6_echoreq \
+ icmp_unreach \
+ icmp6_unreach \
+ ieee \
+ ip_link \
+ ip_raw \
+ isl \
+ mpls \
+ ntp \
+ ospf_hello \
+ ospf_lsa \
+ ping_of_death \
+ rpc_tcp \
+ rpc_udp \
+ synflood \
+ synflood6 \
+ sebek \
+ smurf \
+ stp \
+ synflood6_frag \
+ tcp1 \
+ tcp2 \
+ tftp \
+ udp1 \
+ udp2 \
+ test_ipv4 \
+ test_ipv6_icmpv4 \
+ test_ipv4_options \
+ tring_tcp1 \
+ tring_tcp2
-samples = arp cdp dhcp_discover get_addr icmp_timestamp icmp_unreach \
- ieee isl ntp ospf_hello ospf_lsa ping_of_death stp synflood \
- tcp1 tcp2 udp1 udp2 synflood6 \
- icmp6_echoreq \
- icmp6_unreach \
- icmp_echo_cq \
- smurf dot1x dns rpc_tcp rpc_udp mpls icmp_timeexceed \
- fddi_tcp1 fddi_tcp2 tring_tcp1 tring_tcp2 icmp_redirect \
- bgp4_hdr bgp4_open bgp4_update bgp4_notification gre \
- synflood6_frag tftp ip_link ip_raw sebek hsrp \
- test_ipv4 test_ipv6_icmpv4 test_ipv4_options
-if INSTALL_SAMPLES
-bin_PROGRAMS = $(samples)
-else
noinst_PROGRAMS = $(samples)
-endif
-arp_SOURCES = arp.c
-cdp_SOURCES = cdp.c
-dot1x_SOURCES = dot1x.c
-dhcp_discover_SOURCES = dhcp_discover.c
-dns_SOURCES = dns.c
-fddi_tcp1_SOURCES = fddi_tcp1.c
-fddi_tcp2_SOURCES = fddi_tcp2.c
-tring_tcp1_SOURCES = tring_tcp1.c
-tring_tcp2_SOURCES = tring_tcp2.c
-get_addr_SOURCES = get_addr.c
-icmp_echo_cq_SOURCES = icmp_echo_cq.c
-icmp_redirect_SOURCES = icmp_redirect.c
-icmp_timestamp_SOURCES = icmp_timestamp.c
-icmp_timeexceed_SOURCES = icmp_timeexceed.c
-icmp_unreach_SOURCES = icmp_unreach.c
-ieee_SOURCES = ieee.c
-isl_SOURCES = isl.c
-ntp_SOURCES = ntp.c
-ospf_hello_SOURCES = ospf_hello.c
-ospf_lsa_SOURCES = ospf_lsa.c
-ping_of_death_SOURCES = ping_of_death.c
-mpls_SOURCES = mpls.c
-rpc_tcp_SOURCES = rpc_tcp.c
-rpc_udp_SOURCES = rpc_udp.c
-stp_SOURCES = stp.c
-synflood_SOURCES = synflood.c
-tcp1_SOURCES = tcp1.c
-tcp2_SOURCES = tcp2.c
-tftp_SOURCES = tftp.c
-udp1_SOURCES = udp1.c
-udp2_SOURCES = udp2.c
-icmp6_echoreq_SOURCES = icmp6_echoreq.c
-icmp6_unreach_SOURCES = icmp6_unreach.c
-smurf_SOURCES = smurf.c
-synflood6_SOURCES = synflood6.c
-synflood6_frag_SOURCES = synflood6_frag.c
-bgp4_hdr_SOURCES = bgp4_hdr.c
-bgp4_open_SOURCES = bgp4_open.c
-bgp4_update_SOURCES = bgp4_update.c
+arp_SOURCES = arp.c
+bgp4_hdr_SOURCES = bgp4_hdr.c
+bgp4_open_SOURCES = bgp4_open.c
+bgp4_update_SOURCES = bgp4_update.c
bgp4_notification_SOURCES = bgp4_notification.c
-gre_SOURCES = gre.c
-ip_raw_SOURCES = ip_raw.c
-ip_link_SOURCES = ip_link.c
-sebek_SOURCES = sebek.c
-hsrp_SOURCES = hsrp.c
-test_ipv4_SOURCES = test_ipv4.c
+cdp_SOURCES = cdp.c
+dot1x_SOURCES = dot1x.c
+dhcp_discover_SOURCES = dhcp_discover.c
+dns_SOURCES = dns.c
+fddi_tcp1_SOURCES = fddi_tcp1.c
+fddi_tcp2_SOURCES = fddi_tcp2.c
+get_addr_SOURCES = get_addr.c
+gre_SOURCES = gre.c
+hsrp_SOURCES = hsrp.c
+icmp_echo_cq_SOURCES = icmp_echo_cq.c
+icmp_redirect_SOURCES = icmp_redirect.c
+icmp_timestamp_SOURCES = icmp_timestamp.c
+icmp_timeexceed_SOURCES = icmp_timeexceed.c
+icmp_unreach_SOURCES = icmp_unreach.c
+icmp6_echoreq_SOURCES = icmp6_echoreq.c
+icmp6_unreach_SOURCES = icmp6_unreach.c
+ieee_SOURCES = ieee.c
+ip_raw_SOURCES = ip_raw.c
+ip_link_SOURCES = ip_link.c
+isl_SOURCES = isl.c
+mpls_SOURCES = mpls.c
+ntp_SOURCES = ntp.c
+ospf_hello_SOURCES = ospf_hello.c
+ospf_lsa_SOURCES = ospf_lsa.c
+ping_of_death_SOURCES = ping_of_death.c
+rpc_tcp_SOURCES = rpc_tcp.c
+rpc_udp_SOURCES = rpc_udp.c
+sebek_SOURCES = sebek.c
+smurf_SOURCES = smurf.c
+stp_SOURCES = stp.c
+synflood_SOURCES = synflood.c
+synflood6_SOURCES = synflood6.c
+synflood6_frag_SOURCES = synflood6_frag.c
+tcp1_SOURCES = tcp1.c
+tcp2_SOURCES = tcp2.c
+test_ipv4_SOURCES = test_ipv4.c
test_ipv4_options_SOURCES = test_ipv4_options.c
-test_ipv6_icmpv4_SOURCES = test_ipv6_icmpv4.c
+test_ipv6_icmpv4_SOURCES = test_ipv6_icmpv4.c
+tftp_SOURCES = tftp.c
+tring_tcp1_SOURCES = tring_tcp1.c
+tring_tcp2_SOURCES = tring_tcp2.c
+udp1_SOURCES = udp1.c
+udp2_SOURCES = udp2.c
-EXTRA_DIST = libnet_test.h
+LDADD = $(top_builddir)/src/libnet.la
-LDADD = $(top_builddir)/src/libnet.la
-
-EXTRA_DIST += arp-new.c win32/arp/arp.vcproj win32/cdp/cdp.vcproj \
- win32/dhcp_discover/dhcp_discover.vcproj win32/dns/dns.vcproj \
- win32/get_addr/get_addr.vcproj win32/getopt.c \
- win32/icmp_echo_cq/icmp_echo_cq.vcproj win32/tcp1/tcp1.vcproj \
- win32/udp1/dns.vcproj win32/udp1/udp1.vcproj
+EXTRA_DIST = libnet_test.h \
+ arp-new.c \
+ win32/getopt.c \
+ win32/arp/arp.vcproj \
+ win32/cdp/cdp.vcproj \
+ win32/dhcp_discover/dhcp_discover.vcproj \
+ win32/dns/dns.vcproj \
+ win32/get_addr/get_addr.vcproj \
+ win32/icmp_echo_cq/icmp_echo_cq.vcproj \
+ win32/tcp1/tcp1.vcproj \
+ win32/udp1/dns.vcproj \
+ win32/udp1/udp1.vcproj
diff --git a/sample/dns.c b/sample/dns.c
index 6ec4e16..169f332 100644
--- a/sample/dns.c
+++ b/sample/dns.c
@@ -60,7 +60,7 @@ main(int argc, char *argv[])
printf("libnet 1.1 packet shaping: DNSv4[raw]\n");
/*
- * Initialize the library. Root priviledges are required.
+ * Initialize the library. Root privileges are required.
*/
l = libnet_init(
LIBNET_RAW4, /* injection type */
diff --git a/sample/isl.c b/sample/isl.c
index ab5cf3e..278359d 100644
--- a/sample/isl.c
+++ b/sample/isl.c
@@ -73,7 +73,7 @@ main(int argc, char *argv[])
}
/*
- * Initialize the library. Root priviledges are required.
+ * Initialize the library. Root privileges are required.
*/
l = libnet_init(
LIBNET_LINK, /* injection type */
diff --git a/sample/libnet_test.h b/sample/libnet_test.h
index 00e6c54..e7d2323 100644
--- a/sample/libnet_test.h
+++ b/sample/libnet_test.h
@@ -1,6 +1,4 @@
/*
- * $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>
@@ -15,8 +13,7 @@
#include "../include/libnet.h"
-#if (_WIN32) || (__CYGWIN__)
-#else
+#if !defined(__WIN32__)
# include <netinet/in.h>
#endif
@@ -44,21 +41,23 @@ u_char org_code[3] = {0x00, 0x00, 0x00};
void usage(char *);
#if defined(__WIN32__)
-#include <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
+ #include <getopt.h> /* For non-MingW, this is a local libnet/win32/getopt.h */
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+
+ #ifndef _MSC_VER
+ #include <sys/time.h>
+ #endif
+
+// FIXME: weido... see #define LIBNET_API __declspec(dllexport) in win32/libnet.h...
+//#if defined(__GNUC__) /* mingw compiler */
+//extern __attribute__((dllimport)) char *optarg;
+//#else /* assume msvc */
+//extern __dllspec(dllimport) char *optarg;
+//#endif
+
#endif /* __WIN32__ */
#endif /* __LIBNET_TEST_H */
-/* EOF */
+/* EOF */ \ No newline at end of file
diff --git a/sample/test_ipv6_icmpv4.c b/sample/test_ipv6_icmpv4.c
index 704c5ac..03c2222 100644
--- a/sample/test_ipv6_icmpv4.c
+++ b/sample/test_ipv6_icmpv4.c
@@ -33,8 +33,11 @@
#include "./libnet_test.h"
#include <assert.h>
-
+#ifdef _WIN32
+#include <winsock2.h>
+#else
#include <netinet/in.h>
+#endif
static void print_pblocks(libnet_t* l)
{