Add support for the initial direction indication. Irene will hook

it up to the GUI soon.

svn path=/trunk/; revision=48696
This commit is contained in:
Michael Tüxen 2013-04-02 12:15:42 +00:00
parent 36ad3475d9
commit 26bdb4f056
2 changed files with 38 additions and 6 deletions

View File

@ -170,6 +170,8 @@ static guint16 hdr_data_chunk_sid = 0;
static guint16 hdr_data_chunk_ssn = 0;
static guint32 hdr_data_chunk_ppid = 0;
static gboolean has_direction = FALSE;
static guint32 direction = 0;
/*--- Local data -----------------------------------------------------------------*/
@ -530,7 +532,8 @@ write_current_packet (void)
pkthdr.opt_comment = NULL;
pkthdr.drop_count = 0;
pkthdr.pack_flags = 0;
pkthdr.presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID|WTAP_HAS_TS;
pkthdr.pack_flags |= direction;
pkthdr.presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID|WTAP_HAS_TS|WTAP_HAS_PACK_FLAGS;
wtap_dump(wdh, &pkthdr, packet_buf, &err);
}
@ -584,6 +587,37 @@ parse_preamble (void)
int subseclen;
int i;
/*
* Null-terminate the preamble.
*/
packet_preamble[packet_preamble_len] = '\0';
if (has_direction) {
switch (packet_preamble[0]) {
case 'i':
case 'I':
direction = 0x00000001;
packet_preamble[0] = ' ';
break;
case 'o':
case 'O':
direction = 0x00000002;
packet_preamble[0] = ' ';
break;
default:
direction = 0x00000000;
break;
}
i = 0;
while (packet_preamble[i] == ' ' ||
packet_preamble[i] == '\r' ||
packet_preamble[i] == '\t') {
i++;
}
packet_preamble_len -= i;
memmove(packet_preamble, packet_preamble+i, packet_preamble_len);
}
/*
* If no "-t" flag was specified, don't attempt to parse a packet
* preamble to extract a time stamp.
@ -599,11 +633,6 @@ parse_preamble (void)
timecode = timecode_default;
ts_usec = 0;
/*
* Null-terminate the preamble.
*/
packet_preamble[packet_preamble_len] = '\0';
/* Ensure preamble has more than two chars before atempting to parse.
* This should cover line breaks etc that get counted.
*/
@ -896,6 +925,8 @@ text_import_setup(text_import_info_t *info)
(info->offset_type == OFFSET_DEC) ? 10 :
16;
has_direction = info->has_direction;
if (info->date_timestamp)
{
ts_fmt = info->date_timestamp_format;

View File

@ -68,6 +68,7 @@ typedef struct
FILE *import_text_file;
enum offset_type offset_type;
gboolean date_timestamp;
gboolean has_direction;
char *date_timestamp_format;
/* Import info */