aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/randpkt.txt23
-rw-r--r--randpkt.c57
2 files changed, 55 insertions, 25 deletions
diff --git a/doc/randpkt.txt b/doc/randpkt.txt
index 1de2929859..1b42b2fc7d 100644
--- a/doc/randpkt.txt
+++ b/doc/randpkt.txt
@@ -1,6 +1,6 @@
Random Packet Generator
-----------------------
-$Id: randpkt.txt,v 1.1 1999/09/10 05:15:17 gram Exp $
+$Id: randpkt.txt,v 1.2 1999/09/10 15:38:58 gram Exp $
This small utility creates a libpcap trace file full of random packets.
You can control the number of packets, the maximum size of each packet,
@@ -84,27 +84,6 @@ in the following locations.
NULL,
WTAP_ENCAP_ETHERNET,
0 },
-
- { "fddi",
- "Fiber Distributed Data Interface",
- PKT_FDDI,
- NULL,
- WTAP_ENCAP_FDDI,
- 0 },
-
- { "llc",
- "Logical Link Control",
- PKT_LLC,
- pkt_llc,
- WTAP_ENCAP_TR,
- array_length(pkt_llc) },
-
- { "tr",
- "Token-Ring",
- PKT_TR,
- NULL,
- WTAP_ENCAP_TR,
- 0 }
};
Note that packets that designate only their datalink type have no sample
diff --git a/randpkt.c b/randpkt.c
index 213421c977..9a2ade5056 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -4,7 +4,7 @@
* Creates random packet traces. Useful for debugging sniffers by testing
* assumptions about the veracity of the data found in the packet.
*
- * $Id: randpkt.c,v 1.1 1999/09/10 05:15:10 gram Exp $
+ * $Id: randpkt.c,v 1.2 1999/09/10 15:38:48 gram Exp $
*
* Copyright (C) 1999 by Gilbert Ramirez <gram@xiexie.org>
*
@@ -51,8 +51,11 @@ enum {
PKT_ARP,
PKT_ETHERNET,
PKT_FDDI,
+ PKT_IP,
PKT_LLC,
- PKT_TR
+ PKT_TCP,
+ PKT_TR,
+ PKT_UDP
};
typedef struct {
@@ -72,6 +75,14 @@ guint8 pkt_arp[] = {
0x08, 0x06
};
+/* Ethernet, indicating IP */
+guint8 pkt_ip[] = {
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01,
+ 0x08, 0x00
+};
+
/* TR, indicating LLC */
guint8 pkt_llc[] = {
0x10, 0x40, 0x68, 0x00,
@@ -80,6 +91,37 @@ guint8 pkt_llc[] = {
0xc4, 0x67
};
+/* TR+LLC+IP, indicating TCP */
+guint8 pkt_tcp[] = {
+ 0x10, 0x40, 0x68, 0x00,
+ 0x19, 0x69, 0x95, 0x8b,
+ 0x00, 0x01, 0xfa, 0x68,
+ 0xc4, 0x67,
+
+ 0xaa, 0xaa, 0x03, 0x00,
+ 0x00, 0x00, 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x28,
+ 0x0b, 0x0b, 0x40, 0x00,
+ 0x20, 0x06, 0x85, 0x37,
+ 0xc0, 0xa8, 0x27, 0x01,
+ 0xc0, 0xa8, 0x22, 0x3c
+};
+
+/* Ethernet+IP, indicating UDP */
+guint8 pkt_udp[] = {
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x3c,
+ 0xc5, 0x9e, 0x40, 0x00,
+ 0xff, 0x11, 0xd7, 0xe0,
+ 0xd0, 0x15, 0x02, 0xb8,
+ 0x0a, 0x01, 0x01, 0x63
+};
+
/* This little data table drives the whole program */
pkt_example examples[] = {
{ "arp", "Address Resolution Protocol",
@@ -91,11 +133,20 @@ pkt_example examples[] = {
{ "fddi", "Fiber Distributed Data Interface",
PKT_FDDI, NULL, WTAP_ENCAP_FDDI, 0 },
+ { "ip", "Internet Protocol",
+ PKT_IP, pkt_ip, WTAP_ENCAP_ETHERNET, array_length(pkt_ip) },
+
{ "llc", "Logical Link Control",
PKT_LLC, pkt_llc, WTAP_ENCAP_TR, array_length(pkt_llc) },
+ { "tcp", "Transmission Control Protocol",
+ PKT_TCP, pkt_tcp, WTAP_ENCAP_TR, array_length(pkt_tcp) },
+
{ "tr", "Token-Ring",
- PKT_TR, NULL, WTAP_ENCAP_TR, 0 }
+ PKT_TR, NULL, WTAP_ENCAP_TR, 0 },
+
+ { "udp", "User Datagram Protocol",
+ PKT_UDP, pkt_udp, WTAP_ENCAP_ETHERNET, array_length(pkt_udp) }
};