aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2005-12-01 20:02:45 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2005-12-01 20:02:45 +0000
commit9a295ae36434be3129f64b8e6a8cd41fc10a6357 (patch)
treec1762a131bf0d5dd145d94e3d0410710778429bc /epan/to_str.c
parentd62b700f3ee3b8908ba1d4b1ae61bbe50b31b8dc (diff)
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
Diffstat (limited to 'epan/to_str.c')
-rw-r--r--epan/to_str.c28
1 files changed, 28 insertions, 0 deletions
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