32 "packet-generator new {\n" 34 " limit 1\n" " size %d-%d\n" " 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",
112 for (j = offset; j <
vec_len (pkt); j++)
130 u8 *input_file = 0, *output_file = 0;
138 if (
unformat (&input,
"-i %s", &input_file)
139 ||
unformat (&input,
"input %s", &input_file))
141 else if (
unformat (&input,
"-o %s", &output_file)
142 ||
unformat (&input,
"output %s", &output_file))
148 "usage: pcap2pg -i <input-file> [-o <output-file>]\n");
167 ofp = fopen ((
char *) output_file,
"w+");
char * file_name
File name of pcap output.
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.