Home | History | Annotate | Download | only in libpcap

Lines Matching defs:hdr

123 static int pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **datap);
154 struct pcap_file_header hdr;
183 hdr.magic = magic;
184 amt_read = fread(((char *)&hdr) + sizeof hdr.magic, 1,
185 sizeof(hdr) - sizeof(hdr.magic), fp);
186 if (amt_read != sizeof(hdr) - sizeof(hdr.magic)) {
194 (unsigned long)sizeof(hdr),
205 hdr.version_major = SWAPSHORT(hdr.version_major);
206 hdr.version_minor = SWAPSHORT(hdr.version_minor);
207 hdr.thiszone = SWAPLONG(hdr.thiszone);
208 hdr.sigfigs = SWAPLONG(hdr.sigfigs);
209 hdr.snaplen = SWAPLONG(hdr.snaplen);
210 hdr.linktype = SWAPLONG(hdr.linktype);
213 if (hdr.version_major < PCAP_VERSION_MAJOR) {
224 if (! ((hdr.version_major == PCAP_VERSION_MAJOR &&
225 hdr.version_minor <= PCAP_VERSION_MINOR) ||
226 (hdr.version_major == 543 &&
227 hdr.version_minor == 0))) {
230 hdr.version_major, hdr.version_minor);
235 if (hdr.snaplen > MAXIMUM_SNAPLEN) {
238 "maximum of %u", hdr.snaplen, MAXIMUM_SNAPLEN);
254 p->version_major = hdr.version_major;
255 p->version_minor = hdr.version_minor;
256 p->tzoff = hdr.thiszone;
257 p->snapshot = hdr.snaplen;
258 p->linktype = linktype_to_dlt(LT_LINKTYPE(hdr.linktype));
259 p->linktype_ext = LT_LINKTYPE_EXT(hdr.linktype);
325 switch (hdr.version_major) {
328 if (hdr.version_minor < 3)
330 else if (hdr.version_minor == 3)
416 * in hdr and a pointer to the contents in data. Return 0 on success, 1
420 pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
457 hdr->caplen = SWAPLONG(sf_hdr.caplen);
458 hdr->len = SWAPLONG(sf_hdr.len);
459 hdr->ts.tv_sec = SWAPLONG(sf_hdr.ts.tv_sec);
460 hdr->ts.tv_usec = SWAPLONG(sf_hdr.ts.tv_usec);
462 hdr->caplen = sf_hdr.caplen;
463 hdr->len = sf_hdr.len;
464 hdr->ts.tv_sec = sf_hdr.ts.tv_sec;
465 hdr->ts.tv_usec = sf_hdr.ts.tv_usec;
481 hdr->ts.tv_usec = hdr->ts.tv_usec * 1000;
489 hdr->ts.tv_usec = hdr->ts.tv_usec / 1000;
500 if (hdr->caplen <= hdr->len) {
510 t = hdr->caplen;
511 hdr->caplen = hdr->len;
512 hdr->len = t;
516 if (hdr->caplen > p->bufsize) {
529 if (hdr->caplen > MAXIMUM_SNAPLEN) {
532 "maximum of %u", hdr->caplen, MAXIMUM_SNAPLEN);
553 * Yes, this uses hdr->caplen; technically,
561 hdr->caplen, (unsigned long)amt_read);
569 bytes_to_discard = hdr->caplen - p->bufsize;
585 hdr->caplen, (unsigned long)bytes_read);
596 hdr->caplen = p->bufsize;
599 amt_read = fread(p->buffer, 1, hdr->caplen, fp);
600 if (amt_read != hdr->caplen) {
608 hdr->caplen, (unsigned long)amt_read);
616 swap_pseudo_headers(p->linktype, hdr, *data);
624 struct pcap_file_header hdr;
626 hdr.magic = p->opt.tstamp_precision == PCAP_TSTAMP_PRECISION_NANO ? NSEC_TCPDUMP_MAGIC : TCPDUMP_MAGIC;
627 hdr.version_major = PCAP_VERSION_MAJOR;
628 hdr.version_minor = PCAP_VERSION_MINOR;
630 hdr.thiszone = thiszone;
631 hdr.snaplen = snaplen;
632 hdr.sigfigs = 0;
633 hdr.linktype = linktype;
635 if (fwrite((char *)&hdr, sizeof(hdr), 1, fp) != 1)