diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-10-26 23:41:15 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-10-26 23:41:15 +0000 |
commit | a4e597b545ac9b72d439df8c0777cbd8983c96ef (patch) | |
tree | 278096b3218d2f7e5a09dfc926a9caa3059ce55b /wiretap/aethra.c | |
parent | 269cc1920ff5d152c2be55c248d3b307ce1b1803 (diff) |
Add some debugging code; the current code doesn't work when compiled
with MSVC on Win32, and the fix will remove the debugging code as well.
svn path=/trunk/; revision=39624
Diffstat (limited to 'wiretap/aethra.c')
-rw-r--r-- | wiretap/aethra.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/wiretap/aethra.c b/wiretap/aethra.c index 2de82a0c6b..e7be877ffe 100644 --- a/wiretap/aethra.c +++ b/wiretap/aethra.c @@ -130,6 +130,9 @@ int aethra_open(wtap *wth, int *err, gchar **err_info) wth->subtype_read = aethra_read; wth->subtype_seek_read = aethra_seek_read; +fprintf(stderr, "sizeof hdr.magic %" G_GINT64_MODIFIER "u, sizeof hdr %" G_GINT64_MODIFIER "u, data_offset %" G_GINT64_MODIFIER "u\n", +(guint64)sizeof hdr.magic, (guint64)sizeof hdr, wth->data_offset); + /* * Convert the time stamp to a "time_t". */ @@ -172,7 +175,13 @@ static gboolean aethra_read(wtap *wth, int *err, gchar **err_info, /* Read record header. */ if (!aethra_read_rec_header(wth->fh, &hdr, &wth->pseudo_header, err, err_info)) +{ +if (*err == 0) +fprintf(stderr, "aethra_read_rec_header() got an EOF\n"); +else +fprintf(stderr, "aethra_read_rec_header() fails: err %d\n", *err); return FALSE; +} rec_size = pletohs(hdr.rec_size); if (rec_size < (sizeof hdr - sizeof hdr.rec_size)) { @@ -184,18 +193,30 @@ static gboolean aethra_read(wtap *wth, int *err, gchar **err_info, } wth->data_offset += sizeof hdr; +fprintf(stderr, "sizeof hdr %" G_GINT64_MODIFIER "u, data_offset %" G_GINT64_MODIFIER "u\n", +(guint64)sizeof hdr, wth->data_offset); + /* * XXX - if this is big, we might waste memory by * growing the buffer to handle it. */ packet_size = rec_size - (sizeof hdr - sizeof hdr.rec_size); +fprintf(stderr, "rec_size %u, packet_size %u, sizeof hdr.rec_size %" G_GINT64_MODIFIER "u, delta %" G_GINT64_MODIFIER "u\n", +rec_size, packet_size, (guint64)sizeof hdr.rec_size, +(guint64)(sizeof hdr - sizeof hdr.rec_size)); if (packet_size != 0) { buffer_assure_space(wth->frame_buffer, packet_size); if (!aethra_read_rec_data(wth->fh, buffer_start_ptr(wth->frame_buffer), packet_size, err, err_info)) +{ +fprintf(stderr, "aethra_read_rec_data() fails\n"); return FALSE; /* Read error */ +} wth->data_offset += packet_size; +fprintf(stderr, "data_offset %" G_GINT64_MODIFIER "u\n", +wth->data_offset); } +fprintf(stderr, "hdr.rec_type %u\n", hdr.rec_type); } while (hdr.rec_type != AETHRA_PACKET); msecs = pletohl(hdr.timestamp); |