Пример #1
0
        /// <summary>
        /// A method used to compose ROP command to execute ROP call.
        /// </summary>
        /// <param name="ropType">A parameter represents the ROP Type refers to a specific ROP call.</param>
        /// <param name="inputServerObjectHandle">A parameter represents an input Server object handle.</param>
        /// <param name="propertyValue">A parameter represents a TaggedPropertyValue structure.</param>
        /// <returns>A return value represents a byte array of serialized ROP command.</returns>
        public static byte[] ComposeRgbIn(ROPCommandType ropType, uint inputServerObjectHandle, TaggedPropertyValue propertyValue)
        {
            ComposeROPCommand composeROPCommand = new ComposeROPCommand();

            switch (ropType)
            {
            case ROPCommandType.RopSynchronizationImportDeletes:
                return(composeROPCommand.ComposeRopSynchronizationImportDeletes(inputServerObjectHandle, propertyValue));

            default:
                throw new InvalidCastException("Invalid ROP command type");
            }
        }
Пример #2
0
        /// <summary>
        /// A method used to compose ROP command to execute ROP call.
        /// </summary>
        /// <param name="ropType">A parameter represents the ROP Type refers to a specific ROP call.</param>
        /// <param name="inputServerObjectHandle">A parameter represents an input Server object handle.</param>
        /// <param name="propertyValue">A parameter represents a TaggedPropertyValue structure.</param>
        /// <returns>A return value represents a byte array of serialized ROP command.</returns>
        public static byte[] ComposeRgbIn(ROPCommandType ropType, uint inputServerObjectHandle, TaggedPropertyValue propertyValue)
        {
            ComposeROPCommand composeROPCommand = new ComposeROPCommand();

            switch (ropType)
            {
                case ROPCommandType.RopSynchronizationImportDeletes:
                    return composeROPCommand.ComposeRopSynchronizationImportDeletes(inputServerObjectHandle, propertyValue);

                default:
                    throw new InvalidCastException("Invalid ROP command type");
            }
        }
Пример #3
0
        /// <summary>
        /// A method used to compose ROP command to execute ROP call.
        /// </summary>
        /// <param name="ropType">A parameter represents the ROP Type refers to a specific ROP call.</param>
        /// <param name="inputServerObjectHandle">A parameter represents an input Server object handle.</param>
        /// <param name="auxInfo">The auxInfo point to the object executed by this ROP call.
        /// It could be a folder handle, a message handle or an attachment handle or the count to be operated.</param>
        /// <returns>A return value represents a byte array of serialized ROP command.</returns>
        public static byte[] ComposeRgbIn(ROPCommandType ropType, uint inputServerObjectHandle, ulong auxInfo)
        {
            ComposeROPCommand composeROPCommand = new ComposeROPCommand();

            // UserDN used for logon request.
            string userDN = null;

            switch (ropType)
            {
            case ROPCommandType.RopLogon:
                userDN = Common.GetConfigurationPropertyValue("AdminUserEssdn", site) + "\0";
                return(composeROPCommand.ComposeLogonRequest(userDN, (uint)auxInfo));

            case ROPCommandType.RopLogonNormalUser:
                userDN = Common.GetConfigurationPropertyValue("NormalUserEssdn", site) + "\0";
                return(composeROPCommand.ComposeLogonRequest(userDN, (uint)auxInfo));

            case ROPCommandType.RopCreateMessage:
                return(composeROPCommand.ComposeCreateMessageRequest(inputServerObjectHandle, auxInfo));

            case ROPCommandType.RopOpenStream:
                return(composeROPCommand.ComposeOpenStreamRequest(inputServerObjectHandle, auxInfo));

            case ROPCommandType.RopReadStream:
                return(composeROPCommand.ComposeReadStreamRequest(inputServerObjectHandle, (uint)auxInfo));

            case ROPCommandType.RopCommitStream:
                return(composeROPCommand.ComposeCommitStreamRequest(inputServerObjectHandle));

            case ROPCommandType.RopWriteStream:
                return(composeROPCommand.ComposeWriteStreamRequest(inputServerObjectHandle));

            case ROPCommandType.RopWriteStreamExtended:
                return(composeROPCommand.ComposeWriteStreamExtendedRequest(inputServerObjectHandle));

            case ROPCommandType.RopOpenFolder:
                return(composeROPCommand.ComposeOpenFolderRequest(inputServerObjectHandle, auxInfo));

            case ROPCommandType.RopGetHierarchyTable:
                return(composeROPCommand.ComposeGetHierarchyTableRequest(inputServerObjectHandle));

            case ROPCommandType.RopSaveChangesMessage:
                return(composeROPCommand.ComposeSaveChangesMessageRequest(inputServerObjectHandle));

            case ROPCommandType.RopQueryRows:
                return(composeROPCommand.ComposeQueryRowsRequest(inputServerObjectHandle, (ushort)auxInfo));

            case ROPCommandType.RopFastTransferSourceCopyMessages:
                return(composeROPCommand.ComposeFastTransferSourceCopyMessagesRequest(inputServerObjectHandle, auxInfo));

            case ROPCommandType.RopFastTransferSourceGetBuffer:
                return(composeROPCommand.ComposeRopFastTransferSourceGetBufferRequest(inputServerObjectHandle, (ushort)auxInfo));

            case ROPCommandType.RopSetColumns:
                return(composeROPCommand.ComposeSetColumnsRequest(inputServerObjectHandle));

            case ROPCommandType.RopRegisterNotification:
                return(composeROPCommand.ComposeRegisterNotifyEvents(inputServerObjectHandle, auxInfo));

            case ROPCommandType.WithoutRops:
                return(composeROPCommand.BuildRequestBuffer());

            case ROPCommandType.MultipleRops:
                return(composeROPCommand.ComposeMultipleRops(inputServerObjectHandle));

            case ROPCommandType.RopGetContentsTable:
                return(composeROPCommand.ComposeGetContentsTableRequest(inputServerObjectHandle, (byte)auxInfo));

            case ROPCommandType.RopLongTermIdFromId:
                return(composeROPCommand.ComposeRopLongTermIdFromId(inputServerObjectHandle, auxInfo));

            case ROPCommandType.RopSynchronizationOpenCollector:
                return(composeROPCommand.ComposeRopSynchronizationOpenCollector(inputServerObjectHandle));

            case ROPCommandType.RopSynchronizationImportMessageChange:
                return(composeROPCommand.ComposeRopSynchronizationImportMessageChange(inputServerObjectHandle, (byte)auxInfo));

            case ROPCommandType.RopCreateFolder:
                return(composeROPCommand.ComposeCreateFolderRequest(inputServerObjectHandle, site));

            case ROPCommandType.RopDeleteFolder:
                return(composeROPCommand.ComposeDeleteFolderRequest(inputServerObjectHandle, auxInfo));

            case ROPCommandType.RopRelease:
                return(composeROPCommand.ComposeRopReleaseRequest(inputServerObjectHandle));

            case ROPCommandType.RopHardDeleteMessagesAndSubfolders:
                return(composeROPCommand.ComposeRopHardDeleteMessagesAndSubfolders(inputServerObjectHandle));

            case ROPCommandType.RopFastTransferDestinationConfigure:
                return(composeROPCommand.ComposeRopFastTransferDestinationConfigure(inputServerObjectHandle));

            case ROPCommandType.RopFastTransferDestinationPutBuffer:
                return(composeROPCommand.ComposeRopFastTransferDestinationPutBufferRequest(inputServerObjectHandle));

            case ROPCommandType.RopFastTransferDestinationPutBufferExtended:
                return(composeROPCommand.ComposeRopFastTransferDestinationPutBufferExtendedRequest(inputServerObjectHandle));

            default:
                throw new InvalidCastException("Invalid ROP command type");
            }
        }
Пример #4
0
 /// <summary>
 /// A method used to compose ROP command to execute ROP call.
 /// </summary>
 /// <param name="ropType">A parameter represents the ROP Type refers to a specific ROP call.</param>
 /// <param name="inputServerObjectHandle">A parameter represents an input Server object handle.</param>
 /// <param name="auxInfo">The auxInfo point to the object executed by this ROP call. 
 /// It could be a folder handle, a message handle or an attachment handle or the count to be operated.</param>
 /// <returns>A return value represents a byte array of serialized ROP command.</returns>
 public static byte[] ComposeRgbIn(ROPCommandType ropType, uint inputServerObjectHandle, ulong auxInfo)
 {
     ComposeROPCommand composeROPCommand = new ComposeROPCommand();
     
     // UserDN used for logon request.
     string userDN = null;
     
     switch (ropType)
     {
         case ROPCommandType.RopLogon:
             userDN = Common.GetConfigurationPropertyValue("AdminUserEssdn", site) + "\0";
             return composeROPCommand.ComposeLogonRequest(userDN, (uint)auxInfo);
         case ROPCommandType.RopLogonNormalUser:
             userDN = Common.GetConfigurationPropertyValue("NormalUserEssdn", site) + "\0";
             return composeROPCommand.ComposeLogonRequest(userDN, (uint)auxInfo);
         case ROPCommandType.RopCreateMessage:
             return composeROPCommand.ComposeCreateMessageRequest(inputServerObjectHandle, auxInfo);
         case ROPCommandType.RopOpenStream:
             return composeROPCommand.ComposeOpenStreamRequest(inputServerObjectHandle, auxInfo);
         case ROPCommandType.RopReadStream:
             return composeROPCommand.ComposeReadStreamRequest(inputServerObjectHandle, (uint)auxInfo);
         case ROPCommandType.RopCommitStream:
             return composeROPCommand.ComposeCommitStreamRequest(inputServerObjectHandle);
         case ROPCommandType.RopWriteStream:
             return composeROPCommand.ComposeWriteStreamRequest(inputServerObjectHandle);
         case ROPCommandType.RopOpenFolder:
             return composeROPCommand.ComposeOpenFolderRequest(inputServerObjectHandle, auxInfo);
         case ROPCommandType.RopGetHierarchyTable:
             return composeROPCommand.ComposeGetHierarchyTableRequest(inputServerObjectHandle);
         case ROPCommandType.RopSaveChangesMessage:
             return composeROPCommand.ComposeSaveChangesMessageRequest(inputServerObjectHandle);
         case ROPCommandType.RopQueryRows:
             return composeROPCommand.ComposeQueryRowsRequest(inputServerObjectHandle, (ushort)auxInfo);
         case ROPCommandType.RopFastTransferSourceCopyMessages:
             return composeROPCommand.ComposeFastTransferSourceCopyMessagesRequest(inputServerObjectHandle, auxInfo);
         case ROPCommandType.RopFastTransferSourceGetBuffer:
             return composeROPCommand.ComposeRopFastTransferSourceGetBufferRequest(inputServerObjectHandle, (ushort)auxInfo);
         case ROPCommandType.RopSetColumns:
             return composeROPCommand.ComposeSetColumnsRequest(inputServerObjectHandle);
         case ROPCommandType.RopRegisterNotification:
             return composeROPCommand.ComposeRegisterNotifyEvents(inputServerObjectHandle, auxInfo);
         case ROPCommandType.WithoutRops:
             return composeROPCommand.BuildRequestBuffer();
         case ROPCommandType.MultipleRops:
             return composeROPCommand.ComposeMultipleRops(inputServerObjectHandle);
         case ROPCommandType.RopGetContentsTable:
             return composeROPCommand.ComposeGetContentsTableRequest(inputServerObjectHandle, (byte)auxInfo);
         case ROPCommandType.RopLongTermIdFromId:
             return composeROPCommand.ComposeRopLongTermIdFromId(inputServerObjectHandle, auxInfo);
         case ROPCommandType.RopSynchronizationOpenCollector:
             return composeROPCommand.ComposeRopSynchronizationOpenCollector(inputServerObjectHandle);
         case ROPCommandType.RopSynchronizationImportMessageChange:
             return composeROPCommand.ComposeRopSynchronizationImportMessageChange(inputServerObjectHandle, (byte)auxInfo);
         case ROPCommandType.RopCreateFolder:
             return composeROPCommand.ComposeCreateFolderRequest(inputServerObjectHandle, site);
         case ROPCommandType.RopDeleteFolder:
             return composeROPCommand.ComposeDeleteFolderRequest(inputServerObjectHandle, auxInfo);
         case ROPCommandType.RopRelease:
             return composeROPCommand.ComposeRopReleaseRequest(inputServerObjectHandle);
         case ROPCommandType.RopHardDeleteMessagesAndSubfolders:
             return composeROPCommand.ComposeRopHardDeleteMessagesAndSubfolders(inputServerObjectHandle);
         default:
             throw new InvalidCastException("Invalid ROP command type");
     }
 }
        /// <summary>
        /// Send ROP request with single operation with expected SuccessResponse.
        /// </summary>
        /// <param name="ropRequest">ROP request objects.</param>
        /// <param name="inputObjHandle">Server object handle in request.</param>
        /// <param name="commandType">ROP commands type</param>
        /// <param name="outputBuffer">ROP response buffer</param>
        /// <param name="mailBoxUser">Mailbox which to logon to</param>
        public void DoRopCall(ISerializable ropRequest, uint inputObjHandle, ROPCommandType commandType, out RopOutputBuffer outputBuffer, string mailBoxUser = null)
        {
            outputBuffer = new RopOutputBuffer();
            List <ISerializable> inputBuffer = new List <ISerializable>
            {
                ropRequest
            };
            List <uint> requestSOH = new List <uint>();

            requestSOH.Add(inputObjHandle);

            if (ropRequest != null && Common.IsOutputHandleInRopRequest(ropRequest))
            {
                // Add an element for server output object handle, set default value to 0xFFFFFFFF
                requestSOH.Add(0xFFFFFFFF);
            }

            List <IDeserializable> responses        = new List <IDeserializable>();
            List <List <uint> >    responseSOHTable = new List <List <uint> >();

            byte[] rawData = null;
            uint   ret     = this.oxcropsClient.RopCall(inputBuffer, requestSOH, ref responses, ref responseSOHTable, ref rawData, 0x10008, mailBoxUser);

            if (ret != 0)
            {
                Site.Assert.Fail("Calling RopCall should return 0 for success, but it returns value: {0}", ret);
            }

            this.VerifyRPC();
            this.VerifyTransport();
            outputBuffer.RopsList = responses;
            outputBuffer.ServerObjectHandleTable = responseSOHTable[0];

            IDeserializable response = null;

            if (commandType != ROPCommandType.Others)
            {
                response = responses[0x0];
            }

            switch (commandType)
            {
            case ROPCommandType.RopLogonPrivateMailbox:
                this.VerifyRopLogonForPrivateMailbox((RopLogonRequest)ropRequest, (RopLogonResponse)response);
                break;

            case ROPCommandType.RopLogonPublicFolder:
                this.VerifyRopLogonForPublicFolder((RopLogonRequest)ropRequest, (RopLogonResponse)response);
                break;

            case ROPCommandType.RopGetOwningServers:
                this.VerifyRopGetOwningServers((RopGetOwningServersResponse)response);
                break;

            case ROPCommandType.RopGetPerUserLongTermIds:
                this.VerifyRopGetPerUserLongTermIds((RopGetPerUserLongTermIdsResponse)response);
                break;

            case ROPCommandType.RopGetPerUserGuid:
                this.VerifyRopGetPerUserGuid((RopGetPerUserGuidResponse)response);
                break;

            case ROPCommandType.RopSetReceiveFolder:
                this.VerifyRopSetReceiveFolder((RopSetReceiveFolderResponse)response);
                break;

            case ROPCommandType.RopGetReceiveFolder:
                this.VerifyRopGetReceiveFolder((RopGetReceiveFolderResponse)response);
                break;

            case ROPCommandType.RopGetReceiveFolderTable:
                this.VerifyRopGetReceiveFolderTable((RopGetReceiveFolderTableResponse)response);
                break;

            case ROPCommandType.RopPublicFolderIsGhosted:
                this.VerifyRopPublicFolderIsGhosted((RopPublicFolderIsGhostedResponse)response);
                break;

            case ROPCommandType.RopLongTermIdFromId:
                this.VerifyRopLongTermIdFromId((RopLongTermIdFromIdRequest)ropRequest, (RopLongTermIdFromIdResponse)response);
                break;

            case ROPCommandType.RopIdFromLongTermId:
                this.VerifyRopIdFromLongTermId((RopIdFromLongTermIdRequest)ropRequest, (RopIdFromLongTermIdResponse)response);
                break;

            case ROPCommandType.RopReadPerUserInformation:
                this.VerifyRopReadPerUserInformation((RopReadPerUserInformationResponse)response);
                break;

            case ROPCommandType.RopWritePerUserInformation:
                this.VerifyRopWritePerUserInformation((RopWritePerUserInformationResponse)response);
                break;

            case ROPCommandType.Others:
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// Send ROP request with single operation with expected SuccessResponse.
        /// </summary>
        /// <param name="ropRequest">ROP request objects.</param>
        /// <param name="inputObjHandle">Server object handle in request.</param>
        /// <param name="commandType">ROP commands type</param>
        /// <param name="outputBuffer">ROP response buffer</param>
        /// <param name="mailBoxUser">Mailbox which to logon to</param>
        public void DoRopCall(ISerializable ropRequest, uint inputObjHandle, ROPCommandType commandType, out RopOutputBuffer outputBuffer, string mailBoxUser = null)
        {
            outputBuffer = new RopOutputBuffer();
            List<ISerializable> inputBuffer = new List<ISerializable>
            {
                ropRequest
            };
            List<uint> requestSOH = new List<uint>();
            requestSOH.Add(inputObjHandle);

            if (ropRequest != null && Common.IsOutputHandleInRopRequest(ropRequest))
            {
                // Add an element for server output object handle, set default value to 0xFFFFFFFF
                requestSOH.Add(0xFFFFFFFF);
            }

            List<IDeserializable> responses = new List<IDeserializable>();
            List<List<uint>> responseSOHTable = new List<List<uint>>();
            byte[] rawData = null;
            uint ret = this.oxcropsClient.RopCall(inputBuffer, requestSOH, ref responses, ref responseSOHTable, ref rawData, 0x10008, mailBoxUser);
            if (ret != 0)
            {
                Site.Assert.Fail("Calling RopCall should return 0 for success, but it returns value: {0}", ret);
            }

            this.VerifyRPC();
            this.VerifyTransport();
            outputBuffer.RopsList = responses;
            outputBuffer.ServerObjectHandleTable = responseSOHTable[0];

            IDeserializable response = null;
            if (commandType != ROPCommandType.Others)
            {
                response = responses[0x0];
            }

            switch (commandType)
            {
                case ROPCommandType.RopLogonPrivateMailbox:
                    this.VerifyRopLogonForPrivateMailbox((RopLogonRequest)ropRequest, (RopLogonResponse)response);
                    break;
                case ROPCommandType.RopLogonPublicFolder:
                    this.VerifyRopLogonForPublicFolder((RopLogonRequest)ropRequest, (RopLogonResponse)response);
                    break;
                case ROPCommandType.RopGetOwningServers:
                    this.VerifyRopGetOwningServers((RopGetOwningServersResponse)response);
                    break;
                case ROPCommandType.RopGetPerUserLongTermIds:
                    this.VerifyRopGetPerUserLongTermIds((RopGetPerUserLongTermIdsResponse)response);
                    break;
                case ROPCommandType.RopGetPerUserGuid:
                    this.VerifyRopGetPerUserGuid((RopGetPerUserGuidResponse)response);
                    break;
                case ROPCommandType.RopSetReceiveFolder:
                    this.VerifyRopSetReceiveFolder((RopSetReceiveFolderResponse)response);
                    break;
                case ROPCommandType.RopGetReceiveFolder:
                    this.VerifyRopGetReceiveFolder((RopGetReceiveFolderResponse)response);
                    break;
                case ROPCommandType.RopGetReceiveFolderTable:
                        this.VerifyRopGetReceiveFolderTable((RopGetReceiveFolderTableResponse)response);
                    break;
                case ROPCommandType.RopPublicFolderIsGhosted:
                    this.VerifyRopPublicFolderIsGhosted((RopPublicFolderIsGhostedResponse)response);
                    break;
                case ROPCommandType.RopLongTermIdFromId:
                    this.VerifyRopLongTermIdFromId((RopLongTermIdFromIdRequest)ropRequest, (RopLongTermIdFromIdResponse)response);
                    break;
                case ROPCommandType.RopIdFromLongTermId:
                    this.VerifyRopIdFromLongTermId((RopIdFromLongTermIdRequest)ropRequest, (RopIdFromLongTermIdResponse)response);
                    break;
                case ROPCommandType.RopReadPerUserInformation:
                    this.VerifyRopReadPerUserInformation((RopReadPerUserInformationResponse)response);
                    break;
                case ROPCommandType.RopWritePerUserInformation:
                    this.VerifyRopWritePerUserInformation((RopWritePerUserInformationResponse)response);
                    break;
                case ROPCommandType.Others:
                    break;
                default:
                    break;
            }
        }