diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2011-05-08 10:23:53 +0000 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2011-05-08 10:23:53 +0000 |
commit | 7d317e553b95cf302d3acf3a9966c92c92f44c80 (patch) | |
tree | 064056433d1b4da25ce28966c34f0e2a1668feb3 /epan/address_to_str.c | |
parent | 8428b08b1a11bfebd6a6039362eaa528727ac904 (diff) |
Add FT_EUI64 Field Type
* Remove proto_tree_add_eui64 function from 802.15.4 Dissector
* Replace print_eui64/print_eui64 by eui64_to_str/get_eui64_name
* Update Documentation (README.dev)
* Add new function in libwireshark.def
* Support of encoding for tvb_eui64_to_str
* Use FT_EUI64 for ICMPv6, CAPWAP, Zbee ... dissector
svn path=/trunk/; revision=37015
Diffstat (limited to 'epan/address_to_str.c')
-rw-r--r-- | epan/address_to_str.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/epan/address_to_str.c b/epan/address_to_str.c index a1eafe891a..16831ee68d 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -321,6 +321,37 @@ tvb_vines_addr_to_str(tvbuff_t *tvb, const gint offset) return buf; } +/* + This function is very fast and this function is called a lot. + XXX update the ep_address_to_str stuff to use this function. +*/ +gchar * +eui64_to_str(const guint64 ad) { + gchar *buf; + guint8 *p_eui64; + + p_eui64 = ep_alloc(8); + buf=ep_alloc(EUI64_STR_LEN); + + /* Copy and convert the address to network byte order. */ + *(guint64 *)(p_eui64) = pntoh64(&(ad)); + + sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", + p_eui64[0], p_eui64[1], p_eui64[2], p_eui64[3], + p_eui64[4], p_eui64[5], p_eui64[6], p_eui64[7] ); + return buf; +} +gchar * +tvb_eui64_to_str(tvbuff_t *tvb, const gint offset, const guint encoding) +{ + if(encoding) + { + return eui64_to_str(tvb_get_letoh64(tvb, offset)); + }else { + return eui64_to_str(tvb_get_ntoh64(tvb, offset)); + } +} + static void usb_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len) { |