Witness: PIDL_dissect_ipv6address()
authorGregor Beck <gbeck@sernet.de>
Mon, 29 Jul 2013 07:51:46 +0000 (09:51 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 29 Jan 2014 08:18:28 +0000 (09:18 +0100)
epan/dissectors/packet-dcerpc-witness-cnf.c
epan/dissectors/pidl/witness.cnf

index 6242f1233ed67195e88868bd54f0e6371619f840..6c9441f46101d47ae773c3343fe38ea319f50eed 100644 (file)
@@ -294,6 +294,36 @@ PIDL_dissect_ipv4address(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
        return offset + 4;
 }
 
+static int
+PIDL_dissect_ipv6address(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep _U_, int hfindex, guint32 param)
+{
+//     tvb_get_ipv6(tvb, offset, &addr);
+       dcerpc_info *di = pinfo->private_data;
+       if (di->conformant_run) {
+               /* just a run to handle conformant arrays, no scalars to dissect */
+               return offset;
+       }
+
+
+       if (!di->no_align && (offset % 2)) {
+               offset += 2 - (offset % 2);
+       }
+
+       proto_tree_add_item(tree, hfindex, tvb, offset, 16, ENC_BIG_ENDIAN);
+
+       if (param & PIDL_SET_COL_INFO) {
+               const char *ip = tvb_ip6_to_str(tvb, offset);
+               header_field_info *hf_info = proto_registrar_get_nth(hfindex);
+
+               proto_item_append_text(proto_tree_get_parent(tree), " %s:%s", hf_info->name, ip);
+
+               col_append_fstr(pinfo->cinfo, COL_INFO," %s:%s", hf_info->name, ip);
+       }
+
+       return offset + 16;
+}
+
+
 int
 witness_dissect_enum_interfaceInfo_state(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index, guint32* param _U_)
 {
index bb022b66ae96e6894a9150db582abab3bf3babeb..a88663c3f280a14b553f7a8653de97b50d4841ed 100644 (file)
@@ -8,7 +8,8 @@ TYPE ipv4address "offset=PIDL_dissect_ipv4address(tvb, offset, pinfo, tree, drep
 
 #PARAM_VALUE witness_dissect_element_interfaceInfo_state PIDL_SET_COL_INFO
 
-TYPE ipv6address "offset += 16;" FT_BYTES BASE_NONE 0 NULL 2
+TYPE ipv6address "offset=PIDL_dissect_ipv6address(tvb, offset, pinfo, tree, drep, @HF@, PIDL_SET_COL_INFO);" FT_IPv6 BASE_NONE 0 NULL 2
+
 HF_RENAME hf_witness_witness_interfaceInfo_group_name hf_dummy
 HF_FIELD hf_witness_witness_interfaceInfo_group_name "Group Name" "witness.witness_interfaceInfo.group_name" FT_STRING BASE_NONE NULL 0 "" "" ""