Witness: start to implement V2
authorGregor Beck <gbeck@sernet.de>
Wed, 28 Aug 2013 09:11:55 +0000 (11:11 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 29 Jan 2014 08:18:29 +0000 (09:18 +0100)
epan/dissectors/packet-dcerpc-witness-cnf.c
epan/dissectors/packet-dcerpc-witness.c
epan/dissectors/packet-dcerpc-witness.h
epan/dissectors/pidl/witness.idl

index f89a410db008f05986788106eb0ea096198f54d4..e8fcf80dcd28d89d08f48159983fe2d7dfce8da7 100644 (file)
@@ -129,14 +129,22 @@ witness_dissect_notifyResponse_message(tvbuff_t *tvb, int offset, packet_info *p
        struct notify_response *resp = notify_response;
 
        switch (resp->type) {
-       case MOVE:
-               msg = "Move";
+       case CLIENT_MOVE:
+               msg = "Client Move";
                dissect = &witness_dissect_move_request;
                break;
-       case CHANGE:
-               msg = "Change";
+       case RESOURCE_CHANGE:
+               msg = "Resource Change";
                dissect = &witness_dissect_resource_change;
                break;
+       case SHARE_MOVE:
+               msg = "Share Move";
+               dissect = &witness_dissect_move_request;
+               break;
+       case IP_CHANGE:
+               msg = "IP Change";
+               dissect = &witness_dissect_move_request;
+               break;
        default:
                DISSECTOR_ASSERT(FALSE);
        }
index 26b092925a7729cd758f3bd7ba368b51bc56b02a..f83534438588bc1833430d6525fd88a3f43459f7 100644 (file)
@@ -84,6 +84,11 @@ static e_uuid_t uuid_dcerpc_witness = {
 };
 static guint16 ver_dcerpc_witness = 1;
 
+const value_string witness_witness_version_vals[] = {
+       { WITNESS_V1, "WITNESS_V1" },
+       { WITNESS_V2, "WITNESS_V2" },
+{ 0, NULL }
+};
 const value_string witness_witness_interfaceInfo_state_vals[] = {
        { UNKNOWN, "UNKNOWN" },
        { AVAILABLE, "AVAILABLE" },
@@ -114,8 +119,10 @@ static int witness_dissect_element_interfaceList_interfaces(tvbuff_t *tvb _U_, i
 static int witness_dissect_element_interfaceList_interfaces_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
 static int witness_dissect_element_interfaceList_interfaces__(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
 const value_string witness_witness_notifyResponse_type_vals[] = {
-       { CHANGE, "CHANGE" },
-       { MOVE, "MOVE" },
+       { RESOURCE_CHANGE, "RESOURCE_CHANGE" },
+       { CLIENT_MOVE, "CLIENT_MOVE" },
+       { SHARE_MOVE, "SHARE_MOVE" },
+       { IP_CHANGE, "IP_CHANGE" },
 { 0, NULL }
 };
 static int witness_dissect_element_notifyResponse_message_type(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
@@ -144,6 +151,26 @@ static int witness_dissect_element_AsyncNotify_response__(tvbuff_t *tvb _U_, int
  #include "packet-dcerpc-witness-cnf.c"
 
 
+/* IDL: enum { */
+/* IDL:        WITNESS_V1=0x00010001, */
+/* IDL:        WITNESS_V2=0x00020000, */
+/* IDL: } */
+
+int
+witness_dissect_enum_version(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_)
+{
+       guint32 parameter=0;
+       if(param){
+               parameter=(guint32)*param;
+       }
+       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_index, &parameter);
+       if(param){
+               *param=(guint32)parameter;
+       }
+       return offset;
+}
+
+
 /* IDL: enum { */
 /* IDL:        UNKNOWN=0x00, */
 /* IDL:        AVAILABLE=0x01, */
@@ -167,7 +194,7 @@ witness_dissect_bitmap_interfaceInfo_flags(tvbuff_t *tvb _U_, int offset _U_, pa
        ALIGN_TO_4_BYTES;
 
        if (parent_tree) {
-               item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
+               item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, TRUE);
                tree = proto_item_add_subtree(item,ett_witness_witness_interfaceInfo_flags);
        }
 
@@ -211,7 +238,7 @@ witness_dissect_bitmap_interfaceInfo_flags(tvbuff_t *tvb _U_, int offset _U_, pa
 
 /* IDL: struct { */
 /* IDL:        [to_null(1)] [charset(UTF16)] uint16 group_name[260]; */
-/* IDL:        uint32 version; */
+/* IDL:        witness_version version; */
 /* IDL:        witness_interfaceInfo_state state; */
 /* IDL:        [flag(LIBNDR_FLAG_BIGENDIAN)] ipv4address ipv4; */
 /* IDL:        [flag(LIBNDR_FLAG_BIGENDIAN)] ipv6address ipv6; */
@@ -221,7 +248,7 @@ witness_dissect_bitmap_interfaceInfo_flags(tvbuff_t *tvb _U_, int offset _U_, pa
 static int
 witness_dissect_element_interfaceInfo_version(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
 {
-       offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_witness_witness_interfaceInfo_version, 0);
+       offset = witness_dissect_enum_version(tvb, offset, pinfo, tree, drep, hf_witness_witness_interfaceInfo_version, 0);
 
        return offset;
 }
@@ -271,7 +298,7 @@ witness_dissect_struct_interfaceInfo(tvbuff_t *tvb _U_, int offset _U_, packet_i
        old_offset = offset;
 
        if (parent_tree) {
-               item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
+               item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE);
                tree = proto_item_add_subtree(item, ett_witness_witness_interfaceInfo);
        }
 
@@ -349,7 +376,7 @@ witness_dissect_struct_interfaceList(tvbuff_t *tvb _U_, int offset _U_, packet_i
        old_offset = offset;
 
        if (parent_tree) {
-               item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
+               item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE);
                tree = proto_item_add_subtree(item, ett_witness_witness_interfaceList);
        }
 
@@ -370,8 +397,10 @@ witness_dissect_struct_interfaceList(tvbuff_t *tvb _U_, int offset _U_, packet_i
 
 
 /* IDL: enum { */
-/* IDL:        CHANGE=1, */
-/* IDL:        MOVE=2, */
+/* IDL:        RESOURCE_CHANGE=1, */
+/* IDL:        CLIENT_MOVE=2, */
+/* IDL:        SHARE_MOVE=3, */
+/* IDL:        IP_CHANGE=4, */
 /* IDL: } */
 
 int
@@ -507,7 +536,7 @@ witness_dissect_element_Register_context_handle_(tvbuff_t *tvb _U_, int offset _
 static int
 witness_dissect_element_Register_version(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
 {
-       offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_witness_witness_Register_version, 0);
+       offset = witness_dissect_enum_version(tvb, offset, pinfo, tree, drep, hf_witness_witness_Register_version, 0);
 
        return offset;
 }
@@ -571,7 +600,7 @@ witness_dissect_element_Register_client_computer_name_(tvbuff_t *tvb _U_, int of
 
 /* IDL: WERROR witness_Register( */
 /* IDL: [out] [ref] policy_handle *context_handle, */
-/* IDL: [in] uint32 version, */
+/* IDL: [in] witness_version version, */
 /* IDL: [unique(1)] [in] [charset(UTF16)] uint16 *net_name, */
 /* IDL: [unique(1)] [in] [charset(UTF16)] uint16 *ip_address, */
 /* IDL: [unique(1)] [in] [charset(UTF16)] uint16 *client_computer_name */
@@ -732,7 +761,7 @@ void proto_register_dcerpc_witness(void)
        { &hf_witness_werror,
          { "Windows Error", "witness.werror", FT_UINT32, BASE_HEX, VALS(WERR_errors), 0, NULL, HFILL }},
        { &hf_witness_witness_Register_version,
-         { "Version", "witness.witness_Register.version", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
+         { "Version", "witness.witness_Register.version", FT_UINT32, BASE_DEC, VALS(witness_witness_version_vals), 0, NULL, HFILL }},
        { &hf_witness_witness_Register_client_computer_name,
          { "Client Computer Name", "witness.witness_Register.client_computer_name", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
        { &hf_witness_witness_interfaceList_num_interfaces,
@@ -748,7 +777,7 @@ void proto_register_dcerpc_witness(void)
        { &hf_witness_opnum,
          { "Operation", "witness.opnum", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
        { &hf_witness_witness_interfaceInfo_version,
-         { "Version", "witness.witness_interfaceInfo.version", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
+         { "Version", "witness.witness_interfaceInfo.version", FT_UINT32, BASE_DEC, VALS(witness_witness_version_vals), 0, NULL, HFILL }},
        { &hf_witness_change_type,
          { "Type", "witness.change.type", FT_UINT32, BASE_HEX, VALS(witness_change_type_vals), 0, NULL, HFILL }},
        { &hf_witness_move_ipaddr_list_flags_ipv4,
index aa83d2cd5299c902b2e49ef511dc3c9c0e2c589c..30465118a50279298c0c440326af8a20dfb964ec 100644 (file)
 #ifndef __PACKET_DCERPC_WITNESS_H
 #define __PACKET_DCERPC_WITNESS_H
 
+#define WITNESS_V1 (0x00010001)
+#define WITNESS_V2 (0x00020000)
+extern const value_string witness_witness_version_vals[];
+int witness_dissect_enum_version(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_);
 #define UNKNOWN (0x00)
 #define AVAILABLE (0x01)
 #define UNAVAILABLE (0xff)
@@ -24,8 +28,10 @@ int witness_dissect_enum_interfaceInfo_state(tvbuff_t *tvb _U_, int offset _U_,
 int witness_dissect_bitmap_interfaceInfo_flags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_);
 int witness_dissect_struct_interfaceInfo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_);
 int witness_dissect_struct_interfaceList(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_);
-#define CHANGE (1)
-#define MOVE (2)
+#define RESOURCE_CHANGE (1)
+#define CLIENT_MOVE (2)
+#define SHARE_MOVE (3)
+#define IP_CHANGE (4)
 extern const value_string witness_witness_notifyResponse_type_vals[];
 int witness_dissect_enum_notifyResponse_type(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_);
 int witness_dissect_struct_notifyResponse(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_);
index 3cb5a4cc0a27da4fa0aaf9e9a344b191309a0195..7b800dfb6759d59973d08311a49dc375d990ac63 100644 (file)
@@ -11,6 +11,11 @@ import "misc.idl";
 ]
 interface witness
 {
+       typedef [v1_enum] enum {
+               WITNESS_V1 = 0x00010001,
+               WITNESS_V2 = 0x00020000
+       } witness_version;
+
        /*****************/
        /* Function 0x00 */
 
@@ -28,7 +33,7 @@ interface witness
 
        typedef struct {
                [charset(UTF16),to_null] uint16 group_name[260];
-               uint32 version;
+               witness_version version;
                witness_interfaceInfo_state state;
                [flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
                [flag(NDR_BIG_ENDIAN)] ipv6address ipv6;
@@ -50,7 +55,7 @@ interface witness
 
        WERROR witness_Register(
                [out,ref] policy_handle *context_handle,
-               [in] uint32 version,
+               [in] witness_version version,
                [in,unique,string,charset(UTF16)] uint16 *net_name,
                [in,unique,string,charset(UTF16)] uint16 *ip_address,
                [in,unique,string,charset(UTF16)] uint16 *client_computer_name
@@ -67,8 +72,10 @@ interface witness
        /* Function 0x03 */
 
        typedef enum {
-               CHANGE = 1,
-               MOVE   = 2
+               RESOURCE_CHANGE = 1,
+               CLIENT_MOVE     = 2,
+               SHARE_MOVE      = 3,
+               IP_CHANGE       = 4
        } witness_notifyResponse_type;
 
        typedef struct {