Commit 29f4f0c3 authored by Dafydd Harries's avatar Dafydd Harries
Browse files

fix dumping of STUN transaction IDs

darcs-hash:20070202093536-c9803-98c5a5bb6cd662ac89532301fb38473f59088c3b.gz
parent 2cfbddd8
......@@ -321,10 +321,10 @@ stun_message_dump (StunMessage *msg)
g_string_printf (tmp,
"%s %08x:%08x:%08x:%08x\n",
name,
*(guint32 *)(msg->transaction_id),
*(guint32 *)(msg->transaction_id + 4),
*(guint32 *)(msg->transaction_id + 8),
*(guint32 *)(msg->transaction_id + 12));
ntohl (*(guint32 *)(msg->transaction_id)),
ntohl (*(guint32 *)(msg->transaction_id + 4)),
ntohl (*(guint32 *)(msg->transaction_id + 8)),
ntohl (*(guint32 *)(msg->transaction_id + 12)));
if (msg->attributes)
for (attr = msg->attributes; *attr; attr++)
......
......@@ -9,13 +9,14 @@ main (void)
StunMessage *msg;
gchar *dump;
msg = stun_message_new (STUN_MESSAGE_BINDING_REQUEST, NULL, 1);
msg = stun_message_new (STUN_MESSAGE_BINDING_REQUEST,
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 1);
msg->attributes[0] = stun_attribute_mapped_address_new (0x02030405, 2345);
dump = stun_message_dump (msg);
g_assert (NULL != dump);
g_assert (0 == strcmp (dump,
"BINDING-REQUEST 00000000:00000000:00000000:00000000\n"
"BINDING-REQUEST 00010203:04050607:08090a0b:0c0d0e0f\n"
" MAPPED-ADDRESS 2.3.4.5:2345\n"));
g_free (dump);
stun_message_free (msg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment