Note that for THE3GPP_IPV6_DNS_SERVERS we probably *do* need to handle
[obnox/wireshark/wip.git] / packet-dcerpc-mapi.c
index 75e86fe3aed53fdf3106cc622cd20152be8e64b0..dc3d4d519eccabbc0c48b88b15d1665c81385b7a 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for MS Exchange MAPI
  * Copyright 2002, Ronnie Sahlberg
  *
- * $Id: packet-dcerpc-mapi.c,v 1.21 2003/05/10 02:15:04 guy Exp $
+ * $Id: packet-dcerpc-mapi.c,v 1.27 2004/02/25 09:31:05 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -36,6 +36,7 @@
 #include "prefs.h"
 
 static int proto_dcerpc_mapi = -1;
+static int hf_mapi_opnum = -1;
 static int hf_mapi_unknown_string = -1;
 static int hf_mapi_unknown_short = -1;
 static int hf_mapi_unknown_long = -1;
@@ -138,7 +139,7 @@ mapi_decrypt_init(void)
 
 static int
 mapi_decrypt_pdu(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        dcerpc_info *di;
        mapi_decrypted_data_t *mmd=NULL;
@@ -163,11 +164,11 @@ mapi_decrypt_pdu(tvbuff_t *tvb, int offset,
        }
 
        if(!pinfo->fd->flags.visited){
+               ptr=(const unsigned char *)tvb_get_ptr(tvb, offset, len);
                mmd=g_mem_chunk_alloc(mapi_decrypted_data_chunk);
                mmd->callid=di->call_id;
                mmd->frame=pinfo->fd->num;
                mmd->data=g_malloc(len);
-               ptr=(const unsigned char *)tvb_get_ptr(tvb, offset, len);
                for(i=0;i<len;i++){
                        mmd->data[i]=ptr[i]^0xa5;
                }
@@ -235,7 +236,7 @@ mapi_decrypt_pdu(tvbuff_t *tvb, int offset,
 
 static int
 mapi_logon_rqst(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
         offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                        sizeof(guint8), hf_mapi_unknown_string, TRUE, NULL);
@@ -250,10 +251,10 @@ There might be offsets/padding mismatched due to potential pointer expansions
 or padding bytes. Captures where this code breaks will tell us about that */
 static int
 mapi_logon_reply(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
         DISSECT_UNKNOWN(20); /* this is 20 bytes, unless there are pointers */
 
@@ -279,11 +280,11 @@ mapi_logon_reply(tvbuff_t *tvb, int offset,
 }
 
 static int
-mapi_unknown_02_request(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+mapi_ec_do_rpc_request(tvbuff_t *tvb, int offset,
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
        if(!mapi_decrypt){
                /* this is a unidimensional varying and conformant array of
@@ -305,11 +306,11 @@ mapi_unknown_02_request(tvbuff_t *tvb, int offset,
        return offset;
 }
 static int
-mapi_unknown_02_reply(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+mapi_ec_do_rpc_reply(tvbuff_t *tvb, int offset,
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
        if(!mapi_decrypt){
                /* this is a unidimensional varying and conformant array of
@@ -333,20 +334,20 @@ mapi_unknown_02_reply(tvbuff_t *tvb, int offset,
 
 static int
 mapi_logoff_rqst(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
        return offset;
 }
 
 static int
 mapi_logoff_reply(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
        offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
                        hf_mapi_rc, NULL);
@@ -356,16 +357,24 @@ mapi_logoff_reply(tvbuff_t *tvb, int offset,
 
 
 static dcerpc_sub_dissector dcerpc_mapi_dissectors[] = {
-        { MAPI_LOGON,          "Logon",
+        { MAPI_EC_DO_CONNECT,  "EcDoConnect",
                mapi_logon_rqst,
                mapi_logon_reply },
-        { MAPI_LOGOFF,         "Logoff",
+        { MAPI_EC_DO_DISCONNECT,"EcDoDisconnect",
                mapi_logoff_rqst,
                mapi_logoff_reply },
-        { MAPI_UNKNOWN_02,     "unknown_02",
-               mapi_unknown_02_request,
-               mapi_unknown_02_reply },
-
+        { MAPI_EC_DO_RPC,      "EcDoRpc",
+               mapi_ec_do_rpc_request,
+               mapi_ec_do_rpc_reply },
+       { MAPI_EC_GET_MORE_RPC, "EcGetMoreRpc", NULL, NULL },
+       { MAPI_EC_REGISTER_PUSH_NOTIFICATION, "EcRRegisterPushNotification",
+               NULL, NULL },
+       { MAPI_EC_UNREGISTER_PUSH_NOTIFICATION, "EcRUnregisterPushNotification",
+               NULL, NULL },
+       { MAPI_EC_DUMMY_RPC, "EcDummyRpc", NULL, NULL },
+       { MAPI_EC_GET_DC_NAME, "EcRGetDCName", NULL, NULL },
+       { MAPI_EC_NET_GET_DC_NAME, "EcRNetGetDCName", NULL, NULL },
+       { MAPI_EC_DO_RPC_EXT, "EcDoRpcExt", NULL, NULL },
         {0, NULL, NULL,  NULL }
 };
 
@@ -374,6 +383,10 @@ proto_register_dcerpc_mapi(void)
 {
 
 static hf_register_info hf[] = {
+       { &hf_mapi_opnum,
+               { "Operation", "mapi.opnum", FT_UINT16, BASE_DEC,
+                 NULL, 0x0, "", HFILL }},
+
        { &hf_mapi_hnd,
                { "Context Handle", "mapi.hnd", FT_BYTES, BASE_NONE,
                NULL, 0x0, "", HFILL }},
@@ -459,5 +472,5 @@ proto_reg_handoff_dcerpc_mapi(void)
 
         dcerpc_init_uuid(proto_dcerpc_mapi, ett_dcerpc_mapi,
                          &uuid_dcerpc_mapi, ver_dcerpc_mapi,
-                         dcerpc_mapi_dissectors, -1);
+                         dcerpc_mapi_dissectors, hf_mapi_opnum);
 }