diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-05-17 21:55:33 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-05-17 21:55:33 +0000 |
commit | 4c679fb01ae91b43d98c2a93e0fe820d3486b178 (patch) | |
tree | 824bbf49423f139bef413ed80846c5cf337a37c8 /wiretap/k12text.l | |
parent | 48285bb16b0a5655a47a8a59c34bc98e6bf4cb75 (diff) |
Rename k12text_set_pseudo_header() to k12text_set_headers() and have it
fill in the entire struct wtap_pkthdr.
svn path=/trunk/; revision=49388
Diffstat (limited to 'wiretap/k12text.l')
-rw-r--r-- | wiretap/k12text.l | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/wiretap/k12text.l b/wiretap/k12text.l index 817eb92353..b7c21db198 100644 --- a/wiretap/k12text.l +++ b/wiretap/k12text.l @@ -182,15 +182,25 @@ static void finalize_frame(void) { ok_frame = TRUE; } -/* Fill in pseudo-header according to the encapsulation type */ +/* Fill in pkthdr */ static void -k12text_set_pseudo_header(gint encap, union wtap_pseudo_header *pseudo_header) +k12text_set_headers(gint encap, guint h, guint m, guint s, guint ms, guint ns, + struct wtap_pkthdr *phdr) { + phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN; + + phdr->ts.secs = 946681200 + (3600*g_h) + (60*g_m) + g_s; + phdr->ts.nsecs = 1000000*g_ms + 1000*g_ns; + + phdr->caplen = phdr->len = ii; + + phdr->pkt_encap = g_encap; + /* The file-encap is WTAP_ENCAP_PER_PACKET */ switch(encap) { case WTAP_ENCAP_ETHERNET: - pseudo_header->eth.fcs_len = 0; + phdr->pseudo_header.eth.fcs_len = 0; break; case WTAP_ENCAP_MTP3: case WTAP_ENCAP_CHDLC: @@ -273,15 +283,7 @@ k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset) *data_offset = k12text->next_frame_offset; /* file position for beginning of this frame */ k12text->next_frame_offset += file_bytes_read; /* file position after end of this frame */ - wth->phdr.presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN; - - wth->phdr.ts.secs = 946681200 + (3600*g_h) + (60*g_m) + g_s; - wth->phdr.ts.nsecs = 1000000*g_ms + 1000*g_ns; - - wth->phdr.caplen = wth->phdr.len = ii; - - wth->phdr.pkt_encap = g_encap; - k12text_set_pseudo_header(g_encap, &wth->phdr.pseudo_header); + k12text_set_headers(g_encap, g_h, g_m, g_s, g_ms, g_ns, &wth->phdr); buffer_assure_space(wth->frame_buffer, wth->phdr.caplen); memcpy(buffer_start_ptr(wth->frame_buffer), bb, wth->phdr.caplen); @@ -320,7 +322,7 @@ k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, guint8 * return FALSE; } - k12text_set_pseudo_header(g_encap, pseudo_header); + k12text_set_headers(g_encap, g_h, g_m, g_s, g_ms, g_ns, phdr); memcpy(pd, bb, length); |