From 9a295ae36434be3129f64b8e6a8cd41fc10a6357 Mon Sep 17 00:00:00 2001 From: etxrab Date: Thu, 1 Dec 2005 20:02:45 +0000 Subject: Add TIPC address as address type and use it in TIPC. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16641 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/to_str.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'epan/to_str.c') diff --git a/epan/to_str.c b/epan/to_str.c index bde3ac5c10..138d831e99 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -822,6 +822,9 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len) buf[copy_len] = '\0'; } break; + case AT_TIPC: + tipc_addr_to_str_buf(addr->data, buf, buf_len); + break; default: g_assert_not_reached(); } @@ -879,3 +882,28 @@ gchar* guid_to_str_buf(const guint8 *guid, gchar *buf, int buf_len) { guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]); return buf; } + +void +tipc_addr_to_str_buf( const guint8 *data, gchar *buf, int buf_len){ + guint8 zone; + guint16 subnetwork; + guint16 processor; + guint32 tipc_address; + + tipc_address = data[0]; + tipc_address = (tipc_address << 8) ^ data[1]; + tipc_address = (tipc_address << 8) ^ data[2]; + tipc_address = (tipc_address << 8) ^ data[3]; + + processor = tipc_address & 0x0fff; + + tipc_address = tipc_address >> 12; + subnetwork = tipc_address & 0x0fff; + + tipc_address = tipc_address >> 12; + zone = tipc_address & 0xff; + + g_snprintf(buf,buf_len,"%u.%u.%u",zone,subnetwork,processor); + + +} \ No newline at end of file -- cgit v1.2.3