summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2012-11-27 11:23:39 -0800
committerSam Roberts <vieuxtech@gmail.com>2012-11-27 11:23:39 -0800
commit34748e03d14550671c00f200c8310cc5bda4ee56 (patch)
treeada0497da9fc09922b165cb8b75fb14cdd50ee00
parent1f39883bc656605ecde816fc1f5238ff86b83e53 (diff)
parent0bfd1c210962d38bca5e5f4a8815b5b45e1f69df (diff)
downloadlibnet-34748e03d14550671c00f200c8310cc5bda4ee56.tar.gz
Merge branch 'win32'
Conflicts were in error message formatting, master has removed new lines from end of all error messages. Conflicts: libnet/src/libnet_if_addr.c libnet/src/libnet_link_win32.c libnet/src/libnet_resolve.c
-rw-r--r--.gitignore5
-rw-r--r--libnet/Makefile.am2
-rw-r--r--libnet/README.win3214
-rw-r--r--libnet/configure.in4
-rw-r--r--libnet/include/libnet.h.in4
-rw-r--r--libnet/include/libnet/libnet-functions.h170
-rw-r--r--libnet/include/libnet/libnet-headers.h30
-rw-r--r--libnet/include/win32/in_systm.h77
-rw-r--r--libnet/include/win32/libnet.h26
-rw-r--r--libnet/include/win32/stdint.h247
-rw-r--r--libnet/msvcbuild.bat24
-rw-r--r--libnet/sample/tftp.c2
-rw-r--r--libnet/src/common.h8
-rw-r--r--libnet/src/libnet_build_dns.c2
-rw-r--r--libnet/src/libnet_build_ospf.c8
-rw-r--r--libnet/src/libnet_cq.c4
-rw-r--r--libnet/src/libnet_crc.c2
-rw-r--r--libnet/src/libnet_if_addr.c77
-rw-r--r--libnet/src/libnet_link_win32.c21
-rw-r--r--libnet/src/libnet_pblock.c1
-rw-r--r--libnet/src/libnet_prand.c6
-rw-r--r--libnet/src/libnet_resolve.c11
-rw-r--r--libnet/src/libnet_version.c12
-rw-r--r--libnet/src/libnet_write.c10
-rw-r--r--libnet/version.h.in7
-rw-r--r--libnet/win32/Libnet-1.1.1-2002.sln77
-rw-r--r--libnet/win32/Libnet-1.1.1-2003.ncbbin797696 -> 0 bytes
-rw-r--r--libnet/win32/Libnet-1.1.1-2003.sln84
-rw-r--r--libnet/win32/Libnet-1.1.1-2003.suobin29184 -> 0 bytes
-rw-r--r--libnet/win32/Libnet-1.1.1.vcproj311
-rw-r--r--libnet/win32/Libnet-latest.ncbbin936960 -> 0 bytes
-rw-r--r--libnet/win32/Libnet-latest.optbin49664 -> 0 bytes
-rw-r--r--libnet/win32/Libnet-latest.sln77
-rw-r--r--libnet/win32/Libnet-latest.suobin44032 -> 0 bytes
-rw-r--r--libnet/win32/Libnet-latest.vcproj311
-rw-r--r--libnet/win32/Libnet.dsp337
-rw-r--r--libnet/win32/Libnet.dsw32
-rw-r--r--libnet/win32/Makefile.am6
-rw-r--r--libnet/win32/README.txt57
-rw-r--r--libnet/win32/libnet_dll.def164
-rw-r--r--lua/dnet.h.win321
-rw-r--r--lua/msvcbuild.bat23
-rw-r--r--lua/net.c9
43 files changed, 617 insertions, 1646 deletions
diff --git a/.gitignore b/.gitignore
index 73d2906..7ebddb7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,12 @@
*.a
+*.dll
+*.exp
*.la
+*.lib
*.lo
*.loT
*.o
+*.obj
*.out.dSYM
*.so.dSYM
*~
@@ -32,6 +36,7 @@ libnet/doc/html/*.html
libnet/doc/html/*.png
libnet/doc/man/man3/*.3
libnet/include/libnet.h
+libnet/include/libnet/stdint.h
libnet/m4
libnet/sample/arp
libnet/sample/bgp4_hdr
diff --git a/libnet/Makefile.am b/libnet/Makefile.am
index 8ebc25c..2e628a1 100644
--- a/libnet/Makefile.am
+++ b/libnet/Makefile.am
@@ -8,7 +8,7 @@
include $(top_srcdir)/Makefile.am.common
-SUBDIRS = include src sample doc win32
+SUBDIRS = include src sample doc
EXTRA_DIST = Makefile.am.common
diff --git a/libnet/README.win32 b/libnet/README.win32
new file mode 100644
index 0000000..4f22f0e
--- /dev/null
+++ b/libnet/README.win32
@@ -0,0 +1,14 @@
+Run msvcbuild.bat to build for Win32 with MSVC.
+
+The batch file depends on the MSVC build environment being set (PATH, etc.),
+this can be done with Visual Studio's vsvars32.bat, or by starting a Visual
+Studio shell.
+
+Also, the batch file hard-codes the location of the WinPcap developer's tools,
+you may have to modify it for your environment, or install the developer's
+pack in the expected location.
+
+For Visual Studio 2010, the shell can be found at:
+
+ Program Files >> Microsoft Visual Studio 2010 >> Visual Studio Tools >> Visual Studio Command Prompt
+
diff --git a/libnet/configure.in b/libnet/configure.in
index 9b160ff..0a3edca 100644
--- a/libnet/configure.in
+++ b/libnet/configure.in
@@ -300,10 +300,10 @@ AC_ARG_ENABLE([samples],
AM_CONDITIONAL([INSTALL_SAMPLES], [test x"$enable_samples" = xyes])
-AC_OUTPUT(Makefile src/Makefile win32/Makefile \
+AC_OUTPUT(Makefile src/Makefile \
include/Makefile \
include/libnet/Makefile include/win32/Makefile \
sample/Makefile doc/Makefile \
doc/man/Makefile doc/man/man3/Makefile doc/html/Makefile \
- version.h include/libnet.h libnet-config)
+ include/libnet.h libnet-config)
dnl EOF
diff --git a/libnet/include/libnet.h.in b/libnet/include/libnet.h.in
index 8992e6f..04dbd64 100644
--- a/libnet/include/libnet.h.in
+++ b/libnet/include/libnet.h.in
@@ -111,6 +111,10 @@ extern "C" {
#define @ENDIANESS@ 1
+#ifndef LIBNET_API
+#define LIBNET_API
+#endif
+
#include "./libnet/libnet-types.h"
#include "./libnet/libnet-macros.h"
#include "./libnet/libnet-headers.h"
diff --git a/libnet/include/libnet/libnet-functions.h b/libnet/include/libnet/libnet-functions.h
index e9c0340..c067798 100644
--- a/libnet/include/libnet/libnet-functions.h
+++ b/libnet/include/libnet/libnet-functions.h
@@ -60,6 +60,7 @@
* @param err_buf will contain an error message on failure
* @return libnet context ready for use or NULL on error.
*/
+LIBNET_API
libnet_t *
libnet_init(int injection_type, const char *device, char *err_buf);
@@ -68,6 +69,7 @@ libnet_init(int injection_type, const char *device, char *err_buf);
* interface and frees all internal memory structures associated with l.
* @param l pointer to a libnet context
*/
+LIBNET_API
void
libnet_destroy(libnet_t *l);
@@ -77,6 +79,7 @@ libnet_destroy(libnet_t *l);
* a different type using the same context.
* @param l pointer to a libnet context
*/
+LIBNET_API
void
libnet_clear_packet(libnet_t *l);
@@ -86,6 +89,7 @@ libnet_clear_packet(libnet_t *l);
* @param l pointer to a libnet context
* @param ls pointer to a libnet statistics structure
*/
+LIBNET_API
void
libnet_stats(libnet_t *l, struct libnet_stats *ls);
@@ -94,6 +98,7 @@ libnet_stats(libnet_t *l, struct libnet_stats *ls);
* @param l pointer to a libnet context
* @return the file number of the file descriptor used for packet injection
*/
+LIBNET_API
int
libnet_getfd(libnet_t *l);
@@ -103,6 +108,7 @@ libnet_getfd(libnet_t *l);
* @return the canonical name of the device used for packet injection. Note
* it can be NULL without being an error.
*/
+LIBNET_API
const char *
libnet_getdevice(libnet_t *l);
@@ -114,6 +120,7 @@ libnet_getdevice(libnet_t *l);
* @param ptag the ptag reference number
* @return a pointer to the pblock buffer or NULL on error
*/
+LIBNET_API
uint8_t *
libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag);
@@ -125,6 +132,7 @@ libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag);
* @param ptag the ptag reference number
* @return the size of the pblock buffer
*/
+LIBNET_API
uint32_t
libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag);
@@ -135,6 +143,7 @@ libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag);
* @param l pointer to a libnet context
* @return an error string or NULL if no error has occured
*/
+LIBNET_API
char *
libnet_geterror(libnet_t *l);
@@ -144,6 +153,7 @@ libnet_geterror(libnet_t *l);
* @param l pointer to a libnet context
* @return the size of the packet in l
*/
+LIBNET_API
uint32_t
libnet_getpacket_size(libnet_t *l);
@@ -152,6 +162,7 @@ libnet_getpacket_size(libnet_t *l);
* @param l pointer to a libnet context
* @return 1 on success, -1 on failure
*/
+LIBNET_API
int
libnet_seed_prand(libnet_t *l);
@@ -168,6 +179,7 @@ libnet_seed_prand(libnet_t *l);
* @param mod one the of LIBNET_PR* constants
* @return 1 on success, -1 on failure
*/
+LIBNET_API
uint32_t
libnet_get_prand(int mod);
@@ -192,6 +204,7 @@ libnet_get_prand(int mod);
* @param mode LIBNET_ON or LIBNET_OFF
* @return 1 on success, -1 on failure
*/
+LIBNET_API
int
libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode);
@@ -207,6 +220,7 @@ libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode);
* @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
* @return a pointer to presentation format string
*/
+LIBNET_API
char *
libnet_addr2name4(uint32_t in, uint8_t use_name);
@@ -223,6 +237,7 @@ libnet_addr2name4(uint32_t in, uint8_t use_name);
* @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
* @return network byte ordered IPv4 address or -1 (2^32 - 1) on error
*/
+LIBNET_API
uint32_t
libnet_name2addr4(libnet_t *l, char *host_name, uint8_t use_name);
@@ -233,6 +248,7 @@ extern const struct libnet_in6_addr in6addr_error;
* @param addr address to check
* @return 1 if addr is in6addr_error, 0 if it is not
*/
+LIBNET_API
int
libnet_in6_is_error(struct libnet_in6_addr addr);
@@ -249,12 +265,14 @@ libnet_in6_is_error(struct libnet_in6_addr addr);
* @param use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
* @return network byte ordered IPv6 address structure
*/
+LIBNET_API
struct libnet_in6_addr
libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name);
/**
* Should document this baby right here.
*/
+LIBNET_API
void
libnet_addr2name6_r(struct libnet_in6_addr addr, uint8_t use_name,
char *host_name, int host_name_len);
@@ -274,6 +292,7 @@ char *host_name, int host_name_len);
* @param token_list string containing the port list primitive
* @return 1 on success, -1 on failure
*/
+LIBNET_API
int
libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list);
@@ -288,6 +307,7 @@ libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list);
* @param eport will contain the ending port number or 0
* @return 1 on success, 0 if empty, -1 on failure
*/
+LIBNET_API
int
libnet_plist_chain_next_pair(libnet_plist_t *plist, uint16_t *bport,
uint16_t *eport);
@@ -298,6 +318,7 @@ uint16_t *eport);
* @param plist previously created portlist
* @return 1 on success, -1 on failure
*/
+LIBNET_API
int
libnet_plist_chain_dump(libnet_plist_t *plist);
@@ -309,6 +330,7 @@ libnet_plist_chain_dump(libnet_plist_t *plist);
* @return a printable string containing the port list contents on success
* NULL on error
*/
+LIBNET_API
char *
libnet_plist_chain_dump_string(libnet_plist_t *plist);
@@ -317,6 +339,7 @@ libnet_plist_chain_dump_string(libnet_plist_t *plist);
* @param plist previously created portlist
* @return 1 on success, -1 on failure
*/
+LIBNET_API
int
libnet_plist_chain_free(libnet_plist_t *plist);
@@ -407,6 +430,7 @@ libnet_plist_chain_free(libnet_plist_t *plist);
* @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_API
libnet_ptag_t
libnet_build_802_1q(const uint8_t *dst, const uint8_t *src, uint16_t tpi,
uint8_t priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto,
@@ -423,6 +447,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_802_1x(uint8_t eap_ver, uint8_t eap_type, uint16_t length,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -438,6 +463,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_802_2(uint8_t dsap, uint8_t ssap, uint8_t control,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -455,6 +481,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_802_2snap(uint8_t dsap, uint8_t ssap, uint8_t control,
uint8_t *oui, uint16_t type, const uint8_t* payload, uint32_t payload_s,
@@ -475,6 +502,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_802_3(const uint8_t *dst, const uint8_t *src, uint16_t len,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -494,6 +522,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ethernet(const uint8_t *dst, const uint8_t *src, uint16_t type,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -509,6 +538,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @param l pointer to a libnet context
* @return protocol tag value on success, -1 on error
*/
+LIBNET_API
libnet_ptag_t
libnet_autobuild_ethernet(const uint8_t *dst, uint16_t type, libnet_t *l);
@@ -528,6 +558,7 @@ libnet_autobuild_ethernet(const uint8_t *dst, uint16_t type, libnet_t *l);
* @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_API
libnet_ptag_t
libnet_build_fddi(uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap,
uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t* payload,
@@ -545,6 +576,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @param l pointer to a libnet context
* @return protocol tag value on success, -1 on error
*/
+LIBNET_API
libnet_ptag_t
libnet_autobuild_fddi(uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap,
uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l);
@@ -568,6 +600,7 @@ uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l);
* @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_API
libnet_ptag_t
libnet_build_arp(uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln,
uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa,
@@ -585,6 +618,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @param l pointer to a libnet context
* @return protocol tag value on success, -1 on error
*/
+LIBNET_API
libnet_ptag_t
libnet_autobuild_arp(uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha,
uint8_t *tpa, libnet_t *l);
@@ -606,6 +640,7 @@ uint8_t *tpa, libnet_t *l);
* @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_API
libnet_ptag_t
libnet_build_tcp(uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack,
uint8_t control, uint16_t win, uint16_t sum, uint16_t urg, uint16_t len,
@@ -626,6 +661,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_tcp_options(const uint8_t *options, uint32_t options_s, libnet_t *l,
libnet_ptag_t ptag);
@@ -642,6 +678,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_udp(uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -665,6 +702,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_cdp(uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type,
uint16_t value_s, const uint8_t *value, const uint8_t* payload, uint32_t payload_s,
@@ -684,6 +722,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_icmpv4_echo(uint8_t type, uint8_t code, uint16_t sum,
uint16_t id, uint16_t seq, const uint8_t* payload, uint32_t payload_s,
@@ -704,6 +743,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_icmpv4_mask(uint8_t type, uint8_t code, uint16_t sum,
uint16_t id, uint16_t seq, uint32_t mask, const uint8_t* payload,
@@ -722,6 +762,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_icmpv4_unreach(uint8_t type, uint8_t code, uint16_t sum,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -740,6 +781,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_icmpv4_redirect(uint8_t type, uint8_t code, uint16_t sum,
uint32_t gateway, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
@@ -759,6 +801,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_icmpv4_timeexceed(uint8_t type, uint8_t code, uint16_t sum,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -780,6 +823,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_icmpv4_timestamp(uint8_t type, uint8_t code, uint16_t sum,
uint16_t id, uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime,
@@ -799,6 +843,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t libnet_build_icmpv6_echo(uint8_t type, uint8_t code, uint16_t
sum, uint16_t id, uint16_t seq, uint8_t *payload, uint32_t payload_s,
libnet_t *l, libnet_ptag_t ptag);
@@ -816,6 +861,7 @@ libnet_ptag_t libnet_build_icmpv6_echo(uint8_t type, uint8_t code, uint16_t
* @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_API
libnet_ptag_t
libnet_build_icmpv6_unreach(uint8_t type, uint8_t code, uint16_t sum,
uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -834,6 +880,7 @@ uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t libnet_build_icmpv6_ndp_nsol(uint8_t type, uint8_t code,
uint16_t sum, struct libnet_in6_addr target, uint8_t *payload, uint32_t
payload_s, libnet_t* l, libnet_ptag_t ptag);
@@ -853,6 +900,7 @@ libnet_ptag_t libnet_build_icmpv6_ndp_nsol(uint8_t type, uint8_t code,
* @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_API
libnet_ptag_t libnet_build_icmpv6_ndp_nadv(uint8_t type, uint8_t code,
uint16_t sum, uint32_t flags, struct libnet_in6_addr target, uint8_t
*payload, uint32_t payload_s, libnet_t* l, libnet_ptag_t ptag);
@@ -866,6 +914,7 @@ libnet_ptag_t libnet_build_icmpv6_ndp_nadv(uint8_t type, uint8_t code,
* @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_API
libnet_ptag_t libnet_build_icmpv6_ndp_opt(uint8_t type, uint8_t* option,
uint32_t option_s, libnet_t* l, libnet_ptag_t ptag);
@@ -883,6 +932,7 @@ libnet_ptag_t libnet_build_icmpv6_ndp_opt(uint8_t type, uint8_t* option,
*
* @note 'reserved' was previously called 'code', which it is not, in any IGMP version.
*/
+LIBNET_API
libnet_ptag_t
libnet_build_igmp(uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -906,6 +956,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipv4(uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag,
uint8_t ttl, uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst,
@@ -929,6 +980,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipv4_options(const uint8_t *options, uint32_t options_s, libnet_t *l,
libnet_ptag_t ptag);
@@ -946,6 +998,7 @@ libnet_ptag_t ptag);
* @param l pointer to a libnet context
* @return protocol tag value on success, -1 on error
*/
+LIBNET_API
libnet_ptag_t
libnet_autobuild_ipv4(uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l);
@@ -964,6 +1017,7 @@ libnet_autobuild_ipv4(uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l);
* @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_API
libnet_ptag_t
libnet_build_ipv6(uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh,
uint8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst,
@@ -981,6 +1035,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipv6_frag(uint8_t nh, uint8_t reserved, uint16_t frag,
uint32_t id, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
@@ -1003,6 +1058,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipv6_routing(uint8_t nh, uint8_t len, uint8_t rtype,
uint8_t segments, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
@@ -1021,6 +1077,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipv6_destopts(uint8_t nh, uint8_t len, const uint8_t* payload,
uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -1039,6 +1096,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipv6_hbhopts(uint8_t nh, uint8_t len, const uint8_t* payload,
uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -1059,6 +1117,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_autobuild_ipv6(uint16_t len, uint8_t nh, struct libnet_in6_addr dst,
libnet_t *l, libnet_ptag_t ptag);
@@ -1080,6 +1139,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_isl(uint8_t *dhost, uint8_t type, uint8_t user,
uint8_t *shost, uint16_t len, const uint8_t *snap, uint16_t vid,
@@ -1097,6 +1157,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipsec_esp_hdr(uint32_t spi, uint32_t seq, uint32_t iv,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -1112,6 +1173,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipsec_esp_ftr(uint8_t len, uint8_t nh, int8_t *auth,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -1130,6 +1192,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ipsec_ah(uint8_t nh, uint8_t len, uint16_t res,
uint32_t spi, uint32_t seq, uint32_t auth, const uint8_t* payload,
@@ -1151,6 +1214,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_dnsv4(uint16_t h_len, uint16_t id, uint16_t flags,
uint16_t num_q, uint16_t num_anws_rr, uint16_t num_auth_rr,
@@ -1174,6 +1238,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_rip(uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af,
uint16_t rt, uint32_t addr, uint32_t mask, uint32_t next_hop,
@@ -1202,6 +1267,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_rpc_call(uint32_t rm, uint32_t xid, uint32_t prog_num,
uint32_t prog_vers, uint32_t procedure, uint32_t cflavor, uint32_t clength,
@@ -1230,6 +1296,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_stp_conf(uint16_t id, uint8_t version, uint8_t bpdu_type,
uint8_t flags, const uint8_t *root_id, uint32_t root_pc, const uint8_t *bridge_id,
@@ -1250,6 +1317,7 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_stp_tcn(uint16_t id, uint8_t version, uint8_t bpdu_type,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -1271,6 +1339,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_token_ring(uint8_t ac, uint8_t fc, const uint8_t *dst, const uint8_t *src,
uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type,
@@ -1289,6 +1358,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @param l pointer to a libnet context
* @return protocol tag value on success, -1 on error
*/
+LIBNET_API
libnet_ptag_t
libnet_autobuild_token_ring(uint8_t ac, uint8_t fc, const uint8_t *dst,
uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type,
@@ -1313,6 +1383,7 @@ libnet_t *l);
* @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_API
libnet_ptag_t
libnet_build_vrrp(uint8_t version, uint8_t type, uint8_t vrouter_id,
uint8_t priority, uint8_t ip_count, uint8_t auth_type, uint8_t advert_int,
@@ -1331,6 +1402,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_mpls(uint32_t label, uint8_t experimental, uint8_t bos,
uint8_t ttl, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
@@ -1363,6 +1435,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ntp(uint8_t leap_indicator, uint8_t version, uint8_t mode,
uint8_t stratum, uint8_t poll, uint8_t precision, uint16_t delay_int,
@@ -1385,6 +1458,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ospfv2(uint16_t len, uint8_t type, uint32_t rtr_id,
uint32_t area_id, uint16_t sum, uint16_t autype, const uint8_t* payload,
@@ -1404,9 +1478,10 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ospfv2_hello(uint32_t netmask, uint16_t interval, uint8_t opts,
-uint8_t priority, uint dead_int, uint32_t des_rtr, uint32_t bkup_rtr,
+uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
/**
@@ -1420,9 +1495,10 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ospfv2_dbd(uint16_t dgram_len, uint8_t opts, uint8_t type,
-uint seqnum, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
+uint32_t seqnum, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
libnet_ptag_t ptag);
/**
@@ -1435,8 +1511,9 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
-libnet_build_ospfv2_lsr(uint type, uint lsid, uint32_t advrtr,
+libnet_build_ospfv2_lsr(uint32_t type, uint32_t lsid, uint32_t advrtr,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
/**
@@ -1447,8 +1524,9 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
-libnet_build_ospfv2_lsu(uint num, const uint8_t* payload, uint32_t payload_s,
+libnet_build_ospfv2_lsu(uint32_t num, const uint8_t* payload, uint32_t payload_s,
libnet_t *l, libnet_ptag_t ptag);
/**
@@ -1466,9 +1544,10 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_ospfv2_lsa(uint16_t age, uint8_t opts, uint8_t type,
-uint lsid, uint32_t advrtr, uint seqnum, uint16_t sum, uint16_t len,
+uint32_t lsid, uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
/**
@@ -1485,9 +1564,10 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
-libnet_build_ospfv2_lsa_rtr(uint16_t flags, uint16_t num, uint id,
-uint data, uint8_t type, uint8_t tos, uint16_t metric, const uint8_t* payload,
+libnet_build_ospfv2_lsa_rtr(uint16_t flags, uint16_t num, uint32_t id,
+uint32_t data, uint8_t type, uint8_t tos, uint16_t metric, const uint8_t* payload,
uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
/**
@@ -1499,8 +1579,9 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
-libnet_build_ospfv2_lsa_net(uint32_t nmask, uint rtrid, const uint8_t* payload,
+libnet_build_ospfv2_lsa_net(uint32_t nmask, uint32_t rtrid, const uint8_t* payload,
uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
/**
@@ -1513,8 +1594,9 @@ uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
-libnet_build_ospfv2_lsa_sum(uint32_t nmask, uint metric, uint tos,
+libnet_build_ospfv2_lsa_sum(uint32_t nmask, uint32_t metric, uint32_t tos,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
/**
@@ -1528,9 +1610,10 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
-libnet_build_ospfv2_lsa_as(uint32_t nmask, uint metric, uint32_t fwdaddr,
-uint tag, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
+libnet_build_ospfv2_lsa_as(uint32_t nmask, uint32_t metric, uint32_t fwdaddr,
+uint32_t tag, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
libnet_ptag_t ptag);
/**
@@ -1544,6 +1627,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_data(const uint8_t* payload, uint32_t payload_s, libnet_t *l,
libnet_ptag_t ptag);
@@ -1569,6 +1653,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_dhcpv4(uint8_t opcode, uint8_t htype, uint8_t hlen,
uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags,
@@ -1597,6 +1682,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_bootpv4(uint8_t opcode, uint8_t htype, uint8_t hlen,
uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags,
@@ -1608,6 +1694,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @param fv see libnet_build_gre().
* @return size, see libnet_build_gre().
*/
+LIBNET_API
uint32_t
libnet_getgre_length(uint16_t fv);
@@ -1633,6 +1720,7 @@ libnet_getgre_length(uint16_t fv);
* @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_API
libnet_ptag_t
libnet_build_gre(uint16_t fv, uint16_t type, uint16_t sum,
uint16_t offset, uint32_t key, uint32_t seq, uint16_t len,
@@ -1659,6 +1747,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_egre(uint16_t fv, uint16_t type, uint16_t sum,
uint16_t offset, uint32_t key, uint32_t seq, uint16_t len,
@@ -1675,6 +1764,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_gre_sre(uint16_t af, uint8_t offset, uint8_t length,
uint8_t *routing, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
@@ -1685,6 +1775,7 @@ libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag);
@@ -1709,6 +1800,7 @@ libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_bgp4_header(uint8_t marker[LIBNET_BGP4_MARKER_SIZE],
uint16_t len, uint8_t type, const uint8_t* payload, uint32_t payload_s,
@@ -1730,6 +1822,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_bgp4_open(uint8_t version, uint16_t src_as, uint16_t hold_time,
uint32_t bgp_id, uint8_t opt_len, const uint8_t* payload, uint32_t payload_s,
@@ -1750,6 +1843,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_bgp4_update(uint16_t unfeasible_rt_len, const uint8_t *withdrawn_rt,
uint16_t total_path_attr_len, const uint8_t *path_attributes, uint16_t info_len,
@@ -1768,6 +1862,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_bgp4_notification(uint8_t err_code, uint8_t err_subcode,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -1793,6 +1888,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_sebek(uint32_t magic, uint16_t version, uint16_t type,
uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid,
@@ -1818,6 +1914,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_hsrp(uint8_t version, uint8_t opcode, uint8_t state,
uint8_t hello_time, uint8_t hold_time, uint8_t priority, uint8_t group,
@@ -1838,6 +1935,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @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_API
libnet_ptag_t
libnet_build_link(const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_t type,
const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
@@ -1852,6 +1950,7 @@ const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
* @param l pointer to a libnet context
* @return protocol tag value on success, -1 on error
*/
+LIBNET_API
libnet_ptag_t
libnet_autobuild_link(const uint8_t *dst, const uint8_t *oui, uint16_t type,
libnet_t *l);
@@ -1868,6 +1967,7 @@ libnet_t *l);
* @param l pointer to a libnet context
* @return the number of bytes written, -1 on error
*/
+LIBNET_API
int
libnet_write(libnet_t *l);
@@ -1879,6 +1979,7 @@ libnet_write(libnet_t *l);
* @param l pointer to a libnet context
* @return a big endian IP address suitable for use in a libnet_build function or -1
*/
+LIBNET_API
uint32_t
libnet_get_ipaddr4(libnet_t *l);
@@ -1892,6 +1993,7 @@ libnet_get_ipaddr4(libnet_t *l);
* @param l pointer to a libnet context
* @return well, nothing yet
*/
+LIBNET_API
struct libnet_in6_addr
libnet_get_ipaddr6(libnet_t *l);
@@ -1903,6 +2005,7 @@ libnet_get_ipaddr6(libnet_t *l);
* @param l pointer to a libnet context
* @return a pointer to the MAC address or NULL
*/
+LIBNET_API
struct libnet_ether_addr *
libnet_get_hwaddr(libnet_t *l);
@@ -1915,6 +2018,7 @@ libnet_get_hwaddr(libnet_t *l);
* @param len the resulting size of the returned byte string
* @return a byte string or NULL on failure
*/
+LIBNET_API
uint8_t *
libnet_hex_aton(const char *s, int *len);
@@ -1922,6 +2026,7 @@ libnet_hex_aton(const char *s, int *len);
* Returns the version of libnet.
* @return the libnet version
*/
+LIBNET_API
const char *
libnet_version(void);
@@ -1940,6 +2045,7 @@ libnet_version(void);
* @param packet_s will contain the packet size
* @return 1 on success, -1 on failure
*/
+LIBNET_API
int
libnet_adv_cull_packet(libnet_t *l, uint8_t **packet, uint32_t *packet_s);
@@ -1955,6 +2061,7 @@ libnet_adv_cull_packet(libnet_t *l, uint8_t **packet, uint32_t *packet_s);
* @param header_s will contain the header size
* @return 1 on success, -1 on failure
*/
+LIBNET_API
int
libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, uint8_t **header,
uint32_t *header_s);
@@ -1972,6 +2079,7 @@ uint32_t *header_s);
* @param packet_s the size of the packet
* @return the number of bytes written, or -1 on failure
*/
+LIBNET_API
int
libnet_adv_write_link(libnet_t *l, const uint8_t *packet, uint32_t packet_s);
@@ -1988,6 +2096,7 @@ libnet_adv_write_link(libnet_t *l, const uint8_t *packet, uint32_t packet_s);
* @param packet_s the size of the packet
* @return the number of bytes written, or -1 on failure
*/
+LIBNET_API
int
libnet_adv_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t packet_s);
@@ -1997,6 +2106,7 @@ libnet_adv_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t packet_s)
* @param l pointer to a libnet context
* @param packet a pointer to the packet to free
*/
+LIBNET_API
void
libnet_adv_free_packet(libnet_t *l, uint8_t *packet);
@@ -2030,6 +2140,7 @@ libnet_cq_add(libnet_t *l, char *label);
* @param l pointer to a libnet context
* @return the pointer to the removed libnet context, NULL on failure
*/
+LIBNET_API
libnet_t *
libnet_cq_remove(libnet_t *l);
@@ -2043,7 +2154,8 @@ libnet_cq_remove(libnet_t *l);
* will fail.
* @param label canonical name of the context to remove
* @return the pointer to the removed libnet context, NULL on failure
- */
+ */
+LIBNET_API
libnet_t *
libnet_cq_remove_by_label(char *label);
@@ -2052,7 +2164,8 @@ libnet_cq_remove_by_label(char *label);
* Returns the canonical label associated with the context.
* @param l pointer to a libnet context
* @return pointer to the libnet context's label
- */
+ */
+LIBNET_API
const char *
libnet_cq_getlabel(libnet_t *l);
@@ -2062,6 +2175,7 @@ libnet_cq_getlabel(libnet_t *l);
* @param label canonical label of the libnet context to retrieve
* @return the expected libnet context, NULL on failure
*/
+LIBNET_API
libnet_t *
libnet_cq_find_by_label(char *label);
@@ -2070,6 +2184,7 @@ libnet_cq_find_by_label(char *label);
* Destroys the entire context queue, calling libnet_destroy() on each
* member context.
*/
+LIBNET_API
void
libnet_cq_destroy(void);
@@ -2092,6 +2207,7 @@ libnet_cq_destroy(void);
* in a single loop.
* @return the head of the context queue
*/
+LIBNET_API
libnet_t *
libnet_cq_head(void);
@@ -2100,6 +2216,7 @@ libnet_cq_head(void);
* Check whether the iterator is at the last context in the queue.
* @return 1 if at the end of the context queue, 0 otherwise
*/
+LIBNET_API
int
libnet_cq_last(void);
@@ -2108,6 +2225,7 @@ libnet_cq_last(void);
* Get next context from the context queue.
* @return the next context from the context queue
*/
+LIBNET_API
libnet_t *
libnet_cq_next(void);
@@ -2116,12 +2234,14 @@ libnet_cq_next(void);
* Function returns the number of libnet contexts that are in the queue.
* @return the number of libnet contexts currently in the queue
*/
+LIBNET_API
uint32_t
libnet_cq_size(void);
/**
* [Context Queue]
*/
+LIBNET_API
uint32_t
libnet_cq_end_loop(void);
@@ -2130,6 +2250,7 @@ libnet_cq_end_loop(void);
* Prints the contents of the given context.
* @param l pointer to a libnet context
*/
+LIBNET_API
void
libnet_diag_dump_context(libnet_t *l);
@@ -2138,6 +2259,7 @@ libnet_diag_dump_context(libnet_t *l);
* Prints the contents of every pblock.
* @param l pointer to a libnet context
*/
+LIBNET_API
void
libnet_diag_dump_pblock(libnet_t *l);
@@ -2147,6 +2269,7 @@ libnet_diag_dump_pblock(libnet_t *l);
* @param type pblock type
* @return a string representing the pblock type type or "unknown" for an unknown value
*/
+LIBNET_API
char *
libnet_diag_dump_pblock_type(uint8_t type);
@@ -2169,18 +2292,21 @@ libnet_diag_dump_hex(const uint8_t *packet, uint32_t len, int swap, FILE *stream
/*
* [Internal]
*/
+LIBNET_API
int
libnet_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t size);
/*
* [Internal]
*/
+LIBNET_API
int
libnet_write_raw_ipv6(libnet_t *l, const uint8_t *packet, uint32_t size);
/*
* [Internal]
*/
+LIBNET_API
int
libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size);
@@ -2201,6 +2327,7 @@ libnet_open_raw4(libnet_t *l);
/*
* [Internal]
*/
+LIBNET_API
int
libnet_close_raw4(libnet_t *l);
@@ -2254,30 +2381,34 @@ libnet_do_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len);
*
* Finding that protocol requires that the IP header be well-formed... so this
* won't work well for invalid packets. But then, what is the valid checksum
- * for a valid packet, anyhow?
+ * for a invalid packet, anyhow?
*
* This doesn't work well for non-inet checksums, sorry, that's an original design
* flaw. pblock_t needs a pointer in it, to a packet assembly function that can be
* called at runtime to do assembly and checksumming.
*/
+LIBNET_API
int
libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const uint8_t *beg, const uint8_t * end);
/*
* [Internal]
*/
+LIBNET_API
uint32_t
libnet_compute_crc(uint8_t *buf, uint32_t len);
/*
* [Internal]
*/
+LIBNET_API
uint16_t
libnet_ip_check(uint16_t *addr, int len);
/*
* [Internal]
*/
+LIBNET_API
int
libnet_in_cksum(uint16_t *addr, int len);
@@ -2288,6 +2419,7 @@ libnet_in_cksum(uint16_t *addr, int len);
* function will search the pblock list for the specified protocol block
* and return a pointer to it.
*/
+LIBNET_API
libnet_pblock_t *
libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, uint32_t b_len,
uint8_t type);
@@ -2297,6 +2429,7 @@ uint8_t type);
* Function creates the pblock list if l->protocol_blocks == NULL or appends
* an entry to the doubly linked list.
*/
+LIBNET_API
libnet_pblock_t *
libnet_pblock_new(libnet_t *l, uint32_t b_len);
@@ -2304,6 +2437,7 @@ libnet_pblock_new(libnet_t *l, uint32_t b_len);
* [Internal]
* Function swaps two pblocks in memory.
*/
+LIBNET_API
int
libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2);
@@ -2311,6 +2445,7 @@ libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2);
* [Internal]
* Function inserts ptag2 before ptag1 in the doubly linked list.
*/
+LIBNET_API
int
libnet_pblock_insert_before(libnet_t *l, libnet_ptag_t ptag1,
libnet_ptag_t ptag2);
@@ -2319,6 +2454,7 @@ libnet_ptag_t ptag2);
* [Internal]
* Function removes a pblock from context
*/
+LIBNET_API
void
libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p);
@@ -2328,6 +2464,7 @@ libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p);
* ptag with a monotonically increasing variable kept in l. This way each
* pblock has a succesively increasing ptag identifier.
*/
+LIBNET_API
libnet_ptag_t
libnet_pblock_update(libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type);
@@ -2336,6 +2473,7 @@ libnet_pblock_update(libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type);
* [Internal]
* Function locates a given block by it's ptag.
*/
+LIBNET_API
libnet_pblock_t *
libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag);
@@ -2343,6 +2481,7 @@ libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag);
* [Internal]
* Function copies protocol block data over.
*/
+LIBNET_API
int
libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t len);
@@ -2350,6 +2489,7 @@ libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t
* [Internal]
* Function sets pblock flags.
*/
+LIBNET_API
void
libnet_pblock_setflags(libnet_pblock_t *p, uint8_t flags);
@@ -2358,6 +2498,7 @@ libnet_pblock_setflags(libnet_pblock_t *p, uint8_t flags);
* Function returns the protocol number for the protocol block type. If
* the type is unknown, the function defaults to returning IPPROTO_IP.
*/
+LIBNET_API
int
libnet_pblock_p2p(uint8_t type);
@@ -2366,6 +2507,7 @@ libnet_pblock_p2p(uint8_t type);
* Function assembles the protocol blocks into a packet, checksums are
* calculated if that was requested.
*/
+LIBNET_API
int
libnet_pblock_coalesce(libnet_t *l, uint8_t **packet, uint32_t *size);
diff --git a/libnet/include/libnet/libnet-headers.h b/libnet/include/libnet/libnet-headers.h
index ebc778e..e1076e9 100644
--- a/libnet/include/libnet/libnet-headers.h
+++ b/libnet/include/libnet/libnet-headers.h
@@ -1374,7 +1374,7 @@ struct libnet_auth_hdr
uint16_t ospf_auth_null; /* NULL */
uint8_t ospf_auth_keyid; /* authentication key ID */
uint8_t ospf_auth_len; /* auth data length */
- uint ospf_auth_seq; /* cryptographic sequence number */
+ uint32_t ospf_auth_seq; /* cryptographic sequence number */
};
@@ -1389,7 +1389,7 @@ struct libnet_ospf_hello_hdr
uint16_t hello_intrvl; /* num of seconds between routers last packet */
uint8_t hello_opts; /* Options for HELLO packets (look above) */
uint8_t hello_rtr_pri; /* router's priority (if 0, can't be backup) */
- uint hello_dead_intvl; /* # of secs a router is silent till deemed down */
+ uint32_t 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 */
@@ -1407,7 +1407,7 @@ struct libnet_dbd_hdr
#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 */
- uint dbd_seq; /* DBD sequence number */
+ uint32_t dbd_seq; /* DBD sequence number */
};
@@ -1426,8 +1426,8 @@ struct libnet_dbd_hdr
*/
struct libnet_lsr_hdr
{
- uint lsr_type; /* type of LS being requested */
- uint lsr_lsid; /* link state ID */
+ uint32_t lsr_type; /* type of LS being requested */
+ uint32_t lsr_lsid; /* link state ID */
struct in_addr lsr_adrtr; /* advertising router (memcpy more as needed) */
};
@@ -1437,7 +1437,7 @@ struct libnet_lsr_hdr
*/
struct libnet_lsu_hdr
{
- uint lsu_num; /* number of LSAs that will be broadcasted */
+ uint32_t lsu_num; /* number of LSAs that will be broadcasted */
};
@@ -1449,9 +1449,9 @@ struct libnet_lsa_hdr
uint16_t lsa_age; /* time in seconds since the LSA was originated */
uint8_t lsa_opts; /* look above for OPTS_* */
uint8_t lsa_type; /* look below for LS_TYPE_* */
- uint lsa_id; /* link State ID */
+ uint32_t lsa_id; /* link State ID */
struct in_addr lsa_adv; /* router ID of Advertising router */
- uint lsa_seq; /* LSA sequence number to detect old/bad ones */
+ uint32_t lsa_seq; /* LSA sequence number to detect old/bad ones */
uint16_t lsa_sum; /* "Fletcher Checksum" of all fields minus age */
uint16_t lsa_len; /* length in bytes including the 20 byte header */
};
@@ -1470,11 +1470,11 @@ struct libnet_rtr_lsa_hdr
#define LIBNET_RTR_FLAGS_E 0x0200 /* E bit */
#define LIBNET_RTR_FLAGS_B 0x0400 /* B bit */
uint16_t rtr_num; /* number of links within that packet */
- uint rtr_link_id; /* describes link_data (look below) */
+ uint32_t 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 */
- uint rtr_link_data; /* Depending on link_id, info is here */
+ uint32_t rtr_link_data; /* Depending on link_id, info is here */
uint8_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" */
@@ -1491,7 +1491,7 @@ struct libnet_rtr_lsa_hdr
struct libnet_net_lsa_hdr
{
struct in_addr net_nmask; /* Netmask for that network */
- uint net_rtr_id; /* ID of router attached to that network */
+ uint32_t net_rtr_id; /* ID of router attached to that network */
};
@@ -1501,8 +1501,8 @@ struct libnet_net_lsa_hdr
struct libnet_sum_lsa_hdr
{
struct in_addr sum_nmask; /* Netmask of destination IP address */
- uint sum_metric; /* Same as in rtr_lsa (&0xfff to use last 24bit */
- uint sum_tos_metric; /* first 8bits are TOS, 24bits are TOS Metric */
+ uint32_t sum_metric; /* Same as in rtr_lsa (&0xfff to use last 24bit */
+ uint32_t sum_tos_metric; /* first 8bits are TOS, 24bits are TOS Metric */
};
@@ -1513,10 +1513,10 @@ struct libnet_sum_lsa_hdr
struct libnet_as_lsa_hdr
{
struct in_addr as_nmask; /* Netmask for advertised destination */
- uint as_metric; /* May have to set E bit in first 8bits */
+ uint32_t 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 */
- uint as_rte_tag; /* External route tag */
+ uint32_t as_rte_tag; /* External route tag */
};
diff --git a/libnet/include/win32/in_systm.h b/libnet/include/win32/in_systm.h
deleted file mode 100644
index b0ee1a2..0000000
--- a/libnet/include/win32/in_systm.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. 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.
- * 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.
- *
- * @(#)in_systm.h 8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/netinet/in_systm.h,v 1.9 1999/12/29 04:41:00 peter Exp $
- */
-
-#ifdef _WIN32
-#ifndef _NETINET_IN_SYSTM_H_
-#define _NETINET_IN_SYSTM_H_
-
-typedef unsigned char u_int8_t;
-typedef unsigned short u_int16_t;
-typedef unsigned int u_int32_t;
-typedef unsigned __int64 u_int64_t;
-
-typedef __int64 int64_t;
-typedef int64_t rlim_t;
-
-
-typedef u_int32_t in_addr_t;
-typedef u_int32_t in_port_t;
-
-/*
- * Miscellaneous internetwork
- * definitions for kernel.
- */
-
-/*
- * Network types.
- *
- * Internally the system keeps counters in the headers with the bytes
- * swapped so that VAX instructions will work on them. It reverses
- * the bytes before transmission at each protocol level. The n_ types
- * represent the types with the bytes in ``high-ender'' order.
- */
-typedef u_int16_t n_short; /* short as received from the net */
-typedef u_int32_t n_long; /* long as received from the net */
-
-typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
-
-#ifdef _KERNEL
-n_time iptime __P((void));
-#endif
-
-#endif
-
-#endif
diff --git a/libnet/include/win32/libnet.h b/libnet/include/win32/libnet.h
index 4f0c10a..9b8cc77 100644
--- a/libnet/include/win32/libnet.h
+++ b/libnet/include/win32/libnet.h
@@ -37,7 +37,6 @@
#include <winsock2.h>
#include <windows.h>
#include <time.h>
-#include "in_systm.h"
#include "pcap.h"
@@ -55,14 +54,21 @@ extern "C" {
#define LIBNET_LIL_ENDIAN 1
#define HAVE_CONFIG_H 1
+/* TODO Definitions and includes below should be in a private header, libnet src needs them, libnet
+ library users don't (and they have negative side effects).
+ */
/* Some UNIX to Win32 conversions */
#define STDOUT_FILENO stdout
#define snprintf _snprintf
+#define strdup _strdup
#define write _write
#define open _open
#define random rand
#define close closesocket
#define __func__ __FUNCTION__
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
/* __FUNCTION__ available in VC ++ 7.0 (.NET) and greater */
#if _MSC_VER < 1300
@@ -74,8 +80,8 @@ extern "C" {
#pragma comment (lib,"wpcap") /* Winpcap */
#pragma comment (lib,"packet")
-/* "@LIBNET_VERSION@" will not work in VC++, so version.h doesn't get populated */
-#define VERSION "1.1.1"
+/* FIXME this needs manual update during release packaging. */
+#define LIBNET_VERSION "1.1.6"
/* To use Win32 native versions */
#define WPCAP 1
@@ -90,11 +96,15 @@ extern "C" {
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
-#include "../libnet/libnet-macros.h"
-#include "../libnet/libnet-headers.h"
-#include "../libnet/libnet-structures.h"
-#include "../libnet/libnet-asn1.h"
-#include "../libnet/libnet-functions.h"
+
+#define LIBNET_API __declspec(dllexport)
+
+#include "libnet/stdint.h"
+#include "libnet/libnet-macros.h"
+#include "libnet/libnet-headers.h"
+#include "libnet/libnet-structures.h"
+#include "libnet/libnet-asn1.h"
+#include "libnet/libnet-functions.h"
#ifdef __cplusplus
}
diff --git a/libnet/include/win32/stdint.h b/libnet/include/win32/stdint.h
new file mode 100644
index 0000000..d02608a
--- /dev/null
+++ b/libnet/include/win32/stdint.h
@@ -0,0 +1,247 @@
+// ISO C9x compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006-2008 Alexander Chemeris
+//
+// 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. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_STDINT_H_ // [
+#define _MSC_STDINT_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <limits.h>
+
+// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
+// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
+// or compiler give many errors like this:
+// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
+#ifdef __cplusplus
+extern "C" {
+#endif
+# include <wchar.h>
+#ifdef __cplusplus
+}
+#endif
+
+// Define _W64 macros to mark types changing their size, like intptr_t.
+#ifndef _W64
+# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+# define _W64 __w64
+# else
+# define _W64
+# endif
+#endif
+
+
+// 7.18.1 Integer types
+
+// 7.18.1.1 Exact-width integer types
+
+// Visual Studio 6 and Embedded Visual C++ 4 doesn't
+// realize that, e.g. char has the same size as __int8
+// so we give up on __intX for them.
+#if (_MSC_VER < 1300)
+ typedef signed char int8_t;
+ typedef signed short int16_t;
+ typedef signed int int32_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+#else
+ typedef signed __int8 int8_t;
+ typedef signed __int16 int16_t;
+ typedef signed __int32 int32_t;
+ typedef unsigned __int8 uint8_t;
+ typedef unsigned __int16 uint16_t;
+ typedef unsigned __int32 uint32_t;
+#endif
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+
+// 7.18.1.2 Minimum-width integer types
+typedef int8_t int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+typedef uint8_t uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+// 7.18.1.3 Fastest minimum-width integer types
+typedef int8_t int_fast8_t;
+typedef int16_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef int64_t int_fast64_t;
+typedef uint8_t uint_fast8_t;
+typedef uint16_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+typedef uint64_t uint_fast64_t;
+
+// 7.18.1.4 Integer types capable of holding object pointers
+#ifdef _WIN64 // [
+ typedef signed __int64 intptr_t;
+ typedef unsigned __int64 uintptr_t;
+#else // _WIN64 ][
+ typedef _W64 signed int intptr_t;
+ typedef _W64 unsigned int uintptr_t;
+#endif // _WIN64 ]
+
+// 7.18.1.5 Greatest-width integer types
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+
+
+// 7.18.2 Limits of specified-width integer types
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
+
+// 7.18.2.1 Limits of exact-width integer types
+#define INT8_MIN ((int8_t)_I8_MIN)
+#define INT8_MAX _I8_MAX
+#define INT16_MIN ((int16_t)_I16_MIN)
+#define INT16_MAX _I16_MAX
+#define INT32_MIN ((int32_t)_I32_MIN)
+#define INT32_MAX _I32_MAX
+#define INT64_MIN ((int64_t)_I64_MIN)
+#define INT64_MAX _I64_MAX
+#define UINT8_MAX _UI8_MAX
+#define UINT16_MAX _UI16_MAX
+#define UINT32_MAX _UI32_MAX
+#define UINT64_MAX _UI64_MAX
+
+// 7.18.2.2 Limits of minimum-width integer types
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+// 7.18.2.3 Limits of fastest minimum-width integer types
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST16_MAX INT16_MAX
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST8_MAX UINT8_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+// 7.18.2.4 Limits of integer types capable of holding object pointers
+#ifdef _WIN64 // [
+# define INTPTR_MIN INT64_MIN
+# define INTPTR_MAX INT64_MAX
+# define UINTPTR_MAX UINT64_MAX
+#else // _WIN64 ][
+# define INTPTR_MIN INT32_MIN
+# define INTPTR_MAX INT32_MAX
+# define UINTPTR_MAX UINT32_MAX
+#endif // _WIN64 ]
+
+// 7.18.2.5 Limits of greatest-width integer types
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+// 7.18.3 Limits of other integer types
+
+#ifdef _WIN64 // [
+# define PTRDIFF_MIN _I64_MIN
+# define PTRDIFF_MAX _I64_MAX
+#else // _WIN64 ][
+# define PTRDIFF_MIN _I32_MIN
+# define PTRDIFF_MAX _I32_MAX
+#endif // _WIN64 ]
+
+#define SIG_ATOMIC_MIN INT_MIN
+#define SIG_ATOMIC_MAX INT_MAX
+
+#ifndef SIZE_MAX // [
+# ifdef _WIN64 // [
+# define SIZE_MAX _UI64_MAX
+# else // _WIN64 ][
+# define SIZE_MAX _UI32_MAX
+# endif // _WIN64 ]
+#endif // SIZE_MAX ]
+
+// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
+#ifndef WCHAR_MIN // [
+# define WCHAR_MIN 0
+#endif // WCHAR_MIN ]
+#ifndef WCHAR_MAX // [
+# define WCHAR_MAX _UI16_MAX
+#endif // WCHAR_MAX ]
+
+#define WINT_MIN 0
+#define WINT_MAX _UI16_MAX
+
+#endif // __STDC_LIMIT_MACROS ]
+
+
+// 7.18.4 Limits of other integer types
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
+
+// 7.18.4.1 Macros for minimum-width integer constants
+
+#define INT8_C(val) val##i8
+#define INT16_C(val) val##i16
+#define INT32_C(val) val##i32
+#define INT64_C(val) val##i64
+
+#define UINT8_C(val) val##ui8
+#define UINT16_C(val) val##ui16
+#define UINT32_C(val) val##ui32
+#define UINT64_C(val) val##ui64
+
+// 7.18.4.2 Macros for greatest-width integer constants
+#define INTMAX_C INT64_C
+#define UINTMAX_C UINT64_C
+
+#endif // __STDC_CONSTANT_MACROS ]
+
+
+#endif // _MSC_STDINT_H_ ]
diff --git a/libnet/msvcbuild.bat b/libnet/msvcbuild.bat
new file mode 100644
index 0000000..2cfc3dc
--- /dev/null
+++ b/libnet/msvcbuild.bat
@@ -0,0 +1,24 @@
+@rem Script to build libnet under "Visual Studio .NET Command Prompt".
+@rem Dependencies are:
+@rem winpcap, specifically, the winpcap developer pack
+
+@setlocal
+@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE
+@set MYLINK=link /nologo
+@set MYMT=mt /nologo
+
+@rem relative to C code in src/
+@set WINPCAP=..\..\..\WpdPack
+
+copy include\win32\libnet.h include\
+copy include\win32\stdint.h include\libnet\
+
+cd src
+%MYCOMPILE% /I..\include /I%WINPCAP%\Include libnet_a*.c libnet_build_*.c libnet_c*.c libnet_dll.c libnet_error.c libnet_i*.c libnet_link_win32.c libnet_p*.c libnet_raw.c libnet_resolve.c libnet_version.c libnet_write.c
+%MYLINK% /DLL /libpath:%WINPCAP%\Lib /out:libnet.dll *.obj Advapi32.lib
+if exist libnet.dll.manifest^
+ %MYMT% -manifest libnet.dll.manifest -outputresource:libnet.dll;2
+cd ..
+
+exit /b %errorlevel%
+
diff --git a/libnet/sample/tftp.c b/libnet/sample/tftp.c
index f190a86..30d3393 100644
--- a/libnet/sample/tftp.c
+++ b/libnet/sample/tftp.c
@@ -49,7 +49,7 @@ main(int argc, char *argv[])
char *filename = "/etc/passwd";
char mode[] = "netascii";
u_char *payload = NULL;
- uint payload_s = 0;
+ uint32_t payload_s = 0;
printf("libnet 1.1 packet shaping: UDP + payload[raw] == TFTP\n");
diff --git a/libnet/src/common.h b/libnet/src/common.h
index 1d7b4d3..704f68e 100644
--- a/libnet/src/common.h
+++ b/libnet/src/common.h
@@ -27,15 +27,17 @@
*
*/
-#include "../include/config.h"
-
#if (_WIN32) || (__CYGWIN__)
-#include "../include/win32/libnet.h"
+/* MSVC warns about snprintf */
+#define _CRT_SECURE_NO_WARNINGS
+
#include "../include/win32/config.h"
+#include "../include/win32/libnet.h"
#else
+#include "../include/config.h"
#include "../include/libnet.h"
#include <assert.h>
diff --git a/libnet/src/libnet_build_dns.c b/libnet/src/libnet_build_dns.c
index bb282cc..26c6f3a 100644
--- a/libnet/src/libnet_build_dns.c
+++ b/libnet/src/libnet_build_dns.c
@@ -41,7 +41,7 @@ libnet_build_dnsv4(uint16_t h_len, uint16_t id, uint16_t flags,
{
uint32_t n, h;
- uint offset;
+ uint32_t offset;
libnet_pblock_t *p;
struct libnet_dnsv4_hdr dns_hdr;
diff --git a/libnet/src/libnet_build_ospf.c b/libnet/src/libnet_build_ospf.c
index 9806714..8f9fe90 100644
--- a/libnet/src/libnet_build_ospf.c
+++ b/libnet/src/libnet_build_ospf.c
@@ -201,7 +201,7 @@ bad:
libnet_ptag_t
-libnet_build_ospfv2_lsr(uint32_t type, uint lsid, uint32_t advrtr,
+libnet_build_ospfv2_lsr(uint32_t type, uint32_t lsid, uint32_t advrtr,
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
{
uint32_t n, h;
@@ -295,7 +295,7 @@ bad:
libnet_ptag_t
-libnet_build_ospfv2_lsa(uint16_t age, uint8_t opts, uint8_t type, uint lsid,
+libnet_build_ospfv2_lsa(uint16_t age, uint8_t opts, uint8_t type, uint32_t lsid,
uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len,
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
{
@@ -460,7 +460,7 @@ bad:
libnet_ptag_t
-libnet_build_ospfv2_lsa_sum(uint32_t nmask, uint32_t metric, uint tos,
+libnet_build_ospfv2_lsa_sum(uint32_t nmask, uint32_t metric, uint32_t tos,
const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
{
uint32_t n, h;
@@ -509,7 +509,7 @@ bad:
libnet_ptag_t
-libnet_build_ospfv2_lsa_as(uint32_t nmask, uint metric, uint32_t fwdaddr,
+libnet_build_ospfv2_lsa_as(uint32_t nmask, uint32_t metric, uint32_t fwdaddr,
uint32_t tag, const uint8_t *payload, uint32_t payload_s, libnet_t *l,
libnet_ptag_t ptag)
{
diff --git a/libnet/src/libnet_cq.c b/libnet/src/libnet_cq.c
index 7f05204..6ff5266 100644
--- a/libnet/src/libnet_cq.c
+++ b/libnet/src/libnet_cq.c
@@ -44,7 +44,7 @@ static libnet_cqd_t l_cqd = {0, CQ_LOCK_UNLOCKED, NULL};
static int
-set_cq_lock(uint x)
+set_cq_lock(uint32_t x)
{
if (check_cq_lock(x))
{
@@ -56,7 +56,7 @@ set_cq_lock(uint x)
}
static int
-clear_cq_lock(uint x)
+clear_cq_lock(uint32_t x)
{
if (!check_cq_lock(x))
{
diff --git a/libnet/src/libnet_crc.c b/libnet/src/libnet_crc.c
index 886f5dc..85c3056 100644
--- a/libnet/src/libnet_crc.c
+++ b/libnet/src/libnet_crc.c
@@ -33,7 +33,7 @@
#include "common.h"
/* CRC routines based off of sample code in appendix of RFC 2083 */
-static uint crc_table[256] =
+static uint32_t crc_table[256] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
diff --git a/libnet/src/libnet_if_addr.c b/libnet/src/libnet_if_addr.c
index 082e022..ff4621f 100644
--- a/libnet/src/libnet_if_addr.c
+++ b/libnet/src/libnet_if_addr.c
@@ -104,8 +104,7 @@ libnet_check_iface(libnet_t *l)
#endif
int
-libnet_ifaddrlist(register struct libnet_ifaddr_list **ipaddrp, char *dev,
-register char *errbuf)
+libnet_ifaddrlist(register struct libnet_ifaddr_list **ipaddrp, char *dev, register char *errbuf)
{
register struct libnet_ifaddr_list *al;
struct ifreq *ifr, *lifr, *pifr, nifr;
@@ -274,6 +273,9 @@ register char *errbuf)
return (nipaddr);
}
#else
+/* WIN32 support *
+/* TODO move win32 support into win32 specific source file */
+
/* From tcptraceroute, convert a numeric IP address to a string */
#define IPTOSBUFFERS 12
static int8_t *iptos(uint32_t in)
@@ -290,43 +292,58 @@ static int8_t *iptos(uint32_t in)
}
int
-libnet_ifaddrlist(register struct libnet_ifaddr_list **ipaddrp, char *dev,
-register char *errbuf)
+libnet_ifaddrlist(register struct libnet_ifaddr_list **ipaddrp, char *dev_unused, register char *errbuf)
{
- int nipaddr = 0; int i = 0;
-
+ int nipaddr = 0;
+ int i = 0;
static struct libnet_ifaddr_list ifaddrlist[MAX_IPADDR];
- pcap_if_t *alldevs;
- pcap_if_t *d;
+ pcap_if_t *devlist = NULL;
+ pcap_if_t *dev = NULL;
int8_t err[PCAP_ERRBUF_SIZE];
/* Retrieve the interfaces list */
- if (pcap_findalldevs(&alldevs, err) == -1)
+ if (pcap_findalldevs(&devlist, err) == -1)
{
snprintf(errbuf, LIBNET_ERRBUF_SIZE,
"%s(): error in pcap_findalldevs: %s", __func__, err);
return (-1);
}
- /* Scan the list printing every entry */
- for (d = alldevs; d; d = d->next)
+ for (dev = devlist; dev; dev = dev->next)
{
- if((!d->addresses) || (d->addresses->addr->sa_family != AF_INET))
- continue;
- if(d->flags & PCAP_IF_LOOPBACK)
- continue;
-
- /* XXX - strdup */
- ifaddrlist[i].device = strdup(d->name);
- ifaddrlist[i].addr = (uint32_t)
- strdup(iptos(((struct sockaddr_in *)
- d->addresses->addr)->sin_addr.s_addr));
- ++i;
- ++nipaddr;
+ struct pcap_addr* pcapaddr;
+ for(pcapaddr = dev->addresses; pcapaddr; pcapaddr = pcapaddr->next) {
+ struct sockaddr* addr = pcapaddr->addr;
+#if 0
+ printf("if name '%s' description '%s' loop? %d\n", dev->name, dev->description, dev->flags);
+ {
+ char p[NI_MAXHOST] = "";
+ int sz = sizeof(struct sockaddr_storage);
+ int r;
+ r = getnameinfo(addr, sz, p, sizeof(p), NULL,0, NI_NUMERICHOST);
+ printf(" addr %s\n", r ? gai_strerror(r) : p);
+ }
+#endif
+
+ if(dev->flags & PCAP_IF_LOOPBACK)
+ continue;
+
+ /* this code ignores IPv6 addresses, a limitation of the libnet_ifaddr_list struct */
+
+ if(addr->sa_family == AF_INET) {
+ ifaddrlist[i].device = strdup(dev->name);
+ ifaddrlist[i].addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
+ ++i;
+ ++nipaddr;
+ }
+ }
}
+ pcap_freealldevs(devlist);
+
*ipaddrp = ifaddrlist;
- return (nipaddr);
+
+ return nipaddr;
}
#endif /* __WIN32__ */
@@ -361,7 +378,6 @@ libnet_select_device(libnet_t *l)
c = libnet_ifaddrlist(&address_list, l->device, l->err_buf);
if (c < 0)
{
- /* err msg set in libnet_ifaddrlist() */
return (-1);
}
else if (c == 0)
@@ -374,16 +390,15 @@ libnet_select_device(libnet_t *l)
al = address_list;
if (l->device)
{
- /*
- * Then we have an IP address in l->device => do lookup
- */
addr = libnet_name2addr4(l, l->device, 0);
for (i = c; i; --i, ++address_list)
{
- if (((addr == -1) && !(strncmp(l->device, address_list->device,
- strlen(l->device)))) ||
- (address_list->addr == addr))
+ if (
+ 0 == strcmp(l->device, address_list->device)
+ ||
+ address_list->addr == addr
+ )
{
/* free the "user supplied device" - see libnet_init() */
free(l->device);
diff --git a/libnet/src/libnet_link_win32.c b/libnet/src/libnet_link_win32.c
index 40f84f0..ab68d71 100644
--- a/libnet/src/libnet_link_win32.c
+++ b/libnet/src/libnet_link_win32.c
@@ -32,10 +32,17 @@
*
*/
-#include "common.h"
+/* MSVC warns about snprintf. This needs to be defined before the declaration of _snprintf is seen. */
+#define _CRT_SECURE_NO_WARNINGS
+/* Libnet's unnamespaced ICMP6_ macros stomp on the enumerated versions of
+ these names in the MS headers, so pre-include this header. */
#include <winsock2.h>
#include <iphlpapi.h> /* From the Microsoft Platform SDK */
+
+#include "common.h"
+
+#include <winsock2.h>
#include <assert.h>
#include <Packet32.h>
#include <Ntddndis.h>
@@ -148,8 +155,9 @@ libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size)
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
"%s(): failed to allocate the LPPACKET structure", __func__);
- return (-1);
+ return (-1);
}
+ /* FIXME Packet* arguments aren't const, are they actually modified? That would be a problem, we can't modify our input */
PacketInitPacket(lpPacket, packet, size);
/* PacketSendPacket returns a BOOLEAN */
@@ -226,15 +234,10 @@ libnet_get_hwaddr(libnet_t *l)
mac->ether_addr_octet[i] = OidData->Data[i];
}
}
- free(OidData);
- return(mac);
+ free(OidData);
+ return(mac);
}
-struct hostent *gethostbyname2(const int8_t *name, int af)
-{
- /* XXX not implemented */
- return(NULL);
-}
BYTE *
libnet_win32_get_remote_mac(libnet_t *l, DWORD DestIP)
diff --git a/libnet/src/libnet_pblock.c b/libnet/src/libnet_pblock.c
index a9f239b..bf2a548 100644
--- a/libnet/src/libnet_pblock.c
+++ b/libnet/src/libnet_pblock.c
@@ -31,6 +31,7 @@
*/
#include "common.h"
+#include <assert.h>
libnet_pblock_t *
libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, uint32_t b_len, uint8_t type)
diff --git a/libnet/src/libnet_prand.c b/libnet/src/libnet_prand.c
index 6c44539..f37c435 100644
--- a/libnet/src/libnet_prand.c
+++ b/libnet/src/libnet_prand.c
@@ -62,7 +62,11 @@ libnet_seed_prand(libnet_t *l)
return (1);
}
-
+/* FIXME this code makes no sense. On unix we use random(), which
+ * is intended to have no security, and under win32 we use cryptographically
+ * strong entropy source? If necessary, why aren't we using /dev/random
+ * on unix? What's going on here?
+ */
uint32_t
libnet_get_prand(int mod)
{
diff --git a/libnet/src/libnet_resolve.c b/libnet/src/libnet_resolve.c
index 51039e1..6b9e30f 100644
--- a/libnet/src/libnet_resolve.c
+++ b/libnet/src/libnet_resolve.c
@@ -117,7 +117,7 @@ libnet_name2addr4(libnet_t *l, char *host_name, uint8_t use_name)
struct in_addr addr;
struct hostent *host_ent;
uint32_t m;
- uint val;
+ uint32_t val;
int i;
if (use_name == LIBNET_RESOLVE)
@@ -127,7 +127,14 @@ libnet_name2addr4(libnet_t *l, char *host_name, uint8_t use_name)
if (!(host_ent = gethostbyname(host_name)))
{
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
- "%s(): %s", __func__, hstrerror(h_errno));
+ "%s(): %s", __func__,
+#if (_WIN32)
+ "gethostbyname failure"
+#else
+ /* FIXME doesn't exist on windows, needs WSAGetLastError()/FormatMessage */
+ hstrerror(h_errno)
+#endif
+ );
/* XXX - this is actually 255.255.255.255 */
return (-1);
}
diff --git a/libnet/src/libnet_version.c b/libnet/src/libnet_version.c
index 87782ed..7631a7b 100644
--- a/libnet/src/libnet_version.c
+++ b/libnet/src/libnet_version.c
@@ -30,19 +30,16 @@
*
*/
-#if (!(_WIN32) || (__CYGWIN__))
-#include <unistd.h>
-#include "../version.h"
-#else
-#include "../include/win32/libnet.h"
-#endif
+#include "common.h"
#ifndef STDOUT_FILENO
#define STDOUT_FILENO 1
#endif
-static const char banner[] = "libnet version "VERSION"";
+static const char banner[] = "libnet version " LIBNET_VERSION "";
+#if 0
+/* FIXME can find no sign this is used anywhere */
void
__libnet_print_vers(void)
{
@@ -55,6 +52,7 @@ __libnet_print_vers(void)
(void)write(STDOUT_FILENO, banner, sizeof(banner) - 1);
#endif
}
+#endif
const char *
libnet_version(void)
diff --git a/libnet/src/libnet_write.c b/libnet/src/libnet_write.c
index a70022c..5c8717c 100644
--- a/libnet/src/libnet_write.c
+++ b/libnet/src/libnet_write.c
@@ -121,7 +121,7 @@ done:
#if defined (__WIN32__)
libnet_ptag_t
libnet_win32_build_fake_ethernet(uint8_t *dst, uint8_t *src, uint16_t type,
-uint8_t *payload, uint32_t payload_s, uint8_t *packet, libnet_t *l,
+const uint8_t *payload, uint32_t payload_s, uint8_t *packet, libnet_t *l,
libnet_ptag_t ptag)
{
struct libnet_ethernet_hdr eth_hdr;
@@ -150,7 +150,7 @@ libnet_ptag_t ptag)
libnet_ptag_t
libnet_win32_build_fake_token(uint8_t *dst, uint8_t *src, uint16_t type,
-uint8_t *payload, uint32_t payload_s, uint8_t *packet, libnet_t *l,
+const uint8_t *payload, uint32_t payload_s, uint8_t *packet, libnet_t *l,
libnet_ptag_t ptag)
{
struct libnet_token_ring_hdr token_ring_hdr;
@@ -209,9 +209,11 @@ libnet_win32_write_raw_ipv4(libnet_t *l, const uint8_t *payload, uint32_t payloa
"%s(): failed to allocate packet", __func__);
return (-1);
}
-
+ /* FIXME all the return paths below, except the last, leak 'packet' */
+
/* we have to do the IP checksum */
- if (libnet_do_checksum(l, payload, IPPROTO_IP, LIBNET_IPV4_H) == -1)
+ /* FIXME MSVC warning is correct, checksum modifies its input. Fix is to build checksum inside the allocated 'packet' */
+ if (libnet_inet_checksum(l, payload, IPPROTO_IP, LIBNET_IPV4_H, payload, payload+payload_s) == -1)
{
/* error msg set in libnet_do_checksum */
return (-1);
diff --git a/libnet/version.h.in b/libnet/version.h.in
deleted file mode 100644
index 7e7992e..0000000
--- a/libnet/version.h.in
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * $Id: version.h.in,v 1.1.1.1 2003/06/26 21:55:10 route Exp $
- * @configure_input@
- */
-
-#define VERSION "@PACKAGE_VERSION@"
-
diff --git a/libnet/win32/Libnet-1.1.1-2002.sln b/libnet/win32/Libnet-1.1.1-2002.sln
deleted file mode 100644
index 831677d..0000000
--- a/libnet/win32/Libnet-1.1.1-2002.sln
+++ /dev/null
@@ -1,77 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Libnet-latest-006", "Libnet-latest.vcproj", "{6A0551E1-E416-4125-BCC0-F18F2D601806}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "arp", "..\sample\win32\arp\arp.vcproj", "{8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdp", "..\sample\win32\cdp\cdp.vcproj", "{8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dhcp_discover", "..\sample\win32\dhcp_discover\dhcp_discover.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get_addr", "..\sample\win32\get_addr\get_addr.vcproj", "{DA921F29-B6BE-4E55-9040-B6DD434F1E43}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icmp_echo_cq", "..\sample\win32\icmp_echo_cq\icmp_echo_cq.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcp1", "..\sample\win32\tcp1\tcp1.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udp1", "..\sample\win32\udp1\udp1.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dns", "..\sample\win32\dns\dns.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Debug.ActiveCfg = Debug|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Debug.Build.0 = Debug|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Release.ActiveCfg = Debug|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Release.Build.0 = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.ActiveCfg = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.Build.0 = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.ActiveCfg = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.Build.0 = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.ActiveCfg = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.Build.0 = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.ActiveCfg = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Debug.ActiveCfg = Debug|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Debug.Build.0 = Debug|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Release.ActiveCfg = Release|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/libnet/win32/Libnet-1.1.1-2003.ncb b/libnet/win32/Libnet-1.1.1-2003.ncb
deleted file mode 100644
index 71d907f..0000000
--- a/libnet/win32/Libnet-1.1.1-2003.ncb
+++ /dev/null
Binary files differ
diff --git a/libnet/win32/Libnet-1.1.1-2003.sln b/libnet/win32/Libnet-1.1.1-2003.sln
deleted file mode 100644
index 78de55b..0000000
--- a/libnet/win32/Libnet-1.1.1-2003.sln
+++ /dev/null
@@ -1,84 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "arp", "..\sample\win32\arp\arp.vcproj", "{8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}"
- ProjectSection(ProjectDependencies) = postProject
- {6A0551E1-E416-4125-BCC0-F18F2D601806} = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdp", "..\sample\win32\cdp\cdp.vcproj", "{8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}"
- ProjectSection(ProjectDependencies) = postProject
- {6A0551E1-E416-4125-BCC0-F18F2D601806} = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dhcp_discover", "..\sample\win32\dhcp_discover\dhcp_discover.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
- ProjectSection(ProjectDependencies) = postProject
- {6A0551E1-E416-4125-BCC0-F18F2D601806} = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get_addr", "..\sample\win32\get_addr\get_addr.vcproj", "{DA921F29-B6BE-4E55-9040-B6DD434F1E43}"
- ProjectSection(ProjectDependencies) = postProject
- {6A0551E1-E416-4125-BCC0-F18F2D601806} = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icmp_echo_cq", "..\sample\win32\icmp_echo_cq\icmp_echo_cq.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
- ProjectSection(ProjectDependencies) = postProject
- {6A0551E1-E416-4125-BCC0-F18F2D601806} = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcp1", "..\sample\win32\tcp1\tcp1.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
- ProjectSection(ProjectDependencies) = postProject
- {6A0551E1-E416-4125-BCC0-F18F2D601806} = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udp1", "..\sample\win32\udp1\udp1.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
- ProjectSection(ProjectDependencies) = postProject
- {6A0551E1-E416-4125-BCC0-F18F2D601806} = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Libnet-1.1.1", "Libnet-1.1.1.vcproj", "{6A0551E1-E416-4125-BCC0-F18F2D601806}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.ActiveCfg = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.Build.0 = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.ActiveCfg = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.Build.0 = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.ActiveCfg = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.Build.0 = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.ActiveCfg = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Debug.ActiveCfg = Debug|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Debug.Build.0 = Debug|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Release.ActiveCfg = Release|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Debug.ActiveCfg = Debug|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Debug.Build.0 = Debug|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Release.ActiveCfg = Release|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/libnet/win32/Libnet-1.1.1-2003.suo b/libnet/win32/Libnet-1.1.1-2003.suo
deleted file mode 100644
index 10d53e2..0000000
--- a/libnet/win32/Libnet-1.1.1-2003.suo
+++ /dev/null
Binary files differ
diff --git a/libnet/win32/Libnet-1.1.1.vcproj b/libnet/win32/Libnet-1.1.1.vcproj
deleted file mode 100644
index 09b4899..0000000
--- a/libnet/win32/Libnet-1.1.1.vcproj
+++ /dev/null
@@ -1,311 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="Libnet"
- ProjectGUID="{6A0551E1-E416-4125-BCC0-F18F2D601806}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- ATLMinimizesCRunTimeLibraryUsage="TRUE"
- CharacterSet="2"
- WholeProgramOptimization="FALSE">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="/LDd"
- Optimization="0"
- OptimizeForProcessor="0"
- AdditionalIncludeDirectories=".\src;.\include;..\winpcap\wpcap\libpcap\Win32\Include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBNETLATEST_EXPORTS"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- BufferSecurityCheck="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="FALSE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/Libnet.dll"
- LinkIncremental="2"
- ModuleDefinitionFile="libnet_dll.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/Libnet-latest.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/Libnet.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="/LD"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="TRUE"
- AdditionalIncludeDirectories=".\include;.\src;..\winpcap\wpcap\libpcap\Win32\Include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBNETLATEST_EXPORTS"
- StringPooling="TRUE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="FALSE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/Libnet.dll"
- LinkIncremental="1"
- ModuleDefinitionFile="libnet_dll.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/Libnet.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
- <File
- RelativePath="..\src\libnet_advanced.c">
- </File>
- <File
- RelativePath="..\src\libnet_asn1.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_802.1q.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_802.1x.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_802.2.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_802.3.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_arp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_bgp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_cdp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_data.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_dhcp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_dns.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ethernet.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_fddi.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_gre.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_icmp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_igmp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ip.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ipsec.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_isl.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_link.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_mpls.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ntp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ospf.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_rip.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_rpc.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_snmp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_stp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_tcp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_token_ring.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_udp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_vrrp.c">
- </File>
- <File
- RelativePath="..\src\libnet_checksum.c">
- </File>
- <File
- RelativePath="..\src\libnet_cq.c">
- </File>
- <File
- RelativePath="..\src\libnet_crc.c">
- </File>
- <File
- RelativePath="..\src\libnet_dll.c">
- </File>
- <File
- RelativePath="libnet_dll.def">
- </File>
- <File
- RelativePath="..\src\libnet_error.c">
- </File>
- <File
- RelativePath="..\src\libnet_if_addr.c">
- </File>
- <File
- RelativePath="..\src\libnet_init.c">
- </File>
- <File
- RelativePath="..\src\libnet_internal.c">
- </File>
- <File
- RelativePath="..\src\libnet_link_win32.c">
- </File>
- <File
- RelativePath="..\src\libnet_pblock.c">
- </File>
- <File
- RelativePath="..\src\libnet_port_list.c">
- </File>
- <File
- RelativePath="..\src\libnet_prand.c">
- </File>
- <File
- RelativePath="..\src\libnet_raw.c">
- </File>
- <File
- RelativePath="..\src\libnet_resolve.c">
- </File>
- <File
- RelativePath="..\src\libnet_version.c">
- </File>
- <File
- RelativePath="..\src\libnet_write.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc">
- <File
- RelativePath="..\include\win32\config.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-asn1.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-functions.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-headers.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-macros.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-structures.h">
- </File>
- <File
- RelativePath="..\include\win32\libnet.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/libnet/win32/Libnet-latest.ncb b/libnet/win32/Libnet-latest.ncb
deleted file mode 100644
index d14a41e..0000000
--- a/libnet/win32/Libnet-latest.ncb
+++ /dev/null
Binary files differ
diff --git a/libnet/win32/Libnet-latest.opt b/libnet/win32/Libnet-latest.opt
deleted file mode 100644
index 30d86d9..0000000
--- a/libnet/win32/Libnet-latest.opt
+++ /dev/null
Binary files differ
diff --git a/libnet/win32/Libnet-latest.sln b/libnet/win32/Libnet-latest.sln
deleted file mode 100644
index 831677d..0000000
--- a/libnet/win32/Libnet-latest.sln
+++ /dev/null
@@ -1,77 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Libnet-latest-006", "Libnet-latest.vcproj", "{6A0551E1-E416-4125-BCC0-F18F2D601806}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "arp", "..\sample\win32\arp\arp.vcproj", "{8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdp", "..\sample\win32\cdp\cdp.vcproj", "{8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dhcp_discover", "..\sample\win32\dhcp_discover\dhcp_discover.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get_addr", "..\sample\win32\get_addr\get_addr.vcproj", "{DA921F29-B6BE-4E55-9040-B6DD434F1E43}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icmp_echo_cq", "..\sample\win32\icmp_echo_cq\icmp_echo_cq.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcp1", "..\sample\win32\tcp1\tcp1.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udp1", "..\sample\win32\udp1\udp1.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dns", "..\sample\win32\dns\dns.vcproj", "{482A29C5-AAD2-478A-AE7B-089BE39F25B4}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.0 = {6A0551E1-E416-4125-BCC0-F18F2D601806}
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Debug.ActiveCfg = Debug|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Debug.Build.0 = Debug|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Release.ActiveCfg = Debug|Win32
- {6A0551E1-E416-4125-BCC0-F18F2D601806}.Release.Build.0 = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.ActiveCfg = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.Build.0 = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.ActiveCfg = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.Build.0 = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.ActiveCfg = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Debug.Build.0 = Debug|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.ActiveCfg = Release|Win32
- {8DB5763E-7AA2-43BE-9D7A-1F4138DEA904}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Debug.ActiveCfg = Debug|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Debug.Build.0 = Debug|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Release.ActiveCfg = Release|Win32
- {DA921F29-B6BE-4E55-9040-B6DD434F1E43}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.ActiveCfg = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Debug.Build.0 = Debug|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.ActiveCfg = Release|Win32
- {482A29C5-AAD2-478A-AE7B-089BE39F25B4}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/libnet/win32/Libnet-latest.suo b/libnet/win32/Libnet-latest.suo
deleted file mode 100644
index d591cf6..0000000
--- a/libnet/win32/Libnet-latest.suo
+++ /dev/null
Binary files differ
diff --git a/libnet/win32/Libnet-latest.vcproj b/libnet/win32/Libnet-latest.vcproj
deleted file mode 100644
index 56c3d7a..0000000
--- a/libnet/win32/Libnet-latest.vcproj
+++ /dev/null
@@ -1,311 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="Libnet"
- ProjectGUID="{6A0551E1-E416-4125-BCC0-F18F2D601806}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- ATLMinimizesCRunTimeLibraryUsage="TRUE"
- CharacterSet="2"
- WholeProgramOptimization="FALSE">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="/LDd"
- Optimization="0"
- OptimizeForProcessor="0"
- AdditionalIncludeDirectories=".\src;.\include;..\winpcap\wpcap\libpcap\Win32\Include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBNETLATEST_EXPORTS"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- BufferSecurityCheck="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="FALSE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="c:\winnt\system32\Libnet.dll"
- LinkIncremental="2"
- ModuleDefinitionFile="libnet_dll.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/Libnet.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/Libnet.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="/LD"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="TRUE"
- AdditionalIncludeDirectories=".\include;.\src;..\winpcap\wpcap\libpcap\Win32\Include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBNETLATEST_EXPORTS"
- StringPooling="TRUE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="FALSE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="c:\winnt\system32\Libnet.dll"
- LinkIncremental="1"
- ModuleDefinitionFile="libnet_dll.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/Libnet.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
- <File
- RelativePath="..\src\libnet_advanced.c">
- </File>
- <File
- RelativePath="..\src\libnet_asn1.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_802.1q.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_802.1x.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_802.2.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_802.3.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_arp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_bgp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_cdp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_data.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_dhcp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_dns.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ethernet.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_fddi.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_gre.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_icmp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_igmp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ip.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ipsec.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_isl.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_link.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_mpls.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ntp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_ospf.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_rip.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_rpc.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_snmp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_stp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_tcp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_token_ring.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_udp.c">
- </File>
- <File
- RelativePath="..\src\libnet_build_vrrp.c">
- </File>
- <File
- RelativePath="..\src\libnet_checksum.c">
- </File>
- <File
- RelativePath="..\src\libnet_cq.c">
- </File>
- <File
- RelativePath="..\src\libnet_crc.c">
- </File>
- <File
- RelativePath="..\src\libnet_dll.c">
- </File>
- <File
- RelativePath="libnet_dll.def">
- </File>
- <File
- RelativePath="..\src\libnet_error.c">
- </File>
- <File
- RelativePath="..\src\libnet_if_addr.c">
- </File>
- <File
- RelativePath="..\src\libnet_init.c">
- </File>
- <File
- RelativePath="..\src\libnet_internal.c">
- </File>
- <File
- RelativePath="..\src\libnet_link_win32.c">
- </File>
- <File
- RelativePath="..\src\libnet_pblock.c">
- </File>
- <File
- RelativePath="..\src\libnet_port_list.c">
- </File>
- <File
- RelativePath="..\src\libnet_prand.c">
- </File>
- <File
- RelativePath="..\src\libnet_raw.c">
- </File>
- <File
- RelativePath="..\src\libnet_resolve.c">
- </File>
- <File
- RelativePath="..\src\libnet_version.c">
- </File>
- <File
- RelativePath="..\src\libnet_write.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc">
- <File
- RelativePath="..\include\win32\config.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-asn1.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-functions.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-headers.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-macros.h">
- </File>
- <File
- RelativePath="..\include\libnet\libnet-structures.h">
- </File>
- <File
- RelativePath="..\include\win32\libnet.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/libnet/win32/Libnet.dsp b/libnet/win32/Libnet.dsp
deleted file mode 100644
index b221637..0000000
--- a/libnet/win32/Libnet.dsp
+++ /dev/null
@@ -1,337 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Libnet" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=Libnet - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Libnet.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Libnet.mak" CFG="Libnet - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Libnet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "Libnet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "Libnet - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBNET_EXPORTS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBNET_EXPORTS" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/Libnet-1.1.1.dll"
-
-!ELSEIF "$(CFG)" == "Libnet - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBNET_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBNET_EXPORTS" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "Libnet - Win32 Release"
-# Name "Libnet - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\src\libnet_advanced.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_asn1.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_802.1q.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_802.1x.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_802.2.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_802.3.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_arp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_bgp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_cdp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_data.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_dhcp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_dns.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_ethernet.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_fddi.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_gre.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_icmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_igmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_ip.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_ipsec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_isl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_mpls.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_ntp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_ospf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_rip.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_rpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_snmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_stp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_tcp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_token_ring.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_udp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_build_vrrp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_checksum.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_cq.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_crc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_dll.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libnet_dll.def
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_error.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_if_addr.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_init.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_internal.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_link_win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_pblock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_port_list.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_prand.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_raw.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_resolve.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_version.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\libnet_write.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\include\win32\config.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\libnet\libnet-asn1.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\libnet\libnet-functions.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\libnet\libnet-headers.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\libnet\libnet-macros.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\libnet\libnet-structures.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\libnet\libnet-types.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\win32\libnet.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\ReadMe.txt
-# End Source File
-# End Target
-# End Project
diff --git a/libnet/win32/Libnet.dsw b/libnet/win32/Libnet.dsw
deleted file mode 100644
index 7a07d7a..0000000
--- a/libnet/win32/Libnet.dsw
+++ /dev/null
@@ -1,32 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "Libnet"=".\Libnet.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name wpcap
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/libnet/win32/Makefile.am b/libnet/win32/Makefile.am
deleted file mode 100644
index 6c55ce6..0000000
--- a/libnet/win32/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-EXTRA_DIST = Libnet-1.1.1-2002.sln Libnet-1.1.1-2003.ncb \
- Libnet-1.1.1-2003.sln Libnet-1.1.1-2003.suo \
- Libnet-1.1.1.vcproj libnet_dll.def Libnet.dsp \
- Libnet.dsw Libnet-latest.ncb Libnet-latest.opt \
- Libnet-latest.sln Libnet-latest.suo Libnet-latest.vcproj README.txt
-
diff --git a/libnet/win32/README.txt b/libnet/win32/README.txt
deleted file mode 100644
index 074827a..0000000
--- a/libnet/win32/README.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-Libnet 1.1.1 VC++ Build instructions.
-Kirby Kuehl vacuum@users.sourceforge.net
-
-
-Tested Platforms:
-Windows 2000 SP4, Windows XP SP1
-
-Tested IDEs:
-VC++ 6.0 Service Pack 5
-Visual Studio .NET 2003
-Visual Studio .NET 2002
-
-Winpcap 3.01 Developers pack: http://winpcap.polito.it/install/default.htm
-Platform SDK : http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
-
-
-1. Extract Libnet tarball. (Probably unnecessary since you are reading this.)
-
-2. Download and extract Winpcap 3.x developer's pack from http://winpcap.polito.it/install/default.htm
- NOTE: Must download 3.x developer's pack. Do not use earlier versions.
-
-3. Open Libnet-1.1.1/win32/Libnet.dsw (If you are using VC++6.0)
- Libnet-1.1.1/win32/Libnet-1.1.1-2002.sln (If youa are using Visual Studio .NET 20002)
- Libnet-1.1.1/win32/Libnet-1.1.1-2003.sln (If youa are using Visual Studio .NET 20003)
-
-4. To properly setup the winpcap/libpcap dependencies.
-
- Visual Studio .NET Instructions.
- Select Tools/Options
- Under the options dialog, select Projects and then VC++ Directories
- Select Include files.
- Add the following path
- <path>wpdpack\Include
- Select Library paths.
- Add the following path
- <path>wpdpack\Lib
-
- Visual C++ 6.0 Instructions
- You will need to also install the Microsoft Platform SDK in order to have iphlpapi.h
- The platform SDK is available here: http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
- NOTE: The include order is important, or you will get redefinition errors. Put the platform sdk's directory first.
- Select Tools/Options
- Select the Directories Tab
- Select Include files.
- Add the following path
- <path>wpdpack\Include
- <path>Program Files\Microsoft SDK\include
- Select Library paths.
- Add the following path
- <path>wpdpack\Lib
- <path>Program Files\Microsoft SDK\Lib
-
-
-
-
-
-
diff --git a/libnet/win32/libnet_dll.def b/libnet/win32/libnet_dll.def
deleted file mode 100644
index f312fc8..0000000
--- a/libnet/win32/libnet_dll.def
+++ /dev/null
@@ -1,164 +0,0 @@
-LIBRARY Libnet
-
-EXPORTS
- gethostbyname2
- libnet_addr2name4_r
- libnet_addr2name4
- libnet_addr2name6_r
- libnet_adv_cull_header
- libnet_adv_cull_packet
- libnet_adv_free_packet
- libnet_adv_write_link
- libnet_autobuild_arp
- libnet_autobuild_ethernet
- libnet_autobuild_fddi
- libnet_autobuild_ipv4
- libnet_autobuild_ipv6
- libnet_autobuild_link
- libnet_autobuild_token_ring
- libnet_build_802_1q
- libnet_build_802_1x
- libnet_build_802_2snap
- libnet_build_802_2
- libnet_build_802_3
- libnet_build_arp
- libnet_build_asn1_bitstring
- libnet_build_asn1_header
- libnet_build_asn1_int
- libnet_build_asn1_length
- libnet_build_asn1_null
- libnet_build_asn1_objid
- libnet_build_asn1_sequence
- libnet_build_asn1_string
- libnet_build_asn1_uint
- libnet_build_bgp4_header
- libnet_build_bgp4_notification
- libnet_build_bgp4_open
- libnet_build_bgp4_update
- libnet_build_bootpv4
- libnet_build_cdp
- libnet_build_cdp_value
- libnet_build_data
- libnet_build_dhcpv4
- libnet_build_dnsv4
- libnet_build_egre
- libnet_build_ethernet
- libnet_build_fddi
- libnet_build_gre_last_sre
- libnet_build_gre_sre
- libnet_build_gre
- libnet_build_icmpv4_echo
- libnet_build_icmpv4_mask
- libnet_build_icmpv4_redirect
- libnet_build_icmpv4_timeexceed
- libnet_build_icmpv4_timestamp
- libnet_build_icmpv4_unreach
- libnet_build_igmp
- libnet_build_ipsec_ah
- libnet_build_ipsec_esp_ftr
- libnet_build_ipsec_esp_hdr
- libnet_build_ipv4_options
- libnet_build_ipv4
- libnet_build_ipv6
- libnet_build_ipv6_destopts
- libnet_build_ipv6_frag
- libnet_build_ipv6_hbhopts
- libnet_build_ipv6_routing
- libnet_build_isl
- libnet_build_link
- libnet_build_mpls
- libnet_build_ntp
- libnet_build_ospfv2_dbd
- libnet_build_ospfv2_hello
- libnet_build_ospfv2_lsa_as
- libnet_build_ospfv2_lsa_net
- libnet_build_ospfv2_lsa_rtr
- libnet_build_ospfv2_lsa_sum
- libnet_build_ospfv2_lsa
- libnet_build_ospfv2_lsr
- libnet_build_ospfv2_lsu
- libnet_build_ospfv2
- libnet_build_rip
- libnet_build_rpc_call
- libnet_build_snmp
- libnet_build_stp_conf
- libnet_build_stp_tcn
- libnet_build_tcp_options
- libnet_build_tcp
- libnet_build_token_ring
- libnet_build_udp
- libnet_build_vrrp
- libnet_clear_packet
- libnet_close_link_interface
- libnet_close_raw4
- libnet_close_raw6
- libnet_compute_crc
- libnet_cq_add
- libnet_cq_destroy
- libnet_cq_find_by_label
- libnet_cq_getlabel
- libnet_cq_head
- libnet_cq_last
- libnet_cq_next
- libnet_cq_remove_by_label
- libnet_cq_remove
- libnet_cq_size
- libnet_destroy
- libnet_diag_dump_context
- libnet_diag_dump_hex
- libnet_diag_dump_pblock
- libnet_diag_dump_pblock_type
- libnet_do_checksum
- libnet_getdevice
- libnet_geterror
- libnet_getfd
- libnet_getgre_length
- libnet_getpacket_size
- libnet_get_hwaddr
- libnet_get_ipaddr4
- libnet_get_ipaddr6
- libnet_getpbuf
- libnet_getpbuf_size
- libnet_get_prand
- libnet_hex_aton
- libnet_ifaddrlist
- libnet_in_cksum
- libnet_init
- libnet_ip_check
- libnet_name2addr4
- libnet_name2addr6
- libnet_open_link
- libnet_open_raw4
- libnet_open_raw6
- libnet_pblock_append
- libnet_pblock_coalesce
- libnet_pblock_delete
- libnet_pblock_find
- libnet_pblock_insert_before
- libnet_pblock_new
- libnet_pblock_p2p
- libnet_pblock_probe
- libnet_pblock_setflags
- libnet_pblock_swap
- libnet_pblock_update
- libnet_plist_chain_dump
- libnet_plist_chain_dump_string
- libnet_plist_chain_free
- libnet_plist_chain_new
- libnet_plist_chain_next_pair
- libnet_seed_prand
- libnet_select_device
- libnet_stats
- libnet_toggle_checksum
- libnet_win32_build_fake_ethernet
- libnet_win32_build_fake_token
- libnet_win32_get_remote_mac
- libnet_win32_write_raw_ipv4
- libnet_write
- libnet_write_link
- libnet_write_raw_ipv4
- libnet_write_raw_ipv6
- __libnet_print_vers
-
-
-
diff --git a/lua/dnet.h.win32 b/lua/dnet.h.win32
new file mode 100644
index 0000000..de5498f
--- /dev/null
+++ b/lua/dnet.h.win32
@@ -0,0 +1 @@
+#include<dnet.h>
diff --git a/lua/msvcbuild.bat b/lua/msvcbuild.bat
new file mode 100644
index 0000000..0206ecf
--- /dev/null
+++ b/lua/msvcbuild.bat
@@ -0,0 +1,23 @@
+@rem Script to build lua binding under "Visual Studio .NET Command Prompt".
+@rem Dependencies are:
+@rem Lua
+@rem winpcap, specifically, the winpcap developer pack
+@rem dnet, Dug Song's net library, aka libdumbnet
+
+@setlocal
+@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE
+@set MYLINK=link /nologo
+@set MYMT=mt /nologo
+
+@set LUA=..\..\lua\src
+@set WINPCAP=..\..\WpdPack
+@set DNET=..\..\libdnet
+
+copy dnet.h.win32 dnet.h
+%MYCOMPILE% /I..\libnet\include /I%LUA% /I%WINPCAP%\Include /I%DNET%\include *.c
+%MYLINK% /DLL /export:luaopen_net /libpath:%WINPCAP%\Lib /out:net.dll *.obj %LUA%\lua51.lib ..\libnet\src\libnet.lib %DNET%\lib\dnet.lib
+if exist net.dll.manifest^
+ %MYMT% -manifest net.dll.manifest -outputresource:net.dll;2
+
+exit /b %errorlevel%
+
diff --git a/lua/net.c b/lua/net.c
index 48759ec..bbfa710 100644
--- a/lua/net.c
+++ b/lua/net.c
@@ -36,6 +36,8 @@ THE POSSIBILITY OF SUCH DAMAGE.
#include "libnet_decode.h"
#include <libnet.h>
+
+#define LUA_LIB /* To pull in LUA_API definitions for modules */
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
@@ -1294,6 +1296,8 @@ static int lnet_chksum(lua_State *L)
return 1;
}
+#ifndef _WIN32
+/* TODO see http://stackoverflow.com/questions/7827062/is-there-a-windows-equivalent-of-nanosleep */
/*-
-- remaining = net.nanosleep(seconds)
@@ -1324,6 +1328,7 @@ static int lnet_nanosleep(lua_State *L)
}
}
+/* TODO use GetSystemTime or GetSystemTimeAsFileTime */
/*-
t = net.gettimeofday()
@@ -1343,6 +1348,8 @@ static int lnet_gettimeofday(lua_State *L)
}
}
+#endif
+
/*-
-- net.init(injection, device)
@@ -1415,8 +1422,10 @@ static const luaL_reg net[] =
{"pton", lnet_pton},
{"htons", lnet_htons},
{"checksum", lnet_chksum},
+#ifndef _WIN32
{"nanosleep", lnet_nanosleep},
{"gettimeofday", lnet_gettimeofday},
+#endif
{"init", lnet_init},
{NULL, NULL}
};