Revision: 81
http://svn.sourceforge.net/nmailserver/?rev=81&view=rev
Author: tmyroadctfig
Date: 2006-11-11 01:37:34 -0800 (Sat, 11 Nov 2006)
Log Message:
-----------
Removed TCP channel.
Modified Paths:
--------------
NMail/branches/luke-dev/Installer/NMail-Installer.wxs
NMail/branches/luke-dev/NMail/NMail.csproj
NMail/branches/luke-dev/NMail.Administration.Console/Context/TopLevelContext.cs
Removed Paths:
-------------
NMail/branches/luke-dev/NMail/IO/TcpChannel.cs
NMail/branches/luke-dev/NMail/IO/TcpClientChannel.cs
NMail/branches/luke-dev/NMail/IO/TcpClientTransportSink.cs
NMail/branches/luke-dev/NMail/IO/TcpClientTransportSinkProvider.cs
NMail/branches/luke-dev/NMail/IO/TcpServerChannel.cs
NMail/branches/luke-dev/NMail/IO/TcpServerTransportSink.cs
Modified: NMail/branches/luke-dev/Installer/NMail-Installer.wxs
===================================================================
--- NMail/branches/luke-dev/Installer/NMail-Installer.wxs 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/Installer/NMail-Installer.wxs 2006-11-11 09:37:34 UTC (rev 81)
@@ -58,12 +58,12 @@
</File>
</Component>
- <Component Id="C_NMail.Administration.Console.exe" Guid="79E07802-0DD8-456c-ACD4-B82E5A351BBA">
+ <!--<Component Id="C_NMail.Administration.Console.exe" Guid="79E07802-0DD8-456c-ACD4-B82E5A351BBA">
<File Id="NMail.Administration.Console.exe" Name="NMailSh.exe" LongName="NMailAdminShell.exe" DiskId="1" Source="obj\NMail.Administration.Console.exe" Vital="yes">
<Shortcut Id="startmenuNMailSh" Directory="ProgramMenuDir" Name="NMailSh" LongName="NMail Admin Console 1.0" WorkingDirectory="INSTALLDIR" />
<Shortcut Id="desktopNMailSh" Directory="DesktopFolder" Name="NMailSh" LongName="NMail Admin Console 1.0" WorkingDirectory="INSTALLDIR" />
</File>
- </Component>
+ </Component>-->
<Component Id="C_NMail.Server.Service.exe" Guid="7845A1AD-FF5E-4da9-A70C-924849ADD460">
<File Id="NMail.Server.Service.exe" Name="NMailSrv.exe" LongName="NMail.Server.Service.exe" DiskId="1" Source="obj\NMail.Server.Service.exe" Vital="yes" />
@@ -414,7 +414,7 @@
<!-- NMail Server EXEs -->
<ComponentRef Id="C_NMail.Server.Console.exe" />
- <ComponentRef Id="C_NMail.Administration.Console.exe" />
+ <!--<ComponentRef Id="C_NMail.Administration.Console.exe" />-->
<ComponentRef Id="C_NMail.Server.Service.exe" />
<ComponentRef Id="C_NMail.SetupWizard.exe" />
Deleted: NMail/branches/luke-dev/NMail/IO/TcpChannel.cs
===================================================================
--- NMail/branches/luke-dev/NMail/IO/TcpChannel.cs 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/NMail/IO/TcpChannel.cs 2006-11-11 09:37:34 UTC (rev 81)
@@ -1,373 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane and Daniel Frampton
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.IO;
-using System.Net.Security;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Messaging;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-
-using NMail.Authentication;
-using NMail.DataTypes;
-
-namespace NMail.IO {
- /// <summary>
- /// Provides a TCP transport channel with encryption and authentication.
- /// </summary>
- public class TcpChannel : IChannelSender, IChannelReceiver {
-
- private TcpClientChannel clientChannel;
-
- private TcpServerChannel serverChannel;
-
- public TcpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) {
- // Parse common properties
- bool useTls = true;
- if (properties.Contains("useTls")) {
- useTls = (bool) properties["useTls"];
- }
-
- // Create the client sink provider if needed
- if (clientSinkProvider == null) {
- clientSinkProvider = new BinaryClientFormatterSinkProvider();
- }
-
- // Parse the client properties
- RemoteCertificateValidationCallback certValidationCallback = (RemoteCertificateValidationCallback) properties["certificateValidation"];
- GetAuthDetailsDelegate getAuthDetailsCallback = (GetAuthDetailsDelegate) properties["authDetailCallback"];
- ChannelAuthComplete authCompleteCallback = (ChannelAuthComplete) properties["authCompleteCallback"];
-
- this.clientChannel = new TcpClientChannel(clientSinkProvider,
- getAuthDetailsCallback,
- certValidationCallback,
- authCompleteCallback,
- useTls);
-
- if (properties["isServer"] != null && ((string) properties["isServer"]) == "yes") {
- // Create the server sink provider if needed
- if (serverSinkProvider == null) {
- serverSinkProvider = new BinaryServerFormatterSinkProvider();
- }
-
- // Parse the server properties
- int port = Int32.Parse((string) properties["port"]);
- X509Certificate2 certificate = (X509Certificate2) properties["certificate"];
- IAuthenticationProvider authProvider = (IAuthenticationProvider) properties["authProvider"];
-
- this.serverChannel = new TcpServerChannel(port,
- certificate,
- authProvider,
- serverSinkProvider,
- useTls);
- }
- }
-
- #region IChannel Members
- /// <summary>
- /// The name of this channel.
- /// </summary>
- public string ChannelName {
- get {
- return TcpChannel.Name;
- }
- }
-
- /// <summary>
- /// The priority of this channel.
- /// </summary>
- public int ChannelPriority {
- get {
- return TcpChannel.Priority;
- }
- }
-
- /// <summary>
- /// Returns the object URI as an out parameter, and the URI of the current
- /// channel as the return value.
- /// </summary>
- /// <param name="url">The URL of the object.</param>
- /// <param name="objectURI">
- /// When this method returns, contains the object URI. This parameter is
- /// passed uninitialized.
- /// </param>
- /// <returns>
- /// The URI of the current channel, or null if the URI does not belong to
- /// this channel.
- /// </returns>
- public string Parse(string url, out string objectURI) {
- return TcpChannel.ParseUrl(url, out objectURI);
- }
- #endregion
-
- #region IChannelSender Members
- /// <summary>
- /// Returns a channel message sink that delivers messages to the specified URL
- /// or channel data object.
- /// </summary>
- /// <param name="url">
- /// The URL to which the new sink will deliver messages. Can be null.
- /// </param>
- /// <param name="remoteChannelData">
- /// The channel data object of the remote host to which the new sink will
- /// deliver messages. Can be null.
- /// </param>
- /// <param name="objectURI">
- /// When this method returns, contains a URI of the new channel message sink
- /// that delivers messages to the specified URL or channel data object. This
- /// parameter is passed uninitialized.
- /// </param>
- /// <returns>
- /// A channel message sink that delivers messages to the specified URL or
- /// channel data object, or null if the channel cannot connect to the given
- /// endpoint.
- /// </returns>
- public IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI) {
- return this.clientChannel.CreateMessageSink(url, remoteChannelData, out objectURI);
- }
- #endregion
-
- #region IChannelReceiver Members
- /// <summary>
- /// Gets the channel-specific data.
- /// </summary>
- public object ChannelData {
- get {
- if (this.serverChannel != null) {
- return this.serverChannel.ChannelData;
- }
-
- return null;
- }
- }
-
- /// <summary>
- /// Returns an array of all the URLs for a URI.
- /// </summary>
- /// <param name="objectURI">The URI for which URLs are required.</param>
- /// <returns>The array of URLs.</returns>
- public string[] GetUrlsForUri(string objectURI) {
- if (this.serverChannel != null) {
- return this.serverChannel.GetUrlsForUri(objectURI);
- }
-
- return null;
- }
-
- /// <summary>
- /// Instructs the current channel to start listening for requests.
- /// </summary>
- /// <param name="data">Optional initialization information.</param>
- public void StartListening(object data) {
- if (this.serverChannel != null) {
- this.serverChannel.StartListening(data);
- }
- }
-
- /// <summary>
- /// Instructs the current channel to stop listening for requests.
- /// </summary>
- /// <param name="data">Optional state information for the channel.</param>
- public void StopListening(object data) {
- if (this.serverChannel != null) {
- this.serverChannel.StopListening(data);
- }
- }
- #endregion
-
- /// <summary>
- /// Checks if the given URL is valid.
- /// </summary>
- /// <param name="url">The url to check.</param>
- /// <returns>True if valid.</returns>
- public static bool ValidUrl(string url) {
- Host host;
- int port;
- string objectUri;
-
- return ParseUrl(url, out host, out port, out objectUri);
- }
-
- /// <summary>
- /// Returns the object URI as an out parameter, and the URI of the current
- /// channel as the return value.
- /// </summary>
- /// <param name="url">The URL of the object.</param>
- /// <param name="objectURI">
- /// When this method returns, contains the object URI. This parameter is
- /// passed uninitialized.
- /// </param>
- /// <returns>
- /// The URI of the current channel, or null if the URI does not belong to
- /// this channel.
- /// </returns>
- public static string ParseUrl(string url, out string objectURI) {
- Host host;
- int port;
-
- if (TcpChannel.ParseUrl(url, out host, out port, out objectURI)) {
- return UrlPrefix + host.ToString() + ":" + port;
- }
-
- return null;
- }
-
- /// <summary>
- /// Parses the given url and extracts the parts.
- /// </summary>
- /// <param name="url">The URL to parse.</param>
- /// <param name="host">The host in the URL or null if the URL is invalid.</param>
- /// <param name="port">The port in the URL or -1 if the URL is invalid.</param>
- /// <param name="objectURI">The object URI in the URL or null if the URL is invalid.</param>
- /// <returns>True if the URL is valid.</returns>
- public static bool ParseUrl(string url, out Host host, out int port, out string objectURI) {
-
- if (url == null || !url.StartsWith(UrlPrefix) || url.IndexOf(':') == -1 || url.IndexOf('/') == -1) {
- // Invalid URL
- host = null;
- port = -1;
- objectURI = null;
- return false;
- }
-
- url = url.Trim();
-
- // Remove the "nmtcp://"
- url = url.Remove(0, UrlPrefix.Length);
-
- int cIndex = url.IndexOf(':');
- int sIndex = url.IndexOf('/');
- if (sIndex == -1) {
- sIndex = url.Length;
- }
- host = new Host(url.Substring(0, cIndex));
- port = Int32.Parse(url.Substring(cIndex + 1, sIndex - cIndex - 1));
- objectURI = url.Substring(sIndex);
-
- return true;
- }
-
- /// <summary>
- /// The prefix for all NMail remoting channel urls.
- /// </summary>
- public const string UrlPrefix = "nmtcp://";
-
- /// <summary>
- /// The name that this channel uses.
- /// </summary>
- public const string Name = "NMail-TCP";
-
- /// <summary>
- /// The priority that this channel uses.
- /// </summary>
- public const int Priority = 1;
- }
-
- #region TcpMessage
- /// <summary>
- /// A remoting message that is sent across the TCP channel.
- /// </summary>
- [Serializable]
- internal class TcpMessage {
- /// <summary>
- /// Creates a new message with the given headers and data.
- /// </summary>
- /// <param name="headers">The request or response headers.</param>
- /// <param name="data">The message data.</param>
- internal TcpMessage(ITransportHeaders headers, byte[] data) {
- this.headers = headers;
- this.data = data;
- }
-
- private ITransportHeaders headers;
-
- /// <summary>
- /// The request or response headers.
- /// </summary>
- internal ITransportHeaders Headers {
- get {
- return this.headers;
- }
- set {
- this.headers = value;
- }
- }
-
- private byte[] data;
-
- /// <summary>
- /// The message data.
- /// </summary>
- internal byte[] Data {
- get {
- return this.data;
- }
- set {
- this.data = value;
- }
- }
-
- /// <summary>
- /// Sends a message over the given connection.
- /// </summary>
- /// <param name="connection">The connection to send the message with.</param>
- /// <param name="data">The data to send.</param>
- /// <param name="headers">The headers.</param>
- public static void SendMessage(TcpTextConnection connection, Stream data, ITransportHeaders headers) {
- MemoryStream ms = new MemoryStream();
- byte[] buffer = new byte[1024];
-
- int bytesRead = data.Read(buffer, 0, buffer.Length);
-
- while (bytesRead > 0) {
- ms.Write(buffer, 0, bytesRead);
- bytesRead = data.Read(buffer, 0, buffer.Length);
- }
-
- TcpMessage message = new TcpMessage(headers, ms.GetBuffer());
- connection.Write(message);
- }
- }
- #endregion
-
- [Serializable]
- public class TcpUserPasswordPair {
- public TcpUserPasswordPair(string username, string password) {
- this.username = username;
- this.password = password;
- }
-
- private string username;
-
- public string Username {
- get {
- return this.username;
- }
- }
-
- private string password;
-
- public string Password {
- get {
- return this.password;
- }
- }
- }
-}
\ No newline at end of file
Deleted: NMail/branches/luke-dev/NMail/IO/TcpClientChannel.cs
===================================================================
--- NMail/branches/luke-dev/NMail/IO/TcpClientChannel.cs 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/NMail/IO/TcpClientChannel.cs 2006-11-11 09:37:34 UTC (rev 81)
@@ -1,154 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane and Daniel Frampton
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Messaging;
-using System.Text;
-
-using NMail.Authentication;
-using NMail.DataTypes;
-
-namespace NMail.IO {
- /// <summary>
- /// Provides a TCP client transport channel with authentication and encryption.
- /// </summary>
- public class TcpClientChannel : IChannelSender {
- /// <summary>
- /// The provider to use.
- /// </summary>
- private IClientChannelSinkProvider clientSinkProvider;
-
- /// <summary>
- /// The tranport sink provider.
- /// </summary>
- private TcpClientTransportSinkProvider transportSinkProvider;
-
- /// <summary>
- /// Creates a new client channel with the given provider.
- /// </summary>
- /// <param name="clientSinkProvider">The provider to use.</param>
- /// <param name="certValidationCallback">The certificate to use to validate the remote server's certificate.</param>
- public TcpClientChannel(IClientChannelSinkProvider clientSinkProvider, GetAuthDetailsDelegate getAuthDetailsCallback, RemoteCertificateValidationCallback certValidationCallback, ChannelAuthComplete authCompleteCallback, bool useTls) {
- this.clientSinkProvider = clientSinkProvider;
-
- this.transportSinkProvider = new TcpClientTransportSinkProvider(getAuthDetailsCallback, certValidationCallback, authCompleteCallback, useTls);
-
- if (this.clientSinkProvider == null) {
- this.clientSinkProvider = new BinaryClientFormatterSinkProvider();
- }
- }
-
- #region IChannelSender Members
- /// <summary>
- /// Returns a channel message sink that delivers messages to the specified URL
- /// or channel data object.
- /// </summary>
- /// <param name="url">
- /// The URL to which the new sink will deliver messages. Can be null.
- /// </param>
- /// <param name="remoteChannelData">
- /// The channel data object of the remote host to which the new sink will
- /// deliver messages. Can be null.
- /// </param>
- /// <param name="objectURI">
- /// When this method returns, contains a URI of the new channel message sink
- /// that delivers messages to the specified URL or channel data object. This
- /// parameter is passed uninitialized.
- /// </param>
- /// <returns>
- /// A channel message sink that delivers messages to the specified URL or
- /// channel data object, or null if the channel cannot connect to the given
- /// endpoint.
- /// </returns>
- public IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI) {
- if (url == null && remoteChannelData != null && remoteChannelData is IChannelDataStore) {
- IChannelDataStore ds = (IChannelDataStore) remoteChannelData;
- url = ds.ChannelUris[0];
- }
-
- if (TcpChannel.ValidUrl(url)) {
- // Parse the object URI
- TcpChannel.ParseUrl(url, out objectURI);
-
- // Find the last provider
- IClientChannelSinkProvider provider = this.clientSinkProvider;
- while (provider.Next != null) {
- provider = provider.Next;
- }
-
- // Add our transport to the end of the chain
- provider.Next = this.transportSinkProvider;
-
- return (IMessageSink) this.clientSinkProvider.CreateSink(this, url, remoteChannelData);
-
- } else {
- // The URL is not for our channel.
- objectURI = null;
- return null;
- }
- }
- #endregion
-
- #region IChannel Members
- /// <summary>
- /// The name of this channel.
- /// </summary>
- public string ChannelName {
- get {
- return TcpChannel.Name;
- }
- }
-
- /// <summary>
- /// The priority of this channel.
- /// </summary>
- public int ChannelPriority {
- get {
- return TcpChannel.Priority;
- }
- }
-
- /// <summary>
- /// Returns the object URI as an out parameter, and the URI of the current
- /// channel as the return value.
- /// </summary>
- /// <param name="url">The URL of the object.</param>
- /// <param name="objectURI">
- /// When this method returns, contains the object URI. This parameter is
- /// passed uninitialized.
- /// </param>
- /// <returns>
- /// The URI of the current channel, or null if the URI does not belong to
- /// this channel.
- /// </returns>
- public string Parse(string url, out string objectURI) {
- return TcpChannel.ParseUrl(url, out objectURI);
- }
- #endregion
- }
-
- public delegate TcpUserPasswordPair GetAuthDetailsDelegate(object sender);
-
- public delegate void ChannelAuthComplete(IAuthenticationToken authToken);
-}
Deleted: NMail/branches/luke-dev/NMail/IO/TcpClientTransportSink.cs
===================================================================
--- NMail/branches/luke-dev/NMail/IO/TcpClientTransportSink.cs 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/NMail/IO/TcpClientTransportSink.cs 2006-11-11 09:37:34 UTC (rev 81)
@@ -1,320 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane and Daniel Frampton
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Messaging;
-using System.Text;
-using System.Threading;
-
-using log4net;
-
-using NMail.Authentication;
-using NMail.DataTypes;
-using NMail.Helper;
-
-namespace NMail.IO {
- /// <summary>
- /// A client transport sink for the NMail TCP channel.
- /// </summary>
- public class TcpClientTransportSink : IClientChannelSink {
- /// <summary>
- /// Logging support for this class.
- /// </summary>
- protected static readonly ILog log = LogManager.GetLogger(typeof(TcpClientTransportSink));
-
- /// <summary>
- /// The host to connect to.
- /// </summary>
- private Host host;
-
- /// <summary>
- /// The port to connect on.
- /// </summary>
- private int port;
-
- /// <summary>
- /// The callback to use to validate the remote certificate.
- /// </summary>
- RemoteCertificateValidationCallback certValidationCallback;
-
- GetAuthDetailsDelegate getAuthDetailsCallback;
-
- ChannelAuthComplete authCompleteCallback;
-
- private bool useTls;
-
- /// <summary>
- /// Creates a new sink with the given url.
- /// </summary>
- /// <param name="url">The URL to connect to.</param>
- /// <param name="remoteChannelData">Channel data optionally containing the URL.</param>
- /// <param name="certValidationCallback">The callback to use to validate the remote certificate.</param>
- public TcpClientTransportSink(string url, object remoteChannelData, GetAuthDetailsDelegate getAuthDetailsCallback, RemoteCertificateValidationCallback certValidationCallback, ChannelAuthComplete authCompleteCallback, bool useTls) {
- this.getAuthDetailsCallback = getAuthDetailsCallback;
- this.certValidationCallback = certValidationCallback;
- this.authCompleteCallback = authCompleteCallback;
- this.useTls = useTls;
-
- if (TcpChannel.ValidUrl(url)) {
- string objectURI;
- TcpChannel.ParseUrl(url, out this.host, out this.port, out objectURI);
-
- } else if (remoteChannelData != null && remoteChannelData is ChannelDataStore) {
- ChannelDataStore channelDataStore = (ChannelDataStore) remoteChannelData;
- string objectURI;
- TcpChannel.ParseUrl(channelDataStore.ChannelUris[0], out this.host, out this.port, out objectURI);
-
- } else {
- throw new ArgumentException("No valid URLs found");
- }
-
- // Create a thread to handle the TCP comms
- ThreadHelper th = new ThreadHelper(new WaitCallback(processConnection), null);
- Thread processThread = new Thread(new ThreadStart(th.CallDelegate));
- processThread.Start();
- }
-
- #region IClientChannelSink Members
- /// <summary>
- /// Requests asynchronous processing of a method call on the current sink.
- /// </summary>
- /// <param name="sinkStack">A stack of channel sinks that called this sink.</param>
- /// <param name="msg">The message to process.</param>
- /// <param name="requestHeaders">The headers to add to the outgoing message heading to the server.</param>
- /// <param name="requestStream">The stream headed to the transport sink.</param>
- public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders requestHeaders, Stream requestStream) {
- ensureConnected();
-
- string messageId = new Guid().ToString();
-
- requestHeaders[CommonTransportKeys.RequestUri] = msg.Properties["__Uri"];
- requestHeaders["__Id"] = messageId;
-
- // Add our sink stack
- this.pendingAsyncRequests.Add(messageId, sinkStack);
-
- // Send over the request stream
- TcpMessage.SendMessage(this.connection, requestStream, requestHeaders);
- }
-
- /// <summary>
- /// Requests asynchronous processing of a response to a method call on the current sink.
- /// </summary>
- /// <param name="sinkStack">A stack of sinks that called this sink.</param>
- /// <param name="state">Information generated on the request side that is associated with this sink.</param>
- /// <param name="headers">The headers retrieved from the server response stream.</param>
- /// <param name="stream">The stream coming back from the transport sink.</param>
- public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, object state, ITransportHeaders headers, Stream stream) {
- // Not needed in a transport sink.
- throw new NotSupportedException();
- }
-
- /// <summary>
- /// Returns the Stream onto which the provided message is to be serialized.
- /// </summary>
- /// <param name="msg">The IMethodCallMessage containing details about the method call.</param>
- /// <param name="headers">The headers to add to the outgoing message heading to the server.</param>
- /// <returns>The Stream onto which the provided message is to be serialized.</returns>
- public Stream GetRequestStream(IMessage msg, ITransportHeaders headers) {
- // Can't directly access the stream.
- return null;
- }
-
- /// <summary>
- /// Gets the next client channel sink in the client sink chain.
- /// </summary>
- public IClientChannelSink NextChannelSink {
- get {
- // No more sinks
- return null;
- }
- }
-
- /// <summary>
- /// Requests message processing from the current sink.
- /// </summary>
- /// <param name="msg">The message to process.</param>
- /// <param name="requestHeaders">The headers to add to the outgoing message heading to the server.</param>
- /// <param name="requestStream">The stream headed to the transport sink.</param>
- /// <param name="responseHeaders">When this method returns, contains a ITransportHeaders interface that holds the headers that the server returned. This parameter is passed uninitialized.</param>
- /// <param name="responseStream">When this method returns, contains a Stream coming back from the transport sink. This parameter is passed uninitialized.</param>
- public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream) {
- ensureConnected();
-
- string messageId = new Guid().ToString();
-
- requestHeaders[CommonTransportKeys.RequestUri] = msg.Properties["__Uri"];
- requestHeaders["__Id"] = messageId;
-
- // Register an event to wait on
- ManualResetEvent responseArrived = new ManualResetEvent(false);
- this.pendingRequests.Add(messageId, responseArrived);
-
- // Send over the request stream
- TcpMessage.SendMessage(this.connection, requestStream, requestHeaders);
-
- // Wait for the response
- responseArrived.WaitOne();
-
- // Get the repsonse
- TcpMessage response = this.receivedResponses[messageId];
- this.receivedResponses.Remove(messageId);
-
- responseHeaders = response.Headers;
- responseStream = new MemoryStream(response.Data);
- }
- #endregion
-
- #region IChannelSinkBase Members
-
- public IDictionary Properties {
- get {
- return null;
- }
- }
- #endregion
-
- IAuthenticationToken authToken;
-
- public IAuthenticationToken AuthToken {
- get {
- return this.authToken;
- }
- }
-
- public bool Connected {
- get {
- return this.connection.Connected;
- }
- }
-
- /// <summary>
- /// The connection used to communicate with the server.
- /// </summary>
- protected TcpTextConnection connection = new TcpTextConnection(log);
-
- /// <summary>
- /// Ensures that this sink has a connection to the remote server and TLS
- /// encryption is in place.
- /// </summary>
- private void ensureConnected() {
- lock (this) {
- // Open a connection to the remote server if needed
- if (!connection.Connected) {
- connection.Open(this.host, this.port);
-
- string response = connection.ReadLine();
- if (response.Trim().ToLower() == "nmail remoting channel") {
- this.connection.WriteLine("OK");
-
- if (this.useTls)
- {
- // Go encrypted...
- if (this.certValidationCallback == null)
- {
- this.connection.StartTlsAsClient(this.host.ToString());
- }
- else
- {
- this.connection.StartTlsAsClient(this.host.ToString(), this.certValidationCallback);
- }
-
- if (!this.connection.Encrypted)
- {
- throw new InvalidOperationException("Failed to establish a secure connection to the server.");
- }
- }
-
- while (this.connection.Connected && this.authToken == null) {
- // Get the auth details
- TcpUserPasswordPair authDetails = this.getAuthDetailsCallback(this);
-
- // Send them to the server
- this.connection.Write(authDetails);
- this.authToken = (IAuthenticationToken) this.connection.Read();
- }
-
- if (this.authToken == null) {
- throw new InvalidOperationException("Failed to authenticated to the server.");
- }
-
- // Notify the caller that the auth token has arrived
- this.authCompleteCallback(authToken);
- }
- }
- }
- }
-
- /// <summary>
- /// A map of message Ids to sink stacks for pending async requests.
- /// </summary>
- private Dictionary<string, IClientChannelSinkStack> pendingAsyncRequests = new Dictionary<string, IClientChannelSinkStack>();
-
- /// <summary>
- /// A map of message Ids to events for pending sync requests.
- /// </summary>
- private Dictionary<string, ManualResetEvent> pendingRequests = new Dictionary<string,ManualResetEvent>();
-
- /// <summary>
- /// A map of message Ids to received responses for sync requests.
- /// </summary>
- private Dictionary<string, TcpMessage> receivedResponses = new Dictionary<string, TcpMessage>();
-
- /// <summary>
- /// Reads responses from the TCP connection.
- /// </summary>
- /// <param name="unused">Unused.</param>
- private void processConnection(object unused) {
- ensureConnected();
-
- while (this.connection.Connected) {
- // Read the next message
- TcpMessage response = (TcpMessage) this.connection.Read();
-
- string messageId = (string) response.Headers["__Id"];
-
- // Check if this is an async response
- if (this.pendingAsyncRequests.ContainsKey(messageId)) {
- // Pass the message to the appropriate sink stack
- IClientChannelSinkStack sinkStack = this.pendingAsyncRequests[messageId];
- this.pendingAsyncRequests.Remove(messageId);
- MemoryStream responseStream = new MemoryStream(response.Data);
- sinkStack.AsyncProcessResponse(response.Headers, responseStream);
-
- } else if (this.pendingRequests.ContainsKey(messageId)) {
- // Add the repsonse
- this.receivedResponses.Add(messageId, response);
-
- // Notify the waiting thread
- ManualResetEvent responseArrived = this.pendingRequests[messageId];
- this.pendingRequests.Remove(messageId);
- responseArrived.Set();
-
- } else {
- throw new InvalidOperationException("No request matches the given message Id.");
- }
- }
- }
- }
-}
Deleted: NMail/branches/luke-dev/NMail/IO/TcpClientTransportSinkProvider.cs
===================================================================
--- NMail/branches/luke-dev/NMail/IO/TcpClientTransportSinkProvider.cs 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/NMail/IO/TcpClientTransportSinkProvider.cs 2006-11-11 09:37:34 UTC (rev 81)
@@ -1,119 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane and Daniel Frampton
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Messaging;
-using System.Text;
-
-using NMail.Authentication;
-using NMail.DataTypes;
-
-namespace NMail.IO {
- /// <summary>
- /// A client transport sink provider for the NMail TCP channel.
- /// </summary>
- public class TcpClientTransportSinkProvider : IClientChannelSinkProvider {
-
- /// <summary>
- /// The callback to use to validate the remote server's certificate.
- /// </summary>
- private RemoteCertificateValidationCallback certValidationCallback;
-
- private GetAuthDetailsDelegate getAuthDetailsCallback;
-
- private ChannelAuthComplete authCompleteCallback;
-
- private bool useTls;
-
- /// <summary>
- /// Creates a new provider with the given certificate validation callback.
- /// </summary>
- /// <param name="certValidationCallback">The callback to use to validation teh remote server's certificate null for the default.</param>
- public TcpClientTransportSinkProvider(GetAuthDetailsDelegate getAuthDetailsCallback, RemoteCertificateValidationCallback certValidationCallback, ChannelAuthComplete authCompleteCallback, bool useTls) {
- this.getAuthDetailsCallback = getAuthDetailsCallback;
- this.certValidationCallback = certValidationCallback;
- this.authCompleteCallback = authCompleteCallback;
- this.useTls = useTls;
- }
-
- #region IClientChannelSinkProvider Members
- /// <summary>
- /// Creates a sink chain.
- /// </summary>
- /// <param name="channel">
- /// Channel for which the current sink chain is being constructed.
- /// </param>
- /// <param name="url">
- /// The URL of the object to connect to. This parameter can be null if the
- /// connection is based entirely on the information contained in the
- /// remoteChannelData parameter.
- /// </param>
- /// <param name="remoteChannelData">
- /// A channel data object that describes a channel on the remote server.
- /// </param>
- /// <returns>
- /// The first sink of the newly formed channel sink chain, or null, which
- /// indicates that this provider will not or cannot provide a connection for
- /// this endpoint.
- /// </returns>
- public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData) {
- Host host;
- int port;
- string objectUri;
-
- TcpChannel.ParseUrl(url, out host, out port, out objectUri);
-
- string key = host.ToString() + ":" + port;
-
- lock (this) {
- if (sinkMap.ContainsKey(key) && !sinkMap[key].Connected) {
- // Transport has lost its connection
- this.sinkMap.Remove(key);
- }
-
- // Create a transport if needed
- if (!sinkMap.ContainsKey(key)) {
- this.sinkMap.Add(key, new TcpClientTransportSink(url, remoteChannelData, this.getAuthDetailsCallback, this.certValidationCallback, this.authCompleteCallback, this.useTls));
- }
-
- return this.sinkMap[key];
- }
- }
-
- private Dictionary<string, TcpClientTransportSink> sinkMap = new Dictionary<string, TcpClientTransportSink>();
-
- /// <summary>
- /// Gets or sets the next sink provider in the channel sink provider chain.
- /// </summary>
- public IClientChannelSinkProvider Next {
- get {
- return null;
- }
- set {
- // Ignore: this provider has to be the last in the chain.
- }
- }
- #endregion
- }
-}
Deleted: NMail/branches/luke-dev/NMail/IO/TcpServerChannel.cs
===================================================================
--- NMail/branches/luke-dev/NMail/IO/TcpServerChannel.cs 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/NMail/IO/TcpServerChannel.cs 2006-11-11 09:37:34 UTC (rev 81)
@@ -1,259 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane and Daniel Frampton
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Net.Sockets;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Messaging;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-using System.Threading;
-
-using log4net;
-
-using NMail.Authentication;
-using NMail.DataTypes;
-using NMail.Helper;
-
-namespace NMail.IO {
- /// <summary>
- /// A TCP server channel.
- /// </summary>
- public class TcpServerChannel : IChannelReceiver, IChannel {
- /// <summary>
- /// Logging support for this class.
- /// </summary>
- protected static readonly ILog log = LogManager.GetLogger(typeof(TcpServerChannel));
-
- /// <summary>
- /// The port to listen on.
- /// </summary>
- private int port;
-
- /// <summary>
- /// The bind IP address to report to report clients.
- /// </summary>
- private string bindAddress;
-
- /// <summary>
- /// The certificate to use for SSL.
- /// </summary>
- private X509Certificate2 certificate;
-
- /// <summary>
- /// The authentication provider to use.
- /// </summary>
- private IAuthenticationProvider authProvider;
-
- /// <summary>
- /// The sink to pass any incoming messages to.
- /// </summary>
- private IServerChannelSink nextSink;
-
- private bool useTls;
-
- /// <summary>
- /// Creates a new server channel with the given details.
- /// </summary>
- /// <param name="port">The port to listen on.</param>
- /// <param name="certificate">The certificate to use for SSL.</param>
- /// <param name="serverSinkProvider">The provider.</param>
- public TcpServerChannel(int port, X509Certificate2 certificate, IAuthenticationProvider authProvider, IServerChannelSinkProvider serverSinkProvider, bool useTls) {
- this.port = port;
- this.certificate = certificate;
- this.authProvider = authProvider;
- this.useTls = useTls;
-
- // This is needed to report a valid IP to clients asking for channel data
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- if (hostEntry.AddressList.Length == 0) {
- throw new Exception("IP address could not be determined for this host.");
- }
- this.bindAddress = hostEntry.AddressList[0].ToString();
-
- string[] urls = new string[1];
- urls[0] = GetUrlForChannel();
- this.channelData = new ChannelDataStore(urls);
-
- // Collect channel data for all providers
- IServerChannelSinkProvider provider = serverSinkProvider;
- while (provider != null) {
- provider.GetChannelData(this.channelData);
- provider = provider.Next;
- }
-
- // Create the sink chain
- this.nextSink = ChannelServices.CreateServerChannelSinkChain(serverSinkProvider, this);
-
- StartListening(null);
- }
-
- #region IChannelReceiver Members
-
- private ChannelDataStore channelData;
-
- /// <summary>
- /// Gets the channel-specific data.
- /// </summary>
- public object ChannelData {
- get {
- return this.channelData;
- }
- }
-
- /// <summary>
- /// Returns an array of all the URLs for a URI.
- /// </summary>
- /// <param name="objectURI">The URI for which URLs are required.</param>
- /// <returns>The array of URLs.</returns>
- public string[] GetUrlsForUri(string objectURI) {
- string[] urls = new string[1];
-
- if (!objectURI.StartsWith("/")) {
- objectURI = '/' + objectURI;
- }
-
- urls[0] = GetUrlForChannel() + objectURI;
- return urls;
- }
-
- public string GetUrlForChannel() {
- return TcpChannel.UrlPrefix + this.bindAddress + ":" + this.port;
- }
-
- /// <summary>
- /// Instructs the current channel to start listening for requests.
- /// </summary>
- /// <param name="data">Optional initialization information.</param>
- public void StartListening(object data) {
- this.shutdown = false;
-
- IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, this.port);
-
- ThreadHelper th = new ThreadHelper(new WaitCallback(handleConnections), endpoint);
- Thread listenThread = new Thread(new ThreadStart(th.CallDelegate));
- listenThread.Start();
- }
-
- /// <summary>
- /// Instructs the current channel to stop listening for requests.
- /// </summary>
- /// <param name="data">Optional state information for the channel.</param>
- public void StopListening(object data) {
- this.shutdown = true;
-
- lock (this) {
- // Stop listening on all the bound sockets
- foreach (TcpListener listener in this.listenSockets) {
- listener.Stop();
- }
- this.listenSockets = new List<TcpListener>();
- }
- }
- #endregion
-
- #region IChannel Members
- /// <summary>
- /// The name of this channel.
- /// </summary>
- public string ChannelName {
- get {
- return TcpChannel.Name;
- }
- }
-
- /// <summary>
- /// The priority of this channel.
- /// </summary>
- public int ChannelPriority {
- get {
- return TcpChannel.Priority;
- }
- }
-
- /// <summary>
- /// Returns the object URI as an out parameter, and the URI of the current
- /// channel as the return value.
- /// </summary>
- /// <param name="url">The URL of the object.</param>
- /// <param name="objectURI">
- /// When this method returns, contains the object URI. This parameter is
- /// passed uninitialized.
- /// </param>
- /// <returns>
- /// The URI of the current channel, or null if the URI does not belong to
- /// this channel.
- /// </returns>
- public string Parse(string url, out string objectURI) {
- log.Debug("Parse");
-
- return TcpChannel.ParseUrl(url, out objectURI);
- }
- #endregion
-
- /// <summary>
- /// A flag indicating if the listening sockets should shutdown.
- /// </summary>
- private bool shutdown = true;
-
- /// <summary>
- /// A list of listening sockets.
- /// </summary>
- private List<TcpListener> listenSockets = new List<TcpListener>();
-
- /// <summary>
- /// Handles incomming connections for an interface (IP address).
- /// </summary>
- /// <param name="o">The interface to listen for connections on.</param>
- protected void handleConnections(object o) {
- Thread.CurrentThread.Name = "HandleRemoting:" + o.ToString();
- TcpListener socket = null;
-
- try {
- IPEndPoint ep = (IPEndPoint) o;
- if (log.IsDebugEnabled) {
- log.Debug("Binding to IP endpoint: [" + ep + "]");
- }
- socket = new TcpListener(ep);
- socket.Start();
- lock (this) {
- // Register this socket
- this.listenSockets.Add(socket);
- }
-
- while (true) {
- Socket client = socket.AcceptSocket();
- new TcpServerTransportSink(this.nextSink, this.certificate, this.authProvider, client, this.useTls);
- }
- } catch (SocketException e) {
- // Ignore interrupted exception during shutdown
- if (!this.shutdown) {
- log.Warn(e.Message, e);
- }
-
- lock (this) {
- // De-register this socket
- this.listenSockets.Remove(socket);
- }
- }
- }
- }
-}
Deleted: NMail/branches/luke-dev/NMail/IO/TcpServerTransportSink.cs
===================================================================
--- NMail/branches/luke-dev/NMail/IO/TcpServerTransportSink.cs 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/NMail/IO/TcpServerTransportSink.cs 2006-11-11 09:37:34 UTC (rev 81)
@@ -1,263 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane and Daniel Frampton
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Net.Sockets;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Messaging;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-using System.Threading;
-
-using log4net;
-
-using NMail.Authentication;
-using NMail.DataTypes;
-using NMail.Helper;
-
-namespace NMail.IO {
- /// <summary>
- /// A TCP server transport sink.
- /// </summary>
- public class TcpServerTransportSink : IServerChannelSink {
- /// <summary>
- /// Logging support for this class.
- /// </summary>
- protected static readonly ILog log = LogManager.GetLogger(typeof(TcpServerTransportSink));
-
- /// <summary>
- /// The connection used to communicate to the client.
- /// </summary>
- protected TcpTextConnection connection = new TcpTextConnection(log);
-
- /// <summary>
- /// The next sink in the chain.
- /// </summary>
- protected IServerChannelSink nextSink;
-
- protected IAuthenticationProvider authProvider;
-
- private bool useTls;
-
- /// <summary>
- /// Creates a new transport sink with the given details.
- /// </summary>
- /// <param name="nextSink">The next sink in the chain.</param>
- /// <param name="certificate">The certificate to use in SSL.</param>
- /// <param name="client">The socket to the remote client.</param>
- public TcpServerTransportSink(IServerChannelSink nextSink, X509Certificate2 certificate, IAuthenticationProvider authProvider, Socket client, bool useTls) {
- this.nextSink = nextSink;
- this.connection.Create(client);
- this.connection.Certificate = certificate;
- this.authProvider = authProvider;
- this.useTls = useTls;
-
- // Create a new thread to read requests with
- ThreadHelper th = new ThreadHelper(new WaitCallback(processConnection), null);
- Thread processThread = new Thread(new ThreadStart(th.CallDelegate));
- processThread.Start();
- }
-
- /// <summary>
- /// Handles the connection from the client, reading requests passing them
- /// up the chain.
- /// </summary>
- /// <param name="unused">An unused argument.</param>
- private void processConnection(object unused) {
- Thread.CurrentThread.Name = "NMail TCP server remoting thread.";
-
- try {
- // Present the welcome message and await a valid response
- this.connection.WriteLine("NMail Remoting Channel");
- string response = this.connection.ReadLine();
-
- // Check that we have a valid client
- if (response.Trim().ToLower() != "ok") {
- this.connection.Close();
- }
-
- if (this.useTls)
- {
- // Go encrypted...
- this.connection.StartTlsAsServer();
- }
-
- int authAttempts = 0;
- bool authenticated = false;
-
- // Try to authenticate the user
- while (this.connection.Connected && !authenticated && authAttempts < 3) {
- TcpUserPasswordPair authDetails = (TcpUserPasswordPair) this.connection.Read();
-
- // Attempt to authenticate the user
- IAuthenticationToken authToken = this.authProvider.Authenticate(authDetails.Username, authDetails.Password);
-
- authAttempts++;
- authenticated = (authToken != null);
- this.connection.Write(authToken);
- }
-
- if (authAttempts >= 3) {
- // Auth failed
- this.connection.Close();
- return;
- }
-
- while (this.connection.Connected) {
- // Get the next request from the client
- TcpMessage request = (TcpMessage) this.connection.Read();
- MemoryStream requestStream = new MemoryStream(request.Data);
-
- // Get the message Id
- string messageId = (string) request.Headers["__Id"];
-
- // Strip off all of the Url except the object Uri
- string uri = (string) request.Headers[CommonTransportKeys.RequestUri];
- TcpChannel.ParseUrl(uri, out uri);
- if (uri != null) {
- request.Headers[CommonTransportKeys.RequestUri] = uri;
- }
-
- ServerChannelSinkStack sinkStack = new ServerChannelSinkStack();
- sinkStack.Push(this, messageId);
-
- IMessage responseMessage;
- ITransportHeaders responseHeaders;
- Stream responseStream;
-
- // Send the request down the chain
- ServerProcessing processing = this.nextSink.ProcessMessage(sinkStack,
- null,
- request.Headers,
- requestStream,
- out responseMessage,
- out responseHeaders,
- out responseStream);
-
- // Check if a response is needed
- if (processing == ServerProcessing.Complete) {
- responseHeaders["__Id"] = messageId;
-
- TcpMessage.SendMessage(this.connection, responseStream, responseHeaders);
- this.connection.Flush();
- }
- }
- } catch (SocketException) {
- // Ignore
-
- } catch (IOException) {
- // Ignore
-
- } catch (Exception ex) {
- log.Debug("Unhandled exception.", ex);
- }
- }
-
- #region IServerChannelSink Members
- /// <summary>
- /// Requests processing from the current sink of the response from a method
- /// call sent asynchronously.
- /// </summary>
- /// <param name="sinkStack">
- /// A stack of sinks leading back to the server transport sink.
- /// </param>
- /// <param name="state">
- /// Information generated on the request side that is associated with this sink.
- /// </param>
- /// <param name="msg">The response message.</param>
- /// <param name="responseHeaders">
- /// The headers to add to the return message heading to the client.
- /// </param>
- /// <param name="responseStream">The stream heading back to the transport sink.</param>
- public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders responseHeaders, Stream responseStream) {
- string messageId = (string) state;
-
- responseHeaders["__Id"] = messageId;
-
- TcpMessage.SendMessage(this.connection, responseStream, responseHeaders);
- this.connection.Flush();
- }
-
- /// <summary>
- /// Returns the Stream onto which the provided response message is to be serialized.
- /// </summary>
- /// <param name="sinkStack">A stack of sinks leading back to the server transport sink.</param>
- /// <param name="state">The state that has been pushed to the stack by this sink.</param>
- /// <param name="msg">The response message to serialize.</param>
- /// <param name="headers">The headers to put in the response stream to the client.</param>
- /// <returns>The Stream onto which the provided response message is to be serialized.</returns>
- public Stream GetResponseStream(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers) {
- // Not possible to directly access the stream
- return null;
- }
-
- /// <summary>
- /// Gets the next server channel sink in the server sink chain.
- /// </summary>
- public IServerChannelSink NextChannelSink {
- get {
- return this.nextSink;
- }
- }
-
- /// <summary>
- /// Requests message processing from the current sink.
- /// </summary>
- /// <param name="sinkStack">
- /// A stack of channel sinks that called the current sink.
- /// </param>
- /// <param name="requestMsg">The message that contains the request.</param>
- /// <param name="requestHeaders">
- /// Headers retrieved from the incoming message from the client.
- /// </param>
- /// <param name="requestStream">
- /// The stream that needs to be to processed and passed on to the deserialization sink.
- /// </param>
- /// <param name="responseMsg">
- /// When this method returns, contains a IMessage that holds the response message. This parameter is passed uninitialized.
- /// </param>
- /// <param name="responseHeaders">
- /// When this method returns, contains a ITransportHeaders that holds the headers that are to be added to return message heading to the client. This parameter is passed uninitialized.
- /// </param>
- /// <param name="responseStream">
- /// When this method returns, contains a Stream that is heading back to the transport sink. This parameter is passed uninitialized.
- /// </param>
- /// <returns>
- /// A ServerProcessing status value that provides information about how message was processed.
- /// </returns>
- public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream) {
- // This will never be called for a server side sink
- throw new NotSupportedException();
- }
- #endregion
-
- #region IChannelSinkBase Members
- /// <summary>
- /// Gets a dictionary through which properties on the sink can be accessed.
- /// </summary>
- public IDictionary Properties {
- get {
- // Not needed
- return null;
- }
- }
- #endregion
- }
-}
Modified: NMail/branches/luke-dev/NMail/NMail.csproj
===================================================================
--- NMail/branches/luke-dev/NMail/NMail.csproj 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/NMail/NMail.csproj 2006-11-11 09:37:34 UTC (rev 81)
@@ -246,15 +246,10 @@
<Compile Include="Helper\XmlHelper.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="IO\TcpChannel.cs" />
- <Compile Include="IO\TcpClientChannel.cs" />
- <Compile Include="IO\TcpClientTransportSink.cs" />
- <Compile Include="IO\TcpClientTransportSinkProvider.cs" />
- <Compile Include="IO\TcpServerChannel.cs" />
- <Compile Include="IO\TcpServerTransportSink.cs" />
<Compile Include="IO\TcpTextConnection.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="IO\TcpUserPasswordPair.cs" />
<Compile Include="Threading\NMailThreadPool.cs">
<SubType>Code</SubType>
</Compile>
Modified: NMail/branches/luke-dev/NMail.Administration.Console/Context/TopLevelContext.cs
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Console/Context/TopLevelContext.cs 2006-11-08 12:58:41 UTC (rev 80)
+++ NMail/branches/luke-dev/NMail.Administration.Console/Context/TopLevelContext.cs 2006-11-11 09:37:34 UTC (rev 81)
@@ -51,10 +51,10 @@
useTls = false;
#endif
- TcpClientChannel channel = new TcpClientChannel(null, new GetAuthDetailsDelegate(GetAuthDetails), new RemoteCertificateValidationCallback(remoteCertificateValidation), new ChannelAuthComplete(AuthCompleteCallback), useTls);
- ChannelServices.RegisterChannel(channel, false);
+ //TcpClientChannel channel = new TcpClientChannel(null, new GetAuthDetailsDelegate(GetAuthDetails), new RemoteCertificateValidationCallback(remoteCertificateValidation), new ChannelAuthComplete(AuthCompleteCallback), useTls);
+ //ChannelServices.RegisterChannel(channel, false);
- string url = "nmtcp://127.0.0.1:7877/RemoteAdministration.rem";
+ string url = "tcp://127.0.0.1:7877/RemoteAdministration.rem";
this.remoteAdmin = (RemoteAdministration)RemotingServices.Connect(Type.GetType("NMail.Server.RemoteAdministration, NMail.Server"), url);
// Wait until the channel gives us an authentication token
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|