32 "packet-generator new {\n" 36 " node ethernet-input\n";
78 ethertype = clib_net_to_host_u16 (h->
type);
86 if (ethertype == 0x8100 )
88 u16 * vlan_ethertype = (
u16 *)(h+1);
89 ethertype = clib_net_to_host_u16(vlan_ethertype[0]);
96 " 0x%04x: %02x%02x.%02x%02x.%02x%02x" 97 " -> %02x%02x.%02x%02x.%02x%02x\n",
114 for (j = offset; j <
vec_len (pkt); j++)
127 int main (
int argc,
char **argv)
131 u8 * input_file = 0, * output_file = 0;
139 if (
unformat(&input,
"-i %s", &input_file)
140 ||
unformat (&input,
"input %s", &input_file))
142 else if (
unformat (&input,
"-o %s", &output_file)
143 ||
unformat (&input,
"output %s", &output_file))
149 "usage: pcap2pg -i <input-file> [-o <output-file>]\n");
168 ofp = fopen ((
char *)output_file,
"rw");
char * file_name
File name of pcap output.
sll srl srl sll sra u16x4 i
PCAP utility definitions.
PCAP main state data structure.
int main(int argc, char **argv)
pcap2pg.
void stream_boilerplate(FILE *ofp, int i, u8 *pkt)
Packet Generator Stream boilerplate.
clib_error_t * pcap_read(pcap_main_t *pm)
Read PCAP file.
int pcap2pg(pcap_main_t *pm, FILE *ofp)
Conversion of PCAP file to PG file format.
#define clib_error_report(e)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define clib_unix_warning(format, args...)
struct clib_bihash_value offset
template key/value backing page structure
static char * pg_fmt
char * to seed a PG file
u8 ** packets_read
Packets read from file.