Пример #1
0
/*
 * Read packets in random-access fashion
 */
static gboolean
iseries_seek_read (wtap * wth, gint64 seek_off,
                   struct wtap_pkthdr *phdr, guint8 * pd,
                   int len, int *err, gchar ** err_info)
{
  union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
  int cap_len;

  /* seek to packet location */
  if (file_seek (wth->random_fh, seek_off - 1, SEEK_SET, err) == -1)
    return FALSE;

  /*
   * Parse the packet and extract the various fields
   */
  cap_len = iseries_parse_packet (wth, wth->random_fh, pseudo_header, pd,
                                  err, err_info);

  if (cap_len != len)
    {
      if (cap_len != -1)
        {
          *err = WTAP_ERR_BAD_FILE;
          *err_info =
            g_strdup_printf ("iseries: requested length %d doesn't match record length %d",
             len, cap_len);
        }
      return FALSE;
    }
  return TRUE;
}
Пример #2
0
/*
 * Find the next packet and parse it; called from wtap_read().
 */
static gboolean
iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset)
{
  gint64 offset;
  int    cap_len;

  /*
   * Locate the next packet
   */
  offset = iseries_seek_next_packet (wth, err, err_info);
  if (offset < 1)
    return FALSE;

  /*
   * Parse the packet and extract the various fields
   */
  cap_len =
    iseries_parse_packet (wth, wth->fh, &wth->phdr.pseudo_header, NULL, err,
                          err_info);
  if (cap_len == -1)
    return FALSE;

  *data_offset     = offset;
  return TRUE;
}
Пример #3
0
/*
 * Read packets in random-access fashion
 */
static gboolean
iseries_seek_read (wtap * wth, gint64 seek_off, struct wtap_pkthdr *phdr,
                   Buffer * buf, int len _U_, int *err, gchar ** err_info)
{

    /* seek to packet location */
    if (file_seek (wth->random_fh, seek_off - 1, SEEK_SET, err) == -1)
        return FALSE;

    /*
     * Parse the packet and extract the various fields
     */
    return iseries_parse_packet (wth, wth->random_fh, phdr, buf,
                                 err, err_info);
}
Пример #4
0
/*
 * Find the next packet and parse it; called from wtap_read().
 */
static gboolean
iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset)
{
    gint64 offset;

    /*
     * Locate the next packet
     */
    offset = iseries_seek_next_packet (wth, err, err_info);
    if (offset < 0)
        return FALSE;
    *data_offset     = offset;

    /*
     * Parse the packet and extract the various fields
     */
    return iseries_parse_packet (wth, wth->fh, &wth->phdr, wth->frame_buffer,
                                 err, err_info);
}