// Token: 0x060001A5 RID: 421 RVA: 0x00008FA8 File Offset: 0x000071A8
        private ICancelableAsyncResult BeginWrapper(string methodName, CancelableAsyncCallback asyncCallback, object asyncState, bool rundownContextOnFailure, Func <NspiContext, NspiDispatchTask> beginDelegate, Func <NspiContext> contextFactory)
        {
            int contextHandle = 0;
            ICancelableAsyncResult asyncResult = null;

            NspiAsyncDispatch.ConditionalExceptionWrapper(ExTraceGlobals.NspiTracer.IsTraceEnabled(TraceType.DebugTrace), delegate
            {
                bool flag = false;
                FailureAsyncResult <NspiStatus> failureAsyncResult = null;
                try
                {
                    this.CheckShuttingDown();
                    try
                    {
                        using (DisposeGuard disposeGuard = default(DisposeGuard))
                        {
                            NspiContext nspiContext           = contextFactory();
                            contextHandle                     = ((nspiContext != null) ? nspiContext.ContextHandle : 0);
                            NspiDispatchTask nspiDispatchTask = beginDelegate(nspiContext);
                            disposeGuard.Add <NspiDispatchTask>(nspiDispatchTask);
                            asyncResult = nspiDispatchTask.AsyncResult;
                            this.SubmitTask(nspiDispatchTask);
                            disposeGuard.Success();
                        }
                        flag = true;
                    }
                    catch (FailRpcException ex)
                    {
                        failureAsyncResult = new FailureAsyncResult <NspiStatus>((NspiStatus)ex.ErrorCode, new IntPtr(contextHandle), ex, asyncCallback, asyncState);
                        asyncResult        = failureAsyncResult;
                    }
                    catch (NspiException ex2)
                    {
                        failureAsyncResult = new FailureAsyncResult <NspiStatus>(ex2.Status, new IntPtr(contextHandle), ex2, asyncCallback, asyncState);
                        asyncResult        = failureAsyncResult;
                    }
                    if (failureAsyncResult != null && !ThreadPool.QueueUserWorkItem(NspiAsyncDispatch.FailureWaitCallback, failureAsyncResult))
                    {
                        failureAsyncResult.InvokeCallback();
                    }
                    ExTraceGlobals.NspiTracer.TraceDebug <string, int>(0, 0L, "{0} succeeded. ContextHandle={1}", methodName, contextHandle);
                }
                finally
                {
                    if (!flag && rundownContextOnFailure && contextHandle != 0)
                    {
                        this.ContextHandleRundown(new IntPtr(contextHandle));
                    }
                }
            }, delegate(Exception exception)
            {
                ExTraceGlobals.NspiTracer.TraceDebug <string, int, Exception>(0, 0L, "{0} failed. ContextHandle={1}, Exception={2}.", methodName, contextHandle, exception);
            });
            return(asyncResult);
        }
示例#2
0
        internal static bool TryGetContext(int contextHandle, out NspiContext context)
        {
            context = null;
            bool result;

            lock (ClientContextCache.clientContextDictionaryLock)
            {
                result = ClientContextCache.clientContextDictionary.TryGetValue(contextHandle, out context);
            }
            return(result);
        }
示例#3
0
        internal static NspiContext GetContext(int contextHandle)
        {
            NspiContext result = null;

            if (!ClientContextCache.TryGetContext(contextHandle, out result))
            {
                ExTraceGlobals.NspiTracer.TraceError((long)contextHandle, "Unable to find contextHandle in context dictionary");
                throw new InvalidHandleException("Failed to find contextHandle in context dictionary.");
            }
            return(result);
        }
示例#4
0
        internal static NspiContext CreateContext(ClientBinding clientBinding)
        {
            NspiContext result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                ClientSecurityContext clientSecurityContext = null;
                bool   isAnonymous = false;
                string text        = null;
                string userDomain  = null;
                RpcHttpConnectionProperties rpcHttpConnectionProperties = null;
                if (!RpcDispatch.TryGetAuthContextInfo(clientBinding, out clientSecurityContext, out isAnonymous, out text, out userDomain, out rpcHttpConnectionProperties))
                {
                    ExTraceGlobals.NspiTracer.TraceError <Guid>(0L, "Could not resolve anonymous user for session id: {0}", clientBinding.AssociationGuid);
                    throw new NspiException(NspiStatus.LogonFailed, "Could not resolve anonymous user.");
                }
                disposeGuard.Add <ClientSecurityContext>(clientSecurityContext);
                Guid empty = Guid.Empty;
                if (rpcHttpConnectionProperties != null && rpcHttpConnectionProperties.RequestIds.Length > 0)
                {
                    Guid.TryParse(rpcHttpConnectionProperties.RequestIds[rpcHttpConnectionProperties.RequestIds.Length - 1], out empty);
                }
                NspiContext nspiContext = new NspiContext(clientSecurityContext, userDomain, clientBinding.ClientAddress, clientBinding.ServerAddress, clientBinding.ProtocolSequence, empty);
                disposeGuard.Add <NspiContext>(nspiContext);
                nspiContext.IsAnonymous = isAnonymous;
                if (!nspiContext.TryAcquireBudget())
                {
                    ExTraceGlobals.NspiTracer.TraceError((long)nspiContext.ContextHandle, "Could not acquire budget");
                    throw new NspiException(NspiStatus.GeneralFailure, "Failed to acquire budget.");
                }
                bool flag = false;
                lock (ClientContextCache.clientContextDictionaryLock)
                {
                    flag = ClientContextCache.clientContextDictionary.ContainsKey(nspiContext.ContextHandle);
                    if (!flag)
                    {
                        ClientContextCache.clientContextDictionary.Add(nspiContext.ContextHandle, nspiContext);
                        AddressBookPerformanceCountersWrapper.AddressBookPerformanceCounters.NspiConnectionsCurrent.RawValue = (long)ClientContextCache.clientContextDictionary.Count;
                        AddressBookPerformanceCountersWrapper.AddressBookPerformanceCounters.NspiConnectionsTotal.Increment();
                        AddressBookPerformanceCountersWrapper.AddressBookPerformanceCounters.NspiConnectionsRate.Increment();
                    }
                }
                if (flag)
                {
                    ExTraceGlobals.NspiTracer.TraceError((long)nspiContext.ContextHandle, "Duplicate contextHandle found in context dictionary");
                    throw new NspiException(NspiStatus.GeneralFailure, "Duplicate contextHandle found in context dictionary.");
                }
                disposeGuard.Success();
                result = nspiContext;
            }
            return(result);
        }
示例#5
0
 internal RfriContext(ClientSecurityContext clientSecurityContext, string userDomain, string clientAddress, string serverAddress, string protocolSequence, string authenticationService, bool encrypted, bool isAnonymous, Guid requestId = default(Guid))
 {
     this.ContextHandle         = NspiContext.GetNextContextHandle();
     this.disposeTracker        = ((IDisposeTrackable)this).GetDisposeTracker();
     this.clientSecurityContext = clientSecurityContext;
     this.userDomain            = userDomain;
     this.encrypted             = encrypted;
     this.isAnonymous           = isAnonymous;
     this.protocolSequence      = protocolSequence;
     this.protocolLogSession    = ProtocolLog.CreateSession(this.ContextHandle, clientAddress, serverAddress, protocolSequence);
     this.ProtocolLogSession[ProtocolLog.Field.Authentication] = authenticationService;
     if (requestId != Guid.Empty)
     {
         ActivityContextState activityContextState = new ActivityContextState(new Guid?(requestId), new ConcurrentDictionary <Enum, object>());
         ActivityContext.ClearThreadScope();
         this.scope = ActivityContext.Resume(activityContextState, null);
     }
 }
 // Token: 0x0600019D RID: 413 RVA: 0x00008B6C File Offset: 0x00006D6C
 public void ContextHandleRundown(IntPtr contextHandle)
 {
     if (contextHandle == IntPtr.Zero)
     {
         return;
     }
     if (!this.isShuttingDown)
     {
         NspiAsyncDispatch.ExecuteAndIgnore("ContextHandleRundown", delegate
         {
             NspiContext nspiContext = null;
             using (DisposeGuard disposeGuard = default(DisposeGuard))
             {
                 if (ClientContextCache.TryGetContext(contextHandle.ToInt32(), out nspiContext))
                 {
                     disposeGuard.Add <NspiContext>(nspiContext);
                     ClientContextCache.DeleteContext(contextHandle.ToInt32());
                     nspiContext.Unbind(true);
                 }
             }
         });
     }
 }
示例#7
0
 public NspiResolveNamesDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiResolveNamesFlags flags, NspiState state, PropertyTag[] propertyTags, byte[][] names) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags        = flags;
     this.propertyTags = propertyTags;
     this.names        = names;
 }
示例#8
0
 // Token: 0x06000086 RID: 134 RVA: 0x000040D0 File Offset: 0x000022D0
 public NspiDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context) : base(asyncCallback, asyncState)
 {
     this.status = NspiStatus.GeneralFailure;
     this.protocolRequestInfo = protocolRequestInfo;
     this.context             = context;
 }
示例#9
0
 public NspiUnbindDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiUnbindFlags flags) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags = flags;
 }
示例#10
0
 // Token: 0x060000D6 RID: 214 RVA: 0x000051A8 File Offset: 0x000033A8
 public NspiGetPropsDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiGetPropsFlags flags, NspiState state, PropertyTag[] propertyTags) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags        = flags;
     this.propertyTags = propertyTags;
 }
 public NspiResortRestrictionDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiResortRestrictionFlags flags, NspiState state, int[] mids) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags = flags;
     this.mids  = mids;
 }
 // Token: 0x060000A3 RID: 163 RVA: 0x00004818 File Offset: 0x00002A18
 public NspiCompareDNTsDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiCompareDNTsFlags flags, NspiState state, int mid1, int mid2) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags = flags;
     this.mid1  = mid1;
     this.mid2  = mid2;
 }
示例#13
0
 // Token: 0x060000B0 RID: 176 RVA: 0x000049FF File Offset: 0x00002BFF
 public NspiDNToEphDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiDNToEphFlags flags, string[] legacyDNs) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags     = flags;
     this.legacyDNs = legacyDNs;
 }
 // Token: 0x0600010C RID: 268 RVA: 0x00005DA4 File Offset: 0x00003FA4
 public NspiSeekEntriesDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiSeekEntriesFlags flags, NspiState state, PropertyValue?target, int[] restriction, PropertyTag[] propertyTags) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags        = flags;
     this.target       = target;
     this.restriction  = restriction;
     this.propertyTags = propertyTags;
 }
示例#15
0
 // Token: 0x060000EE RID: 238 RVA: 0x000056D5 File Offset: 0x000038D5
 public NspiQueryColumnsDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiQueryColumnsFlags flags, NspiQueryColumnsMapiFlags mapiFlags) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags     = flags;
     this.mapiFlags = mapiFlags;
 }
 public NspiGetNamesFromIDsDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiGetNamesFromIDsFlags flags, Guid?guid, PropertyTag[] propertyTags) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags = flags;
     this.guid  = guid;
 }
示例#17
0
 // Token: 0x060000DC RID: 220 RVA: 0x000052E8 File Offset: 0x000034E8
 public NspiGetTemplateInfoDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiGetTemplateInfoFlags flags, int type, string legacyDN, int codePage, int locale) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags    = flags;
     this.type     = type;
     this.legacyDN = legacyDN;
     this.codePage = codePage;
     this.locale   = locale;
 }
 // Token: 0x060000D0 RID: 208 RVA: 0x00005051 File Offset: 0x00003251
 public NspiGetPropListDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiGetPropListFlags flags, int mid, int codePage) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags    = flags;
     this.mid      = mid;
     this.codePage = codePage;
 }
 public NspiStateDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiState state) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.state = state;
 }
 // Token: 0x06000118 RID: 280 RVA: 0x00006007 File Offset: 0x00004207
 public NspiUpdateStatDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiUpdateStatFlags flags, NspiState state, bool deltaRequested) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags          = flags;
     this.deltaRequested = deltaRequested;
 }
 public NspiGetHierarchyInfoDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiGetHierarchyInfoFlags flags, NspiState state, int version) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags   = flags;
     this.version = version;
 }
示例#22
0
 public NspiGetIDsFromNamesDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiGetIDsFromNamesFlags flags, int mapiFlags, int nameCount, IntPtr names) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags     = flags;
     this.mapiFlags = mapiFlags;
 }
示例#23
0
 public NspiQueryRowsDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiQueryRowsFlags flags, NspiState state, int[] mids, int rowCount, PropertyTag[] propertyTags) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags        = flags;
     this.mids         = mids;
     this.rowCount     = rowCount;
     this.propertyTags = propertyTags;
 }
示例#24
0
 internal ModCache(NspiContext nspiContext, int expiryTimeInSeconds)
 {
     this.nspiContext = nspiContext;
     this.logExpiry   = TimeSpan.FromSeconds((double)expiryTimeInSeconds);
     this.cache       = new Dictionary <ModCache.LogKey, ModCache.Log>();
 }
示例#25
0
 // Token: 0x060000C3 RID: 195 RVA: 0x00004D28 File Offset: 0x00002F28
 public NspiGetMatchesDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiGetMatchesFlags flags, NspiState state, int[] mids, int interfaceOptions, Restriction restriction, IntPtr pPropName, int maxRows, PropertyTag[] propertyTags) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.flags            = flags;
     this.interfaceOptions = interfaceOptions;
     this.restriction      = restriction;
     this.maxRows          = maxRows;
     this.propertyTags     = propertyTags;
     if (this.maxRows < 0 || this.maxRows > 100000)
     {
         this.maxRows = 100000;
     }
 }
 // Token: 0x060000A9 RID: 169 RVA: 0x0000495E File Offset: 0x00002B5E
 public NspiDeleteEntriesDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiDeleteEntriesFlags flags, int mid, byte[][] entryIds) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags = flags;
     this.mid   = mid;
 }
 // Token: 0x0600009C RID: 156 RVA: 0x000045E1 File Offset: 0x000027E1
 public NspiBindDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, ClientBinding clientBinding, NspiContext context, NspiBindFlags flags, NspiState state, Guid?serverGuid) : base(asyncCallback, asyncState, protocolRequestInfo, context, state)
 {
     this.clientBinding = clientBinding;
     this.flags         = flags;
     this.serverGuid    = serverGuid;
 }
 public NspiModLinkAttDispatchTask(CancelableAsyncCallback asyncCallback, object asyncState, ProtocolRequestInfo protocolRequestInfo, NspiContext context, NspiModLinkAttFlags flags, PropertyTag propertyTag, int mid, byte[][] rawEntryIds) : base(asyncCallback, asyncState, protocolRequestInfo, context)
 {
     this.flags       = flags;
     this.propertyTag = propertyTag;
     this.mid         = mid;
     this.rawEntryIds = rawEntryIds;
 }