aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/cosine.c
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2012-10-17 20:28:22 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2012-10-17 20:28:22 +0000
commit6b5045dd7b15c2b405e125bba24afae1410dcde2 (patch)
tree1abfe076c33148ad44fab0144357c8b36969d583 /wiretap/cosine.c
parent016a518728a09941d15b3cc930ea7a0cff969881 (diff)
Fill some phdr values also when doing random read
svn path=/trunk/; revision=45619
Diffstat (limited to 'wiretap/cosine.c')
-rw-r--r--wiretap/cosine.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/wiretap/cosine.c b/wiretap/cosine.c
index 73f305fd91..b2ad78daf4 100644
--- a/wiretap/cosine.c
+++ b/wiretap/cosine.c
@@ -173,8 +173,8 @@ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
static gboolean cosine_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, guint8 *pd,
int len, int *err, gchar **err_info);
-static int parse_cosine_rec_hdr(wtap *wth, const char *line,
- union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info);
+static int parse_cosine_rec_hdr(struct wtap_pkthdr *phdr, const char *line,
+ int *err, gchar **err_info);
static int parse_cosine_hex_dump(FILE_T fh, int pkt_len, guint8* buf,
int *err, gchar **err_info);
static int parse_single_hex_dump_line(char* rec, guint8 *buf,
@@ -317,8 +317,7 @@ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
return FALSE;
/* Parse the header */
- pkt_len = parse_cosine_rec_hdr(wth, line, &wth->phdr.pseudo_header, err,
- err_info);
+ pkt_len = parse_cosine_rec_hdr(&wth->phdr, line, err, err_info);
if (pkt_len == -1)
return FALSE;
@@ -343,7 +342,6 @@ cosine_seek_read (wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, guint8 *pd, int len,
int *err, gchar **err_info)
{
- union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
char line[COSINE_LINE_LENGTH];
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
@@ -357,7 +355,7 @@ cosine_seek_read (wtap *wth, gint64 seek_off,
return FALSE;
}
- if (parse_cosine_rec_hdr(NULL, line, pseudo_header, err, err_info) == -1)
+ if (parse_cosine_rec_hdr(phdr, line, err, err_info) == -1)
return FALSE;
return parse_cosine_hex_dump(wth->random_fh, len, pd, err, err_info);
@@ -369,9 +367,10 @@ cosine_seek_read (wtap *wth, gint64 seek_off,
2) output to PE without date and time
l2-tx (FR:3/7/1:1), Length:18, Pro:0, Off:0, Pri:0, RM:0, Err:0 [0x4000, 0x0] */
static int
-parse_cosine_rec_hdr(wtap *wth, const char *line,
- union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info)
+parse_cosine_rec_hdr(struct wtap_pkthdr *phdr, const char *line,
+ int *err, gchar **err_info)
{
+ union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
int num_items_scanned;
int yy, mm, dd, hr, min, sec, csec, pkt_len;
int pro, off, pri, rm, error;
@@ -410,7 +409,7 @@ parse_cosine_rec_hdr(wtap *wth, const char *line,
yy = mm = dd = hr = min = sec = csec = 0;
}
- if (wth) {
+ {
tm.tm_year = yy - 1900;
tm.tm_mon = mm - 1;
tm.tm_mday = dd;
@@ -418,9 +417,9 @@ parse_cosine_rec_hdr(wtap *wth, const char *line,
tm.tm_min = min;
tm.tm_sec = sec;
tm.tm_isdst = -1;
- wth->phdr.ts.secs = mktime(&tm);
- wth->phdr.ts.nsecs = csec * 10000000;
- wth->phdr.len = pkt_len;
+ phdr->ts.secs = mktime(&tm);
+ phdr->ts.nsecs = csec * 10000000;
+ phdr->len = pkt_len;
}
/* XXX need to handle other encapsulations like Cisco HDLC,
Frame Relay and ATM */