forked from osmocom/wireshark
Use guint8 rather than guchar for raw octets and pointers to arrays of
same. Add to wiretap/pcap-common.c a routine to fill in the pseudo-header for ATM (by looking at the VPI, VCI, and packet data, and guessing) and Ethernet (setting the FCS length appropriately). Use it for both pcap and pcap-ng files. svn path=/trunk/; revision=38840
This commit is contained in:
parent
10a3cb6e0f
commit
e9fc1b72aa
|
@ -105,17 +105,17 @@ typedef struct
|
|||
|
||||
static gboolean _5views_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean _5views_read_rec_data(FILE_T fh, guchar *pd, int length,
|
||||
static gboolean _5views_read_rec_data(FILE_T fh, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static int _5views_read_header(wtap *wth, FILE_T fh,
|
||||
t_5VW_TimeStamped_Header *hdr, int *err, gchar **err_info);
|
||||
static gboolean _5views_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
|
||||
static gboolean _5views_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
static gboolean _5views_dump_close(wtap_dumper *wdh, int *err);
|
||||
|
||||
|
||||
|
@ -271,7 +271,7 @@ _5views_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
|
||||
|
||||
static gboolean
|
||||
_5views_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
_5views_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
@ -316,7 +316,7 @@ _5views_read_header(wtap *wth _U_, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
|
|||
|
||||
static gboolean
|
||||
_5views_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
|
@ -406,7 +406,7 @@ gboolean _5views_dump_open(wtap_dumper *wdh, int *err)
|
|||
static gboolean _5views_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
_5views_dump_t *_5views = (_5views_dump_t *)wdh->priv;
|
||||
static t_5VW_TimeStamped_Header HeaderFrame;
|
||||
|
|
|
@ -91,7 +91,7 @@ typedef struct {
|
|||
static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean airopeekv9_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
static int wtap_file_read_pattern (wtap *wth, const char *pattern, int *err,
|
||||
|
@ -564,7 +564,7 @@ static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean
|
||||
airopeekv9_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
airopeek9_t *airopeek9 = (airopeek9_t *)wth->priv;
|
||||
|
|
|
@ -76,9 +76,9 @@ const gint64 KUnixTimeBase = G_GINT64_CONSTANT(0x00dcddb30f2f8000); /* offset fr
|
|||
static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean snoop_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
static gboolean snoop_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info);
|
||||
|
||||
int btsnoop_open(wtap *wth, int *err, gchar **err_info)
|
||||
|
@ -237,7 +237,7 @@ static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info,
|
|||
}
|
||||
|
||||
static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info) {
|
||||
int bytes_read;
|
||||
struct btsnooprec_hdr hdr;
|
||||
|
@ -289,7 +289,7 @@ static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
snoop_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
snoop_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
@ -355,7 +355,7 @@ static guint8 btsnoop_lookup_flags(guint8 hci_type, gboolean sent, guint8 *flags
|
|||
static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err,
|
||||
const guint8 *pd, int *err,
|
||||
struct btsnooprec_hdr *rec_hdr)
|
||||
{
|
||||
gint64 ts_usec;
|
||||
|
@ -380,7 +380,7 @@ static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_,
|
|||
static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
struct btsnooprec_hdr rec_hdr;
|
||||
|
||||
|
@ -409,7 +409,7 @@ static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
|
|||
static gboolean btsnoop_dump_h4(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
struct btsnooprec_hdr rec_hdr;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
/* Initializes a buffer with a certain amount of allocated space */
|
||||
void buffer_init(Buffer* buffer, gsize space)
|
||||
{
|
||||
buffer->data = (guchar*)g_malloc(space);
|
||||
buffer->data = (guint8*)g_malloc(space);
|
||||
buffer->allocated = space;
|
||||
buffer->start = 0;
|
||||
buffer->first_free = 0;
|
||||
|
@ -84,10 +84,10 @@ void buffer_assure_space(Buffer* buffer, gsize space)
|
|||
|
||||
/* We'll allocate more space */
|
||||
buffer->allocated += space + 1024;
|
||||
buffer->data = (guchar*)g_realloc(buffer->data, buffer->allocated);
|
||||
buffer->data = (guint8*)g_realloc(buffer->data, buffer->allocated);
|
||||
}
|
||||
|
||||
void buffer_append(Buffer* buffer, guchar *from, gsize bytes)
|
||||
void buffer_append(Buffer* buffer, guint8 *from, gsize bytes)
|
||||
{
|
||||
buffer_assure_space(buffer, bytes);
|
||||
memcpy(buffer->data + buffer->first_free, from, bytes);
|
||||
|
@ -133,14 +133,14 @@ gsize buffer_length(Buffer* buffer)
|
|||
#endif
|
||||
|
||||
#ifndef SOME_FUNCTIONS_ARE_DEFINES
|
||||
guchar* buffer_start_ptr(Buffer* buffer)
|
||||
guint8* buffer_start_ptr(Buffer* buffer)
|
||||
{
|
||||
return buffer->data + buffer->start;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef SOME_FUNCTIONS_ARE_DEFINES
|
||||
guchar* buffer_end_ptr(Buffer* buffer)
|
||||
guint8* buffer_end_ptr(Buffer* buffer)
|
||||
{
|
||||
return buffer->data + buffer->first_free;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define SOME_FUNCTIONS_ARE_DEFINES
|
||||
|
||||
typedef struct Buffer {
|
||||
guchar *data;
|
||||
guint8 *data;
|
||||
gsize allocated;
|
||||
gsize start;
|
||||
gsize first_free;
|
||||
|
@ -37,7 +37,7 @@ typedef struct Buffer {
|
|||
void buffer_init(Buffer* buffer, gsize space);
|
||||
void buffer_free(Buffer* buffer);
|
||||
void buffer_assure_space(Buffer* buffer, gsize space);
|
||||
void buffer_append(Buffer* buffer, guchar *from, gsize bytes);
|
||||
void buffer_append(Buffer* buffer, guint8 *from, gsize bytes);
|
||||
void buffer_remove_start(Buffer* buffer, gsize bytes);
|
||||
|
||||
#ifdef SOME_FUNCTIONS_ARE_DEFINES
|
||||
|
@ -51,8 +51,8 @@ void buffer_remove_start(Buffer* buffer, gsize bytes);
|
|||
void buffer_clean(Buffer* buffer);
|
||||
void buffer_increase_length(Buffer* buffer, unsigned int bytes);
|
||||
unsigned int buffer_length(Buffer* buffer);
|
||||
guchar* buffer_start_ptr(Buffer* buffer);
|
||||
guchar* buffer_end_ptr(Buffer* buffer);
|
||||
guint8* buffer_start_ptr(Buffer* buffer);
|
||||
guint8* buffer_end_ptr(Buffer* buffer);
|
||||
void buffer_append_buffer(Buffer* buffer, Buffer* src_buffer);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -111,13 +111,13 @@ static gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
|
|||
gint64 *data_offset);
|
||||
static gboolean catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header,
|
||||
guchar *pd, int length,
|
||||
guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static void catapult_dct2000_close(wtap *wth);
|
||||
|
||||
static gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err);
|
||||
const guint8 *pd, int *err);
|
||||
|
||||
|
||||
/************************************************************/
|
||||
|
@ -135,14 +135,14 @@ static gboolean parse_line(char *linebuff, gint line_length,
|
|||
gchar *context_name, guint8 *context_portp,
|
||||
gchar *protocol_name, gchar *variant_name,
|
||||
gchar *outhdr_name);
|
||||
static int write_stub_header(guchar *frame_buffer, char *timestamp_string,
|
||||
static int write_stub_header(guint8 *frame_buffer, char *timestamp_string,
|
||||
packet_direction_t direction, int encap,
|
||||
gchar *context_name, guint8 context_port,
|
||||
gchar *protocol_name, gchar *variant_name,
|
||||
gchar *outhdr_name);
|
||||
static guchar hex_from_char(gchar c);
|
||||
static guchar hex_byte_from_chars(gchar *c);
|
||||
static gchar char_from_hex(guchar hex);
|
||||
static guint8 hex_from_char(gchar c);
|
||||
static guint8 hex_byte_from_chars(gchar *c);
|
||||
static gchar char_from_hex(guint8 hex);
|
||||
|
||||
static void set_pseudo_header_info(wtap *wth,
|
||||
int pkt_encap,
|
||||
|
@ -323,7 +323,7 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
|
|||
aal_header_chars,
|
||||
context_name, &context_port,
|
||||
protocol_name, variant_name, outhdr_name)) {
|
||||
guchar *frame_buffer;
|
||||
guint8 *frame_buffer;
|
||||
int n;
|
||||
int stub_offset = 0;
|
||||
line_prefix_info_t *line_prefix_info;
|
||||
|
@ -444,7 +444,7 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
|
|||
/**************************************************/
|
||||
static gboolean
|
||||
catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd,
|
||||
int length, int *err, gchar **err_info)
|
||||
{
|
||||
gint64 offset = wth->data_offset;
|
||||
|
@ -602,7 +602,7 @@ int catapult_dct2000_dump_can_write_encap(int encap)
|
|||
|
||||
gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
guint32 n;
|
||||
line_prefix_info_t *prefix = NULL;
|
||||
|
@ -740,8 +740,8 @@ gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
|||
/* Each binary byte is written out as 2 hex string chars */
|
||||
for (; n < phdr->len; n++) {
|
||||
gchar c[2];
|
||||
c[0] = char_from_hex((guchar)(pd[n] >> 4));
|
||||
c[1] = char_from_hex((guchar)(pd[n] & 0x0f));
|
||||
c[0] = char_from_hex((guint8)(pd[n] >> 4));
|
||||
c[1] = char_from_hex((guint8)(pd[n] & 0x0f));
|
||||
|
||||
/* Write both hex chars of byte together */
|
||||
if (!wtap_dump_file_write(wdh, c, 2, err)) {
|
||||
|
@ -1221,7 +1221,7 @@ static gboolean parse_line(gchar *linebuff, gint line_length,
|
|||
/*****************************************************************/
|
||||
/* Write the stub info to the data buffer while reading a packet */
|
||||
/*****************************************************************/
|
||||
static int write_stub_header(guchar *frame_buffer, char *timestamp_string,
|
||||
static int write_stub_header(guint8 *frame_buffer, char *timestamp_string,
|
||||
packet_direction_t direction, int encap,
|
||||
gchar *context_name, guint8 context_port,
|
||||
gchar *protocol_name, gchar *variant_name,
|
||||
|
@ -1383,7 +1383,7 @@ static void set_ppp_info(union wtap_pseudo_header *pseudo_header,
|
|||
/********************************************************/
|
||||
/* Return hex nibble equivalent of hex string character */
|
||||
/********************************************************/
|
||||
guchar hex_from_char(gchar c)
|
||||
guint8 hex_from_char(gchar c)
|
||||
{
|
||||
if ((c >= '0') && (c <= '9')) {
|
||||
return c - '0';
|
||||
|
@ -1398,13 +1398,13 @@ guchar hex_from_char(gchar c)
|
|||
}
|
||||
|
||||
/* Extract and return a byte value from 2 ascii hex chars, starting from the given pointer */
|
||||
static guchar hex_byte_from_chars(gchar *c)
|
||||
static guint8 hex_byte_from_chars(gchar *c)
|
||||
{
|
||||
static guchar hex_char_array[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
|
||||
/* Populate lookup table first time */
|
||||
static guchar tableValues[255][255];
|
||||
static guint8 tableValues[255][255];
|
||||
static gint tableSet = FALSE;
|
||||
if (!tableSet) {
|
||||
gint i, j;
|
||||
|
@ -1426,7 +1426,7 @@ static guchar hex_byte_from_chars(gchar *c)
|
|||
/********************************************************/
|
||||
/* Return character corresponding to hex nibble value */
|
||||
/********************************************************/
|
||||
gchar char_from_hex(guchar hex)
|
||||
gchar char_from_hex(guint8 hex)
|
||||
{
|
||||
static char hex_lookup[16] =
|
||||
{ '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
||||
|
|
|
@ -86,13 +86,13 @@ static gboolean commview_read(wtap *wth, int *err, gchar **err_info,
|
|||
gint64 *data_offset);
|
||||
static gboolean commview_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header,
|
||||
guchar *pd, int length, int *err,
|
||||
guint8 *pd, int length, int *err,
|
||||
gchar **err_info);
|
||||
static gboolean commview_read_header(commview_header_t *cv_hdr, FILE_T fh,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean commview_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err);
|
||||
const guint8 *pd, int *err);
|
||||
|
||||
int commview_open(wtap *wth, int *err, gchar **err_info)
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
|
||||
static gboolean
|
||||
commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
|
||||
*pseudo_header, guchar *pd, int length, int *err,
|
||||
*pseudo_header, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
commview_header_t cv_hdr;
|
||||
|
@ -327,7 +327,7 @@ gboolean commview_dump_open(wtap_dumper *wdh, int *err _U_)
|
|||
static gboolean commview_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
commview_header_t cv_hdr;
|
||||
struct tm *tm;
|
||||
|
|
|
@ -94,7 +94,7 @@ static gboolean daintree_sna_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean daintree_sna_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header _U_,
|
||||
guchar *pd, int len, int *err,
|
||||
guint8 *pd, int len, int *err,
|
||||
gchar **err_info);
|
||||
|
||||
static guint daintree_sna_hex_char(guchar *str, int *err);
|
||||
|
@ -199,7 +199,7 @@ daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
* Wireshark opens the capture file for random access when displaying user-selected packets */
|
||||
static gboolean
|
||||
daintree_sna_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
|
||||
*pseudo_header _U_, guchar *pd, int len, int *err,
|
||||
*pseudo_header _U_, guint8 *pd, int len, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
guint pkt_len;
|
||||
|
@ -244,15 +244,15 @@ daintree_sna_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Convert an ASCII hex string to guchar */
|
||||
/* Convert an ASCII hex string to guint8 */
|
||||
static guint
|
||||
daintree_sna_hex_char(guchar *str, int *err _U_) {
|
||||
guint bytes;
|
||||
guchar *p;
|
||||
guint8 *p;
|
||||
|
||||
p = str; /* overlay source buffer */
|
||||
bytes = 0;
|
||||
/* convert hex string to guchar */
|
||||
/* convert hex string to guint8 */
|
||||
while(*str) {
|
||||
if (!isxdigit((guchar)*str)) return 0;
|
||||
/* most significant nibble */
|
||||
|
|
|
@ -68,7 +68,7 @@ static int erf_read_header(FILE_T fh,
|
|||
static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd,
|
||||
int length, int *err, gchar **err_info);
|
||||
|
||||
static const struct {
|
||||
|
@ -307,7 +307,7 @@ static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
|
|||
}
|
||||
|
||||
static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd,
|
||||
int length _U_, int *err, gchar **err_info)
|
||||
{
|
||||
erf_header_t erf_header;
|
||||
|
@ -553,7 +553,7 @@ static gboolean erf_dump(
|
|||
wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd,
|
||||
const guint8 *pd,
|
||||
int *err)
|
||||
{
|
||||
union wtap_pseudo_header other_phdr;
|
||||
|
|
|
@ -149,14 +149,14 @@ typedef struct {
|
|||
static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean etherpeek_seek_read_v7(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static void etherpeek_fill_pseudo_header_v7(
|
||||
union wtap_pseudo_header *pseudo_header, airopeek_radio_hdr_t *radio_hdr);
|
||||
static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean etherpeek_seek_read_v56(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
int etherpeek_open(wtap *wth, int *err, gchar **err_info)
|
||||
|
@ -364,7 +364,7 @@ int etherpeek_open(wtap *wth, int *err, gchar **err_info)
|
|||
static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset)
|
||||
{
|
||||
guchar ep_pkt[ETHERPEEK_V7_PKT_SIZE];
|
||||
guint8 ep_pkt[ETHERPEEK_V7_PKT_SIZE];
|
||||
#if 0
|
||||
guint16 protoNum;
|
||||
#endif
|
||||
|
@ -478,10 +478,10 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean
|
||||
etherpeek_seek_read_v7(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
guchar ep_pkt[ETHERPEEK_V7_PKT_SIZE];
|
||||
guint8 ep_pkt[ETHERPEEK_V7_PKT_SIZE];
|
||||
guint8 status;
|
||||
airopeek_radio_hdr_t radio_hdr;
|
||||
|
||||
|
@ -546,7 +546,7 @@ static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info,
|
|||
gint64 *data_offset)
|
||||
{
|
||||
etherpeek_t *etherpeek = (etherpeek_t *)wth->priv;
|
||||
guchar ep_pkt[ETHERPEEK_V56_PKT_SIZE];
|
||||
guint8 ep_pkt[ETHERPEEK_V56_PKT_SIZE];
|
||||
guint16 length;
|
||||
guint16 sliceLength;
|
||||
#if 0
|
||||
|
@ -637,10 +637,10 @@ static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean
|
||||
etherpeek_seek_read_v56(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
guchar ep_pkt[ETHERPEEK_V56_PKT_SIZE];
|
||||
guint8 ep_pkt[ETHERPEEK_V56_PKT_SIZE];
|
||||
int pkt_encap;
|
||||
guint16 protoNum;
|
||||
unsigned int i;
|
||||
|
|
|
@ -427,7 +427,7 @@ esc_write(wtap_dumper *wdh, const guint8 *buf, int len, int *err)
|
|||
static gboolean eyesdn_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err);
|
||||
const guint8 *pd, int *err);
|
||||
|
||||
gboolean eyesdn_dump_open(wtap_dumper *wdh, int *err)
|
||||
{
|
||||
|
@ -465,7 +465,7 @@ int eyesdn_dump_can_write_encap(int encap)
|
|||
static gboolean eyesdn_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
static const guint8 start_flag = 0xff;
|
||||
guint8 buf[EYESDN_HDR_LENGTH];
|
||||
|
|
|
@ -981,7 +981,7 @@ static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int filetype, gboolean c
|
|||
}
|
||||
|
||||
gboolean wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err)
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err)
|
||||
{
|
||||
return (wdh->subtype_write)(wdh, phdr, pseudo_header, pd, err);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ typedef struct {
|
|||
static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean i4btrace_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static int i4b_read_rec_header(FILE_T fh, i4b_trace_hdr_t *hdr, int *err,
|
||||
gchar **err_info);
|
||||
static void i4b_byte_swap_header(wtap *wth, i4b_trace_hdr_t *hdr);
|
||||
static gboolean i4b_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
static gboolean i4b_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info);
|
||||
static void i4b_set_pseudo_header(i4b_trace_hdr_t *hdr,
|
||||
union wtap_pseudo_header *pseudo_header);
|
||||
|
@ -189,7 +189,7 @@ static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean
|
||||
i4btrace_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
int ret;
|
||||
|
@ -259,7 +259,7 @@ i4b_byte_swap_header(wtap *wth, i4b_trace_hdr_t *hdr)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
i4b_read_rec_data(FILE_T fh, guchar *pd, int length, int *err, gchar **err_info)
|
||||
i4b_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err, gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ ipfix_read(wtap *wth, int *err, gchar **err_info,
|
|||
gint64 *data_offset);
|
||||
static gboolean
|
||||
ipfix_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static void
|
||||
ipfix_close(wtap *wth);
|
||||
|
@ -291,7 +291,7 @@ ipfix_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
/* classic wtap: seek to file position and read packet */
|
||||
static gboolean
|
||||
ipfix_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length _U_,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length _U_,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
ipfix_message_header_t msg_hdr;
|
||||
|
|
|
@ -35,13 +35,13 @@
|
|||
static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
static int iptrace_read_rec_header(FILE_T fh, guint8 *header, int header_len,
|
||||
|
@ -131,7 +131,7 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
|
|||
guint8 header[IPTRACE_1_0_PHDR_SIZE];
|
||||
guint8 *data_ptr;
|
||||
iptrace_1_0_phdr pkt_hdr;
|
||||
guchar fddi_padding[3];
|
||||
guint8 fddi_padding[3];
|
||||
|
||||
/* Read the descriptor data */
|
||||
*data_offset = wth->data_offset;
|
||||
|
@ -214,13 +214,13 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
|
|||
}
|
||||
|
||||
static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
int ret;
|
||||
guint8 header[IPTRACE_1_0_PHDR_SIZE];
|
||||
int pkt_encap;
|
||||
guchar fddi_padding[3];
|
||||
guint8 fddi_padding[3];
|
||||
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
return FALSE;
|
||||
|
@ -314,7 +314,7 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
|
|||
guint8 header[IPTRACE_2_0_PHDR_SIZE];
|
||||
guint8 *data_ptr;
|
||||
iptrace_2_0_phdr pkt_hdr;
|
||||
guchar fddi_padding[3];
|
||||
guint8 fddi_padding[3];
|
||||
|
||||
/* Read the descriptor data */
|
||||
*data_offset = wth->data_offset;
|
||||
|
@ -397,13 +397,13 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
|
|||
}
|
||||
|
||||
static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
int ret;
|
||||
guint8 header[IPTRACE_2_0_PHDR_SIZE];
|
||||
int pkt_encap;
|
||||
guchar fddi_padding[3];
|
||||
guint8 fddi_padding[3];
|
||||
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
return FALSE;
|
||||
|
|
|
@ -501,7 +501,7 @@ static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off
|
|||
}
|
||||
|
||||
|
||||
static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err _U_, gchar **err_info) {
|
||||
static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header, guint8 *pd, int length, int *err _U_, gchar **err_info) {
|
||||
k12_t *k12 = (k12_t *)wth->priv;
|
||||
k12_src_desc_t* src_desc;
|
||||
guint8* buffer;
|
||||
|
@ -985,7 +985,7 @@ static void k12_dump_src_setting(gpointer k _U_, gpointer v, gpointer p) {
|
|||
|
||||
static gboolean k12_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err) {
|
||||
const guint8 *pd, int *err) {
|
||||
k12_dump_t *k12 = (k12_dump_t *)wdh->priv;
|
||||
guint32 len;
|
||||
union {
|
||||
|
|
|
@ -344,7 +344,7 @@ static const struct { int e; const char* s; } encaps[] = {
|
|||
static gboolean
|
||||
k12text_dump(wtap_dumper *wdh _U_, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err) {
|
||||
const guint8 *pd, int *err) {
|
||||
#define K12BUF_SIZE 196808
|
||||
char *buf;
|
||||
size_t left = K12BUF_SIZE;
|
||||
|
|
|
@ -270,7 +270,7 @@ typedef struct {
|
|||
static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean lanalyzer_dump_close(wtap_dumper *wdh, int *err);
|
||||
|
||||
|
@ -546,7 +546,7 @@ static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
|
|||
}
|
||||
|
||||
static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
@ -643,7 +643,7 @@ static void my_timersub(const struct timeval *a,
|
|||
static gboolean lanalyzer_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
double x;
|
||||
int i;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "wtap-int.h"
|
||||
#include "file_wrappers.h"
|
||||
#include "buffer.h"
|
||||
#include "atm.h"
|
||||
#include "pcap-common.h"
|
||||
#include "pcap-encap.h"
|
||||
#include "libpcap.h"
|
||||
|
@ -70,15 +69,15 @@ static libpcap_try_t libpcap_try(wtap *wth, int *err);
|
|||
static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean libpcap_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static int libpcap_read_header(wtap *wth, int *err, gchar **err_info,
|
||||
struct pcaprec_ss990915_hdr *hdr);
|
||||
static void adjust_header(wtap *wth, struct pcaprec_hdr *hdr);
|
||||
static gboolean libpcap_read_rec_data(FILE_T fh, guchar *pd, int length,
|
||||
static gboolean libpcap_read_rec_data(FILE_T fh, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
|
||||
int libpcap_open(wtap *wth, int *err, gchar **err_info)
|
||||
{
|
||||
|
@ -601,7 +600,7 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
|
|||
guint packet_size;
|
||||
guint orig_size;
|
||||
int bytes_read;
|
||||
guchar fddi_padding[3];
|
||||
guint8 fddi_padding[3];
|
||||
int phdr_len;
|
||||
libpcap_t *libpcap;
|
||||
|
||||
|
@ -674,30 +673,9 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
|
|||
wth->phdr.caplen = packet_size;
|
||||
wth->phdr.len = orig_size;
|
||||
|
||||
if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
|
||||
if (wth->file_type == WTAP_FILE_PCAP_NOKIA) {
|
||||
/*
|
||||
* Nokia IPSO ATM.
|
||||
*
|
||||
* Guess the traffic type based on the packet
|
||||
* contents.
|
||||
*/
|
||||
atm_guess_traffic_type(buffer_start_ptr(wth->frame_buffer),
|
||||
wth->phdr.caplen, &wth->pseudo_header);
|
||||
} else {
|
||||
/*
|
||||
* SunATM.
|
||||
*
|
||||
* If this is ATM LANE traffic, try to guess what
|
||||
* type of LANE traffic it is based on the packet
|
||||
* contents.
|
||||
*/
|
||||
if (wth->pseudo_header.atm.type == TRAF_LANE) {
|
||||
atm_guess_lane_type(buffer_start_ptr(wth->frame_buffer),
|
||||
wth->phdr.caplen, &wth->pseudo_header);
|
||||
}
|
||||
}
|
||||
}
|
||||
pcap_fill_in_pseudo_header(wth->file_type, wth->file_encap,
|
||||
buffer_start_ptr(wth->frame_buffer), wth->phdr.caplen,
|
||||
&wth->pseudo_header, -1);
|
||||
|
||||
pcap_read_post_process(wth->file_encap, wth->phdr.caplen,
|
||||
libpcap->byte_swapped, buffer_start_ptr(wth->frame_buffer));
|
||||
|
@ -706,7 +684,7 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean
|
||||
libpcap_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
int phdr_len;
|
||||
|
@ -727,27 +705,9 @@ libpcap_seek_read(wtap *wth, gint64 seek_off,
|
|||
if (!libpcap_read_rec_data(wth->random_fh, pd, length, err, err_info))
|
||||
return FALSE; /* failed */
|
||||
|
||||
if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
|
||||
if (wth->file_type == WTAP_FILE_PCAP_NOKIA) {
|
||||
/*
|
||||
* Nokia IPSO ATM.
|
||||
*
|
||||
* Guess the traffic type based on the packet
|
||||
* contents.
|
||||
*/
|
||||
atm_guess_traffic_type(pd, length, pseudo_header);
|
||||
} else {
|
||||
/*
|
||||
* SunATM.
|
||||
*
|
||||
* If this is ATM LANE traffic, try to guess what
|
||||
* type of LANE traffic it is based on the packet
|
||||
* contents.
|
||||
*/
|
||||
if (pseudo_header->atm.type == TRAF_LANE)
|
||||
atm_guess_lane_type(pd, length, pseudo_header);
|
||||
}
|
||||
}
|
||||
pcap_fill_in_pseudo_header(wth->file_type, wth->file_encap, pd,
|
||||
length, pseudo_header, -1);
|
||||
|
||||
pcap_read_post_process(wth->file_encap, length,
|
||||
libpcap->byte_swapped, pd);
|
||||
return TRUE;
|
||||
|
@ -876,7 +836,7 @@ adjust_header(wtap *wth, struct pcaprec_hdr *hdr)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
libpcap_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
libpcap_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
@ -981,7 +941,7 @@ gboolean libpcap_dump_open(wtap_dumper *wdh, int *err)
|
|||
static gboolean libpcap_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
struct pcaprec_ss990915_hdr rec_hdr;
|
||||
size_t hdr_size;
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef struct {
|
|||
} mime_file_private_t;
|
||||
|
||||
typedef struct {
|
||||
const guchar *magic;
|
||||
const guint8 *magic;
|
||||
guint magic_len;
|
||||
} mime_files_t;
|
||||
|
||||
|
@ -69,7 +69,7 @@ typedef struct {
|
|||
* http://www.jpeg.org/public/jfif.pdf
|
||||
* http://www.w3.org/Graphics/JPEG/itu-t81.pdf
|
||||
*/
|
||||
static const guchar jpeg_jfif_magic[] = { 0xFF, 0xD8, /* SOF */
|
||||
static const guint8 jpeg_jfif_magic[] = { 0xFF, 0xD8, /* SOF */
|
||||
0xFF /* start of the next marker */
|
||||
};
|
||||
|
||||
|
@ -124,7 +124,7 @@ mime_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
mime_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header _U_, guchar *pd, int length, int *err, gchar **err_info)
|
||||
mime_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header _U_, guint8 *pd, int length, int *err, gchar **err_info)
|
||||
{
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
|
||||
*err_info = NULL;
|
||||
|
|
|
@ -94,7 +94,7 @@ mpeg_read_header(wtap *wth, int *err, gchar **err_info, guint32 *n)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
mpeg_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
mpeg_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
@ -240,7 +240,7 @@ mpeg_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
|
||||
static gboolean
|
||||
mpeg_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header _U_, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header _U_, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
|
|
|
@ -176,17 +176,17 @@ static const int netmon_encap[] = {
|
|||
static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean netmon_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean netmon_read_atm_pseudoheader(FILE_T fh,
|
||||
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info);
|
||||
static gboolean netmon_read_rec_data(FILE_T fh, guchar *pd, int length,
|
||||
static gboolean netmon_read_rec_data(FILE_T fh, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static int netmon_read_rec_trailer(FILE_T fh, int trlr_size, int *err,
|
||||
gchar **err_info);
|
||||
static void netmon_sequential_close(wtap *wth);
|
||||
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
static gboolean netmon_dump_close(wtap_dumper *wdh, int *err);
|
||||
|
||||
int netmon_open(wtap *wth, int *err, gchar **err_info)
|
||||
|
@ -397,7 +397,7 @@ netmon_trailer_size(netmon_t *netmon)
|
|||
|
||||
static void
|
||||
netmon_set_pseudo_header_info(int pkt_encap,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length)
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length)
|
||||
{
|
||||
switch (pkt_encap) {
|
||||
|
||||
|
@ -627,7 +627,7 @@ again:
|
|||
|
||||
static gboolean
|
||||
netmon_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
netmon_t *netmon = (netmon_t *)wth->priv;
|
||||
|
@ -720,7 +720,7 @@ netmon_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
netmon_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
netmon_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
@ -907,7 +907,7 @@ gboolean netmon_dump_open(wtap_dumper *wdh, int *err)
|
|||
/* Write a record for a packet to a dump file.
|
||||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err)
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err)
|
||||
{
|
||||
netmon_dump_t *netmon = (netmon_dump_t *)wdh->priv;
|
||||
struct netmonrec_1_x_hdr rec_1_x_hdr;
|
||||
|
|
|
@ -412,7 +412,7 @@ gboolean nstrace_read_v20(wtap *wth, int *err, gchar **err_info,
|
|||
gint64 *data_offset);
|
||||
gboolean nstrace_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header,
|
||||
guchar *pd, int length,
|
||||
guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
void nstrace_close(wtap *wth);
|
||||
void nstrace_sequential_close(wtap *wth);
|
||||
|
@ -423,7 +423,7 @@ gboolean nstrace_set_start_time(wtap *wth);
|
|||
guint64 ns_hrtime2nsec(guint32 tm);
|
||||
|
||||
static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
|
||||
|
||||
#define GET_READ_PAGE_SIZE(remaining_file_size) ((gint32)((remaining_file_size>NSPR_PAGESIZE)?NSPR_PAGESIZE:remaining_file_size))
|
||||
|
@ -950,7 +950,7 @@ gboolean nstrace_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset
|
|||
|
||||
|
||||
gboolean nstrace_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
@ -1131,7 +1131,7 @@ static gboolean nstrace_add_signature(wtap_dumper *wdh, int *err)
|
|||
|
||||
static gboolean
|
||||
nstrace_add_abstime(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv;
|
||||
guint64 nsg_creltime;
|
||||
|
@ -1199,7 +1199,7 @@ nstrace_add_abstime(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
|||
/* Write a record for a packet to a dump file.
|
||||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err)
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err)
|
||||
{
|
||||
nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ struct nettl_file_hdr {
|
|||
gchar tz[20];
|
||||
gchar host_name[9];
|
||||
gchar os_vers[9];
|
||||
guchar os_v;
|
||||
guint8 os_v;
|
||||
guint8 xxa[8];
|
||||
gchar model[11];
|
||||
guint16 unknown; /* just padding to 128 bytes? */
|
||||
|
@ -182,15 +182,15 @@ typedef struct {
|
|||
static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean nettl_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd,
|
||||
int length, int *err, gchar **err_info);
|
||||
static int nettl_read_rec_header(wtap *wth, FILE_T fh,
|
||||
struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header,
|
||||
int *err, gchar **err_info, gboolean *fddihack);
|
||||
static gboolean nettl_read_rec_data(FILE_T fh, guchar *pd, int length,
|
||||
static gboolean nettl_read_rec_data(FILE_T fh, guint8 *pd, int length,
|
||||
int *err, gchar **err_info, gboolean fddihack);
|
||||
static gboolean nettl_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
|
||||
int nettl_open(wtap *wth, int *err, gchar **err_info)
|
||||
{
|
||||
|
@ -346,7 +346,7 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean
|
||||
nettl_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd,
|
||||
int length, int *err, gchar **err_info)
|
||||
{
|
||||
int ret;
|
||||
|
@ -650,7 +650,7 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
nettl_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
nettl_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info, gboolean fddihack)
|
||||
{
|
||||
int bytes_to_read, bytes_read;
|
||||
|
@ -767,7 +767,7 @@ gboolean nettl_dump_open(wtap_dumper *wdh, int *err)
|
|||
static gboolean nettl_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
struct nettlrec_hdr rec_hdr;
|
||||
guint8 dummyc[24];
|
||||
|
|
|
@ -103,7 +103,7 @@ static void init_gmt_to_localtime_offset(void)
|
|||
static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static int read_packet_header(FILE_T fh, packet_entry_header *packet_header,
|
||||
int *err, gchar **err_info);
|
||||
|
@ -112,7 +112,7 @@ static int read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_f
|
|||
static gboolean skip_to_next_packet(wtap *wth, int offset_to_next_packet,
|
||||
int current_offset_from_packet_header, int *err, char **err_info);
|
||||
static gboolean observer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
static gint observer_to_wtap_encap(int observer_encap);
|
||||
static gint wtap_to_observer_encap(int wtap_encap);
|
||||
|
||||
|
@ -371,7 +371,7 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
/* Reads a packet at an offset. */
|
||||
static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
packet_entry_header packet_header;
|
||||
|
@ -648,7 +648,7 @@ gboolean network_instruments_dump_open(wtap_dumper *wdh, int *err)
|
|||
/* Write a record for a packet to a dump file.
|
||||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean observer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_, const guchar *pd,
|
||||
const union wtap_pseudo_header *pseudo_header _U_, const guint8 *pd,
|
||||
int *err)
|
||||
{
|
||||
observer_dump_private_state * private_state = NULL;
|
||||
|
|
|
@ -321,7 +321,7 @@ typedef struct {
|
|||
static gboolean netxray_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean netxray_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static int netxray_read_rec_header(wtap *wth, FILE_T fh,
|
||||
union netxrayrec_hdr *hdr, int *err, gchar **err_info);
|
||||
|
@ -331,11 +331,11 @@ static gboolean netxray_read_rec_data(FILE_T fh, guint8 *data_ptr,
|
|||
guint32 packet_size, int *err, gchar **err_info);
|
||||
static gboolean netxray_dump_1_1(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
static gboolean netxray_dump_close_1_1(wtap_dumper *wdh, int *err);
|
||||
static gboolean netxray_dump_2_0(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
static gboolean netxray_dump_close_2_0(wtap_dumper *wdh, int *err);
|
||||
|
||||
int netxray_open(wtap *wth, int *err, gchar **err_info)
|
||||
|
@ -1042,7 +1042,7 @@ reread:
|
|||
|
||||
static gboolean
|
||||
netxray_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
union netxrayrec_hdr hdr;
|
||||
|
@ -1540,7 +1540,7 @@ gboolean netxray_dump_open_1_1(wtap_dumper *wdh, int *err)
|
|||
static gboolean netxray_dump_1_1(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
netxray_dump_t *netxray = (netxray_dump_t *)wdh->priv;
|
||||
guint64 timestamp;
|
||||
|
@ -1700,7 +1700,7 @@ gboolean netxray_dump_open_2_0(wtap_dumper *wdh, int *err)
|
|||
static gboolean netxray_dump_2_0(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
netxray_dump_t *netxray = (netxray_dump_t *)wdh->priv;
|
||||
guint64 timestamp;
|
||||
|
|
|
@ -489,7 +489,7 @@ static int process_rec_header2_v145(wtap *wth, unsigned char *buffer,
|
|||
static gboolean ngsniffer_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size,
|
||||
int *err, gchar **err_info);
|
||||
static int ngsniffer_read_rec_header(wtap *wth, gboolean is_random,
|
||||
guint16 *typep, guint16 *lengthp, int *err, gchar **err_info);
|
||||
|
@ -506,14 +506,14 @@ static gboolean ngsniffer_read_frame6(wtap *wth, gboolean is_random,
|
|||
static void set_pseudo_header_frame6(wtap *wth,
|
||||
union wtap_pseudo_header *pseudo_header, struct frame6_rec *frame6);
|
||||
static gboolean ngsniffer_read_rec_data(wtap *wth, gboolean is_random,
|
||||
guchar *pd, unsigned int length, int *err, gchar **err_info);
|
||||
guint8 *pd, unsigned int length, int *err, gchar **err_info);
|
||||
static int infer_pkt_encap(const guint8 *pd, int len);
|
||||
static int fix_pseudo_header(int encap, const guint8 *pd, int len,
|
||||
union wtap_pseudo_header *pseudo_header);
|
||||
static void ngsniffer_sequential_close(wtap *wth);
|
||||
static void ngsniffer_close(wtap *wth);
|
||||
static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
static gboolean ngsniffer_dump_close(wtap_dumper *wdh, int *err);
|
||||
static int SnifferDecompress( unsigned char * inbuf, size_t inlen,
|
||||
unsigned char * outbuf, size_t outlen, int *err );
|
||||
|
@ -1050,7 +1050,7 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
guint16 time_low, time_med, true_size, size;
|
||||
guint8 time_high, time_day;
|
||||
guint64 t, tsecs, tpsecs;
|
||||
guchar *pd;
|
||||
guint8 *pd;
|
||||
|
||||
ngsniffer = (ngsniffer_t *)wth->priv;
|
||||
for (;;) {
|
||||
|
@ -1248,7 +1248,7 @@ found:
|
|||
|
||||
static gboolean
|
||||
ngsniffer_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
int ret;
|
||||
|
@ -1777,7 +1777,7 @@ set_pseudo_header_frame6(wtap *wth, union wtap_pseudo_header *pseudo_header,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ngsniffer_read_rec_data(wtap *wth, gboolean is_random, guchar *pd,
|
||||
ngsniffer_read_rec_data(wtap *wth, gboolean is_random, guint8 *pd,
|
||||
unsigned int length, int *err, gchar **err_info)
|
||||
{
|
||||
gint64 bytes_read;
|
||||
|
@ -2084,7 +2084,7 @@ ngsniffer_dump_open(wtap_dumper *wdh, int *err)
|
|||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean
|
||||
ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err)
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err)
|
||||
{
|
||||
ngsniffer_dump_t *ngsniffer = (ngsniffer_dump_t *)wdh->priv;
|
||||
struct frame2_rec rec_hdr;
|
||||
|
|
|
@ -52,7 +52,7 @@ static gboolean packetlogger_read(wtap *wth, int *err, gchar **err_info,
|
|||
gint64 *data_offset);
|
||||
static gboolean packetlogger_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header _U_,
|
||||
guchar *pd, int length, int *err,
|
||||
guint8 *pd, int length, int *err,
|
||||
gchar **err_info);
|
||||
static gboolean packetlogger_read_header(packetlogger_header_t *pl_hdr,
|
||||
FILE_T fh, int *err, gchar **err_info);
|
||||
|
@ -132,7 +132,7 @@ packetlogger_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
|
||||
static gboolean
|
||||
packetlogger_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
|
||||
*pseudo_header _U_, guchar *pd, int length, int *err,
|
||||
*pseudo_header _U_, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
packetlogger_header_t pl_hdr;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <errno.h>
|
||||
#include "wtap-int.h"
|
||||
#include "file_wrappers.h"
|
||||
#include "atm.h"
|
||||
#include "erf.h"
|
||||
#include "pcap-encap.h"
|
||||
#include "pcap-common.h"
|
||||
|
@ -1621,9 +1622,46 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
|||
return phdr_len;
|
||||
}
|
||||
|
||||
void
|
||||
pcap_fill_in_pseudo_header(int file_type, int wtap_encap, guint8 *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, int fcs_len)
|
||||
{
|
||||
switch (wtap_encap) {
|
||||
|
||||
case WTAP_ENCAP_ATM_PDUS:
|
||||
if (file_type == WTAP_FILE_PCAP_NOKIA) {
|
||||
/*
|
||||
* Nokia IPSO ATM.
|
||||
*
|
||||
* Guess the traffic type based on the packet
|
||||
* contents.
|
||||
*/
|
||||
atm_guess_traffic_type(pd, length, pseudo_header);
|
||||
} else {
|
||||
/*
|
||||
* SunATM.
|
||||
*
|
||||
* If this is ATM LANE traffic, try to guess what
|
||||
* type of LANE traffic it is based on the packet
|
||||
* contents.
|
||||
*/
|
||||
if (pseudo_header->atm.type == TRAF_LANE)
|
||||
atm_guess_lane_type(pd, length, pseudo_header);
|
||||
}
|
||||
break;
|
||||
|
||||
case WTAP_ENCAP_ETHERNET:
|
||||
pseudo_header->eth.fcs_len = fcs_len;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pcap_read_post_process(int wtap_encap, guint packet_size,
|
||||
gboolean bytes_swapped, guchar *pd)
|
||||
gboolean bytes_swapped, guint8 *pd)
|
||||
{
|
||||
switch (wtap_encap) {
|
||||
|
||||
|
|
|
@ -34,8 +34,12 @@ extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
|||
guint packet_size, gboolean check_packet_size, struct wtap_pkthdr *phdr,
|
||||
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info);
|
||||
|
||||
extern void pcap_fill_in_pseudo_header(int file_type, int wtap_encap,
|
||||
guint8 *pd, int length, union wtap_pseudo_header *pseudo_header,
|
||||
int fcs_len);
|
||||
|
||||
extern void pcap_read_post_process(int wtap_encap, guint packet_size,
|
||||
gboolean bytes_swapped, guchar *pd);
|
||||
gboolean bytes_swapped, guint8 *pd);
|
||||
|
||||
extern int pcap_get_phdr_size(int encap,
|
||||
const union wtap_pseudo_header *pseudo_header);
|
||||
|
|
|
@ -87,7 +87,7 @@ pcapng_read(wtap *wth, int *err, gchar **err_info,
|
|||
gint64 *data_offset);
|
||||
static gboolean
|
||||
pcapng_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static void
|
||||
pcapng_close(wtap *wth);
|
||||
|
@ -297,7 +297,7 @@ typedef struct wtapng_block_s {
|
|||
*/
|
||||
const union wtap_pseudo_header *pseudo_header;
|
||||
struct wtap_pkthdr *packet_header;
|
||||
const guchar *frame_buffer;
|
||||
const guint8 *frame_buffer;
|
||||
int *file_encap;
|
||||
} wtapng_block_t;
|
||||
|
||||
|
@ -782,7 +782,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
|
|||
gint wtap_encap;
|
||||
int pseudo_header_len;
|
||||
char option_content[100]; /* XXX - size might need to be increased, if we see longer options */
|
||||
|
||||
int fcslen;
|
||||
|
||||
/* "(Enhanced) Packet Block" read fixed part */
|
||||
errno = WTAP_ERR_CANT_READ;
|
||||
|
@ -887,7 +887,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
|
|||
|
||||
/* "(Enhanced) Packet Block" read capture data */
|
||||
errno = WTAP_ERR_CANT_READ;
|
||||
bytes_read = file_read((guchar *) (wblock->frame_buffer), wblock->data.packet.cap_len - pseudo_header_len, fh);
|
||||
bytes_read = file_read((guint8 *) (wblock->frame_buffer), wblock->data.packet.cap_len - pseudo_header_len, fh);
|
||||
if (bytes_read != (int) (wblock->data.packet.cap_len - pseudo_header_len)) {
|
||||
*err = file_error(fh, err_info);
|
||||
pcapng_debug1("pcapng_read_packet_block: couldn't read %u bytes of captured data",
|
||||
|
@ -922,6 +922,9 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
|
|||
wblock->data.packet.drop_count = -1;
|
||||
wblock->data.packet.pack_flags = 0; /* XXX - is 0 ok to signal "not used"? */
|
||||
|
||||
/* FCS length default */
|
||||
fcslen = pn->if_fcslen;
|
||||
|
||||
/* Options */
|
||||
errno = WTAP_ERR_CANT_READ;
|
||||
to_read = block_total_length
|
||||
|
@ -963,6 +966,10 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
|
|||
memcpy(&wblock->data.packet.pack_flags, option_content, sizeof(guint32));
|
||||
if(pn->byte_swapped)
|
||||
wblock->data.packet.pack_flags = BSWAP32(wblock->data.packet.pack_flags);
|
||||
if (wblock->data.packet.pack_flags & 0x000001E0) {
|
||||
/* The FCS length is present */
|
||||
fcslen = (wblock->data.packet.pack_flags & 0x000001E0) >> 5;
|
||||
}
|
||||
pcapng_debug1("pcapng_read_if_descr_block: pack_flags %u (ignored)", wblock->data.packet.pack_flags);
|
||||
} else {
|
||||
pcapng_debug1("pcapng_read_if_descr_block: pack_flags length %u not 4 as expected", oh.option_length);
|
||||
|
@ -974,9 +981,14 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
|
|||
}
|
||||
}
|
||||
|
||||
pcap_fill_in_pseudo_header(WTAP_FILE_PCAPNG, wtap_encap,
|
||||
(guint8 *) (wblock->frame_buffer),
|
||||
(int) (wblock->data.packet.cap_len - pseudo_header_len),
|
||||
(union wtap_pseudo_header *)wblock->pseudo_header, fcslen);
|
||||
|
||||
pcap_read_post_process(wtap_encap,
|
||||
(int) (wblock->data.packet.cap_len - pseudo_header_len),
|
||||
pn->byte_swapped, (guchar *) (wblock->frame_buffer));
|
||||
pn->byte_swapped, (guint8 *) (wblock->frame_buffer));
|
||||
return block_read;
|
||||
}
|
||||
|
||||
|
@ -1051,16 +1063,11 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
|
|||
pseudo_header_len);
|
||||
}
|
||||
|
||||
/* XXX - implement other linktypes then Ethernet */
|
||||
/* (or even better share the code with libpcap.c) */
|
||||
|
||||
/* Ethernet FCS length, might be overwritten by "per packet" options */
|
||||
memset((void *)wblock->pseudo_header, 0, sizeof(union wtap_pseudo_header));
|
||||
((union wtap_pseudo_header *) wblock->pseudo_header)->eth.fcs_len = pn->if_fcslen;
|
||||
|
||||
/* "Simple Packet Block" read capture data */
|
||||
errno = WTAP_ERR_CANT_READ;
|
||||
bytes_read = file_read((guchar *) (wblock->frame_buffer), wblock->data.simple_packet.cap_len, fh);
|
||||
bytes_read = file_read((guint8 *) (wblock->frame_buffer), wblock->data.simple_packet.cap_len, fh);
|
||||
if (bytes_read != (int) wblock->data.simple_packet.cap_len) {
|
||||
*err = file_error(fh, err_info);
|
||||
pcapng_debug1("pcapng_read_simple_packet_block: couldn't read %u bytes of captured data",
|
||||
|
@ -1082,8 +1089,14 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
|
|||
block_read += 4 - (wblock->data.simple_packet.cap_len % 4);
|
||||
}
|
||||
|
||||
pcap_fill_in_pseudo_header(WTAP_FILE_PCAPNG, encap,
|
||||
(guint8 *) (wblock->frame_buffer),
|
||||
(int) wblock->data.simple_packet.cap_len,
|
||||
(union wtap_pseudo_header *)wblock->pseudo_header,
|
||||
pn->if_fcslen);
|
||||
|
||||
pcap_read_post_process(encap, (int) wblock->data.simple_packet.cap_len,
|
||||
pn->byte_swapped, (guchar *) (wblock->frame_buffer));
|
||||
pn->byte_swapped, (guint8 *) (wblock->frame_buffer));
|
||||
return block_read;
|
||||
}
|
||||
|
||||
|
@ -1101,7 +1114,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
|
|||
int to_read;
|
||||
guint64 file_offset64;
|
||||
pcapng_name_resolution_block_t nrb;
|
||||
guchar nrb_rec[MAX_NRB_REC_SIZE];
|
||||
guint8 nrb_rec[MAX_NRB_REC_SIZE];
|
||||
guint32 v4_addr;
|
||||
|
||||
errno = WTAP_ERR_CANT_READ;
|
||||
|
@ -1584,7 +1597,7 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
/* classic wtap: seek to file position and read packet */
|
||||
static gboolean
|
||||
pcapng_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length _U_,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length _U_,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
pcapng_t *pcapng = (pcapng_t *)wth->priv;
|
||||
|
@ -1804,7 +1817,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, pcapng_dump_t *pcapng, int
|
|||
struct addrinfo *ai;
|
||||
struct sockaddr_in *sa4;
|
||||
struct sockaddr_in6 *sa6;
|
||||
guchar *rec_data;
|
||||
guint8 *rec_data;
|
||||
gint rec_off, namelen, tot_rec_len;
|
||||
|
||||
if (! pcapng->addrinfo_list_last || ! pcapng->addrinfo_list_last->ai_next) {
|
||||
|
@ -1934,7 +1947,7 @@ pcapng_lookup_interface_id_by_encap(int wtap_encap, wtap_dumper *wdh)
|
|||
static gboolean pcapng_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
wtapng_block_t wblock;
|
||||
interface_data_t int_data;
|
||||
|
|
|
@ -91,11 +91,11 @@ struct radcomrec_hdr {
|
|||
static gboolean radcom_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean radcom_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static int radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean radcom_read_rec_data(FILE_T fh, guchar *pd, int length,
|
||||
static gboolean radcom_read_rec_data(FILE_T fh, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
int radcom_open(wtap *wth, int *err, gchar **err_info)
|
||||
|
@ -279,7 +279,7 @@ static gboolean radcom_read(wtap *wth, int *err, gchar **err_info,
|
|||
guint32 sec;
|
||||
int bytes_read;
|
||||
struct tm tm;
|
||||
guchar phdr[8];
|
||||
guint8 phdr[8];
|
||||
char fcs[2];
|
||||
|
||||
/* Read record header. */
|
||||
|
@ -379,12 +379,12 @@ static gboolean radcom_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean
|
||||
radcom_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
int ret;
|
||||
struct radcomrec_hdr hdr;
|
||||
guchar phdr[8];
|
||||
guint8 phdr[8];
|
||||
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
return FALSE;
|
||||
|
@ -450,7 +450,7 @@ radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr, int *err,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
radcom_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
radcom_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
|
|
@ -91,17 +91,17 @@ struct shomiti_trailer {
|
|||
static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean snoop_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean snoop_read_atm_pseudoheader(FILE_T fh,
|
||||
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info);
|
||||
static gboolean snoop_read_shomiti_wireless_pseudoheader(FILE_T fh,
|
||||
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info,
|
||||
int *header_size);
|
||||
static gboolean snoop_read_rec_data(FILE_T fh, guchar *pd, int length,
|
||||
static gboolean snoop_read_rec_data(FILE_T fh, guint8 *pd, int length,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
|
||||
/*
|
||||
* See
|
||||
|
@ -634,7 +634,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
static gboolean
|
||||
snoop_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
|
@ -836,7 +836,7 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
snoop_read_rec_data(FILE_T fh, guchar *pd, int length, int *err,
|
||||
snoop_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
||||
gchar **err_info)
|
||||
{
|
||||
int bytes_read;
|
||||
|
@ -913,7 +913,7 @@ gboolean snoop_dump_open(wtap_dumper *wdh, int *err)
|
|||
static gboolean snoop_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header _U_,
|
||||
const guchar *pd, int *err)
|
||||
const guint8 *pd, int *err)
|
||||
{
|
||||
struct snooprec_hdr rec_hdr;
|
||||
int reclen;
|
||||
|
|
|
@ -165,12 +165,12 @@ struct visual_write_info
|
|||
static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
|
||||
gint64 *data_offset);
|
||||
static gboolean visual_seek_read(wtap *wth, gint64 seek_off,
|
||||
union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd, int packet_size,
|
||||
int *err, gchar **err_info);
|
||||
static void visual_set_pseudo_header(int encap, struct visual_pkt_hdr *vpkt_hdr,
|
||||
struct visual_atm_hdr *vatm_hdr, union wtap_pseudo_header *pseudo_header);
|
||||
static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err);
|
||||
static gboolean visual_dump_close(wtap_dumper *wdh, int *err);
|
||||
static void visual_dump_free(wtap_dumper *wdh);
|
||||
|
||||
|
@ -702,7 +702,7 @@ gboolean visual_dump_open(wtap_dumper *wdh, int *err)
|
|||
/* Write a packet to a Visual dump file.
|
||||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err)
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err)
|
||||
{
|
||||
struct visual_write_info * visual = wdh->priv;
|
||||
struct visual_pkt_hdr vpkt_hdr;
|
||||
|
|
|
@ -81,7 +81,7 @@ typedef void *WFILE_T;
|
|||
|
||||
typedef gboolean (*subtype_write_func)(struct wtap_dumper*,
|
||||
const struct wtap_pkthdr*, const union wtap_pseudo_header*,
|
||||
const guchar*, int*);
|
||||
const guint8*, int*);
|
||||
typedef gboolean (*subtype_close_func)(struct wtap_dumper*, int*);
|
||||
|
||||
struct wtap_dumper {
|
||||
|
|
|
@ -597,7 +597,7 @@ struct k12_phdr {
|
|||
const gchar* stack_file;
|
||||
guint32 input_type;
|
||||
k12_input_info_t input_info;
|
||||
guchar* extra_info;
|
||||
guint8* extra_info;
|
||||
guint32 extra_length;
|
||||
void* stuff;
|
||||
};
|
||||
|
@ -938,7 +938,7 @@ wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap,
|
|||
wtap_dumper* wtap_dump_fdopen(int fd, int filetype, int encap, int snaplen,
|
||||
gboolean compressed, int *err);
|
||||
gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *,
|
||||
const union wtap_pseudo_header *pseudo_header, const guchar *, int *err);
|
||||
const union wtap_pseudo_header *pseudo_header, const guint8 *, int *err);
|
||||
void wtap_dump_flush(wtap_dumper *);
|
||||
gint64 wtap_get_bytes_dumped(wtap_dumper *);
|
||||
void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped);
|
||||
|
|
Loading…
Reference in New Issue