コード例 #1
0
/* XXX - Should these be converted to string buffers? */
void
print_nsap_net_buf( const guint8 *ad, int length, gchar *buf, int buf_len)
{
  gchar *cur;

  /* to do : NSAP / NET decoding */

  if ( (length <= 0 ) || ( length > MAX_NSAP_LEN ) ) {
    g_snprintf(buf, buf_len, "<Invalid length of NSAP>");
    return;
  }
  cur = buf;
  if ( ( length == RFC1237_NSAP_LEN ) || ( length == RFC1237_NSAP_LEN + 1 ) ) {
    print_area_buf(ad, RFC1237_FULLAREA_LEN, cur, buf_len);
    cur += strlen( cur );
    print_system_id_buf( ad + RFC1237_FULLAREA_LEN, RFC1237_SYSTEMID_LEN, cur, (int) (buf_len-(cur-buf)));
    cur += strlen( cur );
    cur += g_snprintf(cur, (gulong) (buf_len-(cur-buf)), "[%02x]",
                    ad[ RFC1237_FULLAREA_LEN + RFC1237_SYSTEMID_LEN ] );
    if ( length == RFC1237_NSAP_LEN + 1 ) {
      g_snprintf(cur, (int) (buf_len-(cur-buf)), "-%02x", ad[ length -1 ] );
    }
  }
  else {    /* probably format as standard */
    print_area_buf( ad, length, buf, buf_len);
  }
} /* print_nsap */
コード例 #2
0
gchar *
print_area(const guint8 *ad, int length)
{
  gchar *cur;

  cur = ep_alloc(MAX_AREA_LEN * 3 + 20);
  print_area_buf(ad, length, cur, MAX_AREA_LEN * 3 + 20);
  return cur;
}
コード例 #3
0
ファイル: osi-utils.c プロジェクト: CharaD7/wireshark
gchar *
print_area(tvbuff_t *tvb, const gint offset, int length)
{
  gchar *cur;

  cur = (gchar *)wmem_alloc(wmem_packet_scope(), MAX_AREA_LEN * 3 + 20);
  print_area_buf(tvb_get_ptr(tvb, offset, length), length, cur, MAX_AREA_LEN * 3 + 20);
  return cur;
}