+
+ char cappath[] = "testif00.pcap";
+ sprintf(cappath, "testif%i.pcap", IfNum);
+ gaInterfaces[IfNum].CapFP = fopen(cappath, "w");
+ {
+ struct {
+ uint32_t magic_number; /* magic number */
+ uint16_t version_major; /* major version number */
+ uint16_t version_minor; /* minor version number */
+ int32_t thiszone; /* GMT to local correction */
+ uint32_t sigfigs; /* accuracy of timestamps */
+ uint32_t snaplen; /* max length of captured packets, in octets */
+ uint32_t network; /* data link type */
+ } __attribute__((packed)) hdr = {
+ 0xa1b2c3d4,
+ 2,4,
+ 0,
+ 0,
+ 65535,
+ 1
+ };
+ fwrite(&hdr, sizeof(hdr), 1, gaInterfaces[IfNum].CapFP);
+ }