/// <summary> /// Release resources. /// </summary> /// <param name = "disposing"> /// If disposing equals true, Managed and unmanaged resources are disposed. if false, Only unmanaged resources /// can be disposed. /// </param> protected virtual void Dispose(bool disposing) { if (!this.disposed) { // If disposing equals true, dispose all managed and unmanaged resources. if (disposing) { // Free managed resources & other reference types: if (this.transportStack != null) { this.transportStack.Dispose(); this.transportStack = null; } if (this.contextManager != null) { this.contextManager.Dispose(); this.contextManager = null; } this.encoderv2 = null; this.encoderv3 = null; this.decoder = null; } // Call the appropriate methods to clean up unmanaged resources. // If disposing is false, only the following code is executed: this.disposed = true; } }
/// <summary> /// Constructor. /// </summary> /// <param name="port">The port to be connected</param> public AdtsLdapServer(ushort port, AdtsLdapConnectionType connectionType) { this.listenPort = port; if (connectionType == AdtsLdapConnectionType.Tcp || connectionType == AdtsLdapConnectionType.TlsOrSsl) { this.isTcp = true; } else { this.isTcp = false; } this.encoderv2 = new AdtsLdapV2Encoder(); this.encoderv3 = new AdtsLdapV3Encoder(); this.contextManager = new AdtsLdapContextManager(); this.decoder = new AdtsLdapServerDecoder(this); }