/* Find the next packet and parse it; called from wtap_read(). */ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { gint64 offset; guint8 *buf; int pkt_len, caplen; char line[COSINE_LINE_LENGTH]; /* Find the next packet */ offset = cosine_seek_next_packet(wth, err, err_info, line); if (offset < 0) return FALSE; /* Parse the header */ pkt_len = parse_cosine_rec_hdr(wth, line, &wth->pseudo_header, err, err_info); if (pkt_len == -1) return FALSE; /* Make sure we have enough room for the packet */ buffer_assure_space(wth->frame_buffer, COSINE_MAX_PACKET_LEN); buf = buffer_start_ptr(wth->frame_buffer); /* Convert the ASCII hex dump to binary data */ if ((caplen = parse_cosine_hex_dump(wth->fh, pkt_len, buf, err, err_info)) == -1) return FALSE; wth->data_offset = offset; wth->phdr.caplen = caplen; *data_offset = offset; return TRUE; }
/* Find the next packet and parse it; called from wtap_read(). */ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { gint64 offset; char line[COSINE_LINE_LENGTH]; /* Find the next packet */ offset = cosine_seek_next_packet(wth, err, err_info, line); if (offset < 0) return FALSE; *data_offset = offset; /* Parse the header and convert the ASCII hex dump to binary data */ return parse_cosine_packet(wth->fh, &wth->phdr, wth->frame_buffer, line, err, err_info); }