/// <summary> /// Bind to DRSR RPC server. /// </summary> /// <param name="protocolSequence"> /// RPC protocol sequence. /// </param> /// <param name="networkAddress"> /// RPC network address. /// </param> /// <param name="endpoint"> /// RPC endpoint. /// </param> /// <param name="securityContext"> /// RPC security provider. /// </param> /// <param name="authenticationLevel"> /// RPC authentication level. /// </param> /// <param name="timeout"> /// Timeout /// </param> public void Bind( string protocolSequence, string networkAddress, string endpoint, ClientSecurityContext securityContext, RpceAuthenticationLevel authenticationLevel, TimeSpan timeout) { if (rpceClientTransport != null) { throw new InvalidOperationException("DRSR has already been bind."); } rpceTimeout = timeout; rpceClientTransport = new RpceClientTransport(); rpceClientTransport.Bind( protocolSequence, networkAddress, endpoint, null, DrsrUtility.DSAOP_RPC_INTERFACE_UUID, DrsrUtility.DSAOP_RPC_INTERFACE_MAJOR_VERSION, DrsrUtility.DSAOP_RPC_INTERFACE_MINOR_VERSION, securityContext, authenticationLevel, false, rpceTimeout); }
private RpceInt3264Collection RpceCall(Int3264[] paramList, ushort opnum) { byte[] requestStub; byte[] responseStub; RpceInt3264Collection outParamList = null; requestStub = RpceStubEncoder.ToBytes( RpceStubHelper.GetPlatform(), SrvsStubFormatString.TypeFormatString, null, SrvsStubFormatString.ProcFormatString, SrvsStubFormatString.ProcFormatStringOffsetTable[opnum], true, paramList); RpceClientTransport.Call(opnum, requestStub, RpceTimeout, out responseStub); outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), SrvsStubFormatString.TypeFormatString, null, SrvsStubFormatString.ProcFormatString, SrvsStubFormatString.ProcFormatStringOffsetTable[opnum], true, responseStub, paramList); return(outParamList); }
private void InnerBind( string protocolSequence, string networkAddress, string endpoint, AccountCredential transportCredential, ClientSecurityContext securityContext) { if (RpceClientTransport != null) { throw new InvalidOperationException("SRVS has already been bind"); } RpceClientTransport = new RpceClientTransport(); try { RpceClientTransport.Bind( protocolSequence, networkAddress, endpoint, transportCredential, SrvsUtility.SRVS_INTERFACE_UUID, SrvsUtility.SRVS_INTERFACE_MAJOR_VERSION, SrvsUtility.SRVS_INTERFACE_MINOR_VERSION, securityContext, AuthenticationLevel, true, RpceTimeout); } catch { RpceClientTransport = null; throw; } }
/// <summary> /// RPC unbind. /// </summary> public void Unbind() { if (rpceClientTransport != null) { rpceClientTransport.Unbind(rpceTimeout); rpceClientTransport = null; } }
/// <summary> /// RPCE unbind and disconnect. /// </summary> /// <param name="timeout"> /// Timeout period. /// </param> /// <exception cref="InvalidOperationException"> /// Thrown when RPC has not been bind. /// </exception> public void SwnUnbind(TimeSpan timeout) { if (rpceClientTransport != null) { rpceClientTransport.Unbind(timeout); rpceClientTransport.Dispose(); rpceClientTransport = null; } }
/// <summary> /// Unbind and release the handle. /// </summary> public void UnBind() { if (RpceClientTransport != null) { RpceClientTransport.Unbind(RpceTimeout); RpceClientTransport.Dispose(); RpceClientTransport = null; } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (RpceClientTransport != null) { RpceClientTransport.Dispose(); RpceClientTransport = null; } } }
/// <summary> /// Dispose method. /// </summary> /// <param name="disposing"> /// True to release both managed and unmanaged resources.<para/> /// False to release unmanaged resources only. /// </param> protected virtual void Dispose(bool disposing) { if (disposing) { // Release managed resources. if (rpceClientTransport != null) { rpceClientTransport.Dispose(); rpceClientTransport = null; } } }
/// <summary> /// RPCE unbind and disconnect. /// </summary> /// <param name="timeout">Timeout period.</param> /// <exception cref="InvalidOperationException"> /// Thrown when RPC has not been bind. /// </exception> public void Unbind(TimeSpan timeout) { if (rpceClientTransport != null) { try { rpceClientTransport.Unbind(timeout); rpceClientTransport.Dispose(); } catch { } finally { rpceClientTransport = null; } } }
/// <summary> /// RPC bind to interface, using specified endpoint and authenticate provider. /// </summary> /// <param name="protocolSequence"> /// RPC protocol sequence. /// </param> /// <param name="networkAddress"> /// RPC network address. /// </param> /// <param name="endpoint"> /// RPC endpoint. /// </param> /// <param name="transportCred"> /// Credential to bind SWN server /// </param> /// <param name="secContext"> /// RPC security provider. /// </param> /// <param name="authLevel"> /// RPC authentication level. /// </param> /// <param name="timeout"> /// Timeout /// </param> /// <exception cref="InvalidOperationException"> /// Thrown when there's existing connection. /// </exception> private bool RpcBind( string protocolSequence, string networkAddress, string endpoint, AccountCredential transportCred, ClientSecurityContext secContext, RpceAuthenticationLevel authLevel, TimeSpan timeout) { if (rpceClientTransport != null) { throw new InvalidOperationException("Connection has been established"); } rpceTimeout = timeout; rpceClientTransport = new RpceClientTransport(); try { rpceClientTransport.Bind( protocolSequence, networkAddress, endpoint, transportCred, SwnUtility.SWN_INTERFACE_UUID, SwnUtility.SWN_INTERFACE_MAJOR_VERSION, SwnUtility.SWN_INTERFACE_MINOR_VERSION, secContext, authLevel, true, rpceTimeout); } catch (Exception) { rpceClientTransport.Dispose(); rpceClientTransport = null; throw; } return(true); }
/// <summary> /// RPC bind to interface, using specified endpoint and authenticate provider. /// </summary> /// <param name="protocolSequence">RPC protocol sequence.</param> /// <param name="networkAddress">RPC network address.</param> /// <param name="endpoint">RPC endpoint.</param> /// <param name="transportCredential"> /// If connect by SMB/SMB2, it's the security credential /// used by underlayer transport (SMB/SMB2). /// If connect by TCP, this parameter is ignored. /// </param> /// <param name="securityContext">RPC security provider.</param> /// <param name="authenticationLevel">RPC authentication level.</param> /// <param name="timeout">Timeout for bind and all future requests.</param> /// <exception cref="InvalidOperationException"> /// Thrown when rpceClientTransport is not null. /// </exception> public void Bind( string protocolSequence, string networkAddress, string endpoint, AccountCredential transportCredential, ClientSecurityContext securityContext, RpceAuthenticationLevel authenticationLevel, TimeSpan timeout) { if (rpceClientTransport != null) { throw new InvalidOperationException("FSRVP has already been bind."); } rpceTimeout = timeout; rpceClientTransport = new RpceClientTransport(); try { rpceClientTransport.Bind( protocolSequence, networkAddress, endpoint, transportCredential, FsrvpUtility.FSRVP_INTERFACE_UUID, FsrvpUtility.FSRVP_INTERFACE_MAJOR_VERSION, FsrvpUtility.FSRVP_INTERFACE_MINOR_VERSION, securityContext, authenticationLevel, true, rpceTimeout); } catch { rpceClientTransport = null; throw; } }