コード例 #1
0
ファイル: packet-nasdaq-itch.c プロジェクト: pvons/wireshark
/* -------------------------- */
static int
price(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int id, int offset, int big)
{
  gint size = (big) ? 19 : 10;

  const char *str_value = tvb_get_string(wmem_packet_scope(), tvb, offset, size);
  gdouble     value     = guint64_to_gdouble(g_ascii_strtoull(str_value, NULL, 10))/((big)?1000000.0:10000.0);

  proto_tree_add_double(nasdaq_itch_tree, id, tvb, offset, size, value);
  col_append_fstr(pinfo->cinfo, COL_INFO, "price %g ", value);

  return offset + size;
}
コード例 #2
0
/* -------------------------- */
static int
price(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int id, int offset, int big)
{
  gint col_info = PINFO_COL(pinfo);
  gint size = (big)?19:10;

  if (nasdaq_itch_tree || col_info) {
      const char *str_value = tvb_get_ephemeral_string(tvb, offset, size);
      gdouble value = guint64_to_gdouble(g_ascii_strtoull(str_value, NULL, 10))/((big)?1000000.0:10000.0);

      proto_tree_add_double(nasdaq_itch_tree, id, tvb, offset, size, value);
      if (col_info) {
          col_append_fstr(pinfo->cinfo, COL_INFO, "price %g ", value);
      }
  }
  return offset+size;
}