Exemplo n.º 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 */
Exemplo n.º 2
0
gchar *
print_system_id( const guint8 *ad, int length )
{
  gchar        *cur;

  cur = ep_alloc(MAX_SYSTEMID_LEN * 3 + 5);
  print_system_id_buf(ad, length, cur, MAX_SYSTEMID_LEN * 3 + 5);
  return( cur );
}
Exemplo n.º 3
0
gchar *
print_system_id(wmem_allocator_t* scope, const guint8 *ad, int length )
{
  gchar        *cur;

  cur = (gchar *)wmem_alloc(scope, MAX_SYSTEMID_LEN * 3 + 5);
  print_system_id_buf(ad, length, cur, MAX_SYSTEMID_LEN * 3 + 5);
  return( cur );
}
Exemplo n.º 4
0
static void
system_id_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf, unsigned int size)
{
	print_system_id_buf(fv->value.bytes->data,fv->value.bytes->len, buf, size);
}
Exemplo n.º 5
0
static void
system_id_to_repr(fvalue_t *fv, ftrepr_t rtype, int field_display, char *buf)
{
	print_system_id_buf(fv->value.bytes->data,fv->value.bytes->len, buf, bytes_repr_len(fv, rtype, field_display));
}