Esempio n. 1
0
/* Find the next packet and parse it; called from wtap_read(). */
static gboolean vms_read(wtap *wth, int *err, gchar **err_info,
    gint64 *data_offset)
{
    gint64   offset = 0;
    guint8    *buf;
    int    pkt_len;

    /* Find the next packet */
#ifdef TCPIPTRACE_FRAGMENTS_HAVE_HEADER_LINE
    offset = vms_seek_next_packet(wth, err);
#else
    offset = file_tell(wth->fh);
#endif
    if (offset < 1) {
        *err = file_error(wth->fh, err_info);
        return FALSE;
    }

    /* Parse the header */
    pkt_len = parse_vms_rec_hdr(wth, wth->fh, err, err_info);
    if (pkt_len == -1)
	return FALSE;

    /* Make sure we have enough room for the packet */
    buffer_assure_space(wth->frame_buffer, pkt_len);
    buf = buffer_start_ptr(wth->frame_buffer);

    /* Convert the ASCII hex dump to binary data */
    if (!parse_vms_hex_dump(wth->fh, pkt_len, buf, err, err_info))
        return FALSE;

    *data_offset = offset;
    return TRUE;
}
Esempio n. 2
0
/* Find the next packet and parse it; called from wtap_read(). */
static gboolean vms_read(wtap *wth, wtap_rec *rec, Buffer *buf,
    int *err, gchar **err_info, gint64 *data_offset)
{
    gint64   offset = 0;

    /* Find the next packet */
#ifdef TCPIPTRACE_FRAGMENTS_HAVE_HEADER_LINE
    offset = vms_seek_next_packet(wth, err, err_info);
#else
    offset = file_tell(wth->fh);
#endif
    if (offset < 1) {
        *err = file_error(wth->fh, err_info);
        return FALSE;
    }
    *data_offset = offset;

    /* Parse the packet */
    return parse_vms_packet(wth->fh, rec, buf, err, err_info);
}