You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by sc...@apache.org on 2009/01/30 23:25:07 UTC

svn commit: r739432 [8/9] - in /incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp: ./ Msg/ Support/ Transport/ Transport/Filter/ Transport/Fmt/ Transport/Fmt/Binary/ Util/

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TcpTransport.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TcpTransport.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TcpTransport.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TcpTransport.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,319 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Runtime.CompilerServices;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    /// <summary>
+    /// Constants and methods related to tcp transport.
+    /// </summary>
+    abstract public class TcpTransport : Connection<SessionData>, TransportData
+    {
+        /// <summary>
+        /// Constructs the TcpTransport. Pulls common parameters off the uri.
+        /// </summary>
+        /// <param name="uri"></param>
+        /// <param name="resources"></param>
+        protected TcpTransport(URL uri, Resources resources)
+        {
+            options = new TcpOptions(uri, resources);
+        }
+
+        private readonly TcpOptions options;
+
+        protected override void Stop0()
+        {
+            try
+            {
+                Close(false);
+            }
+            catch
+            {
+                // ignore
+            }
+            base.Stop0();
+        }
+
+        protected Socket socket;
+
+        /// <summary>
+        /// Checks the connection socket for being open.
+        /// </summary>
+        /// <returns>the connection socket</returns>
+        protected Socket CheckSocket()
+        {
+            Socket s = socket;
+
+            if (s == null)
+                throw new IOException("socket closed");
+
+            return s;
+        }
+
+        public override void Close(bool reset)
+        {
+            Socket s = socket;
+            if (s != null)
+            {
+                try
+                {
+                    try
+                    {
+                        if (reset)
+                            s.LingerState = new LingerOption(false, 0);
+                        else
+                        {
+                            Flush();
+                            ShutdownOutput();
+                        }
+                    }
+                    finally
+                    {
+                        s.Close();
+                    }
+                }
+                catch
+                {
+                    // ignore.
+                }
+                finally
+                {
+                    stream = null;
+                    socket = null;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Sends some data to the remote end. The output data is buffered
+        /// until the buffer is full or the buffer is flushed.
+        /// </summary>
+        /// <param name="buf">the bytes to be sent</param>
+        /// Exception:
+        ///     throws Exception if there is a problem transmitting the
+        ///     data. Such a problem causes the current connection to be
+        ///     reset.
+        /// <seealso cref="Flush()"/>
+        /// <seealso cref="TcpOptions.autoFlush"/>
+        public void Send(byte[] buf)
+        {
+            Send(buf, 0, buf.Length);
+        }
+
+        /// <summary>
+        /// Sends some data to the remote end. The output data is buffered
+        /// until the buffer is full or the buffer is flushed.
+        /// </summary>
+        /// <param name="buf">the bytes to be sent</param>
+        /// <param name="off">the offset into buf of the first byte to send</param>
+        /// <param name="len">the number of bytes to send</param>
+        public void Send(byte[] buf, int off, int len)
+        {
+            try
+            {
+                Stream s = checkStream();
+                s.Write(buf, off, len);
+                if (options.autoFlush)
+                {
+                    s.Flush();
+                }
+            }
+            catch (Exception)
+            {
+                Close(true);
+                throw;
+            }
+        }
+
+        public void Flush()
+        {
+            try
+            {
+                checkStream().Flush();
+            }
+            catch (Exception)
+            {
+                Close(true);
+                throw;
+            }
+        }
+
+        protected Stream checkStream()
+        {
+            Stream ns = stream;
+            if (ns == null)
+                throw new IOException("net stream closed");
+            return ns;
+        }
+
+        private void FireData(FlexBuffer buf)
+        {
+            session.SessionData(null, buf);
+        }
+
+        protected Stream stream;
+
+        public override EndPoint LocalAddress()
+        {
+            return CheckSocket().LocalEndPoint;
+        }
+
+        public override EndPoint RemoteAddress()
+        {
+            return CheckSocket().RemoteEndPoint;
+        }
+
+        public void TransportData(Who recipient, FlexBuffer buf)
+        {
+            Send(buf.GetBuf(), buf.Index(), buf.Avail());
+        }
+
+        protected override void SetUpSocket()
+        {
+            Socket s = CheckSocket();
+
+            s.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.KeepAlive, options.keepAlive);
+            s.LingerState = new LingerOption(options.lingerTime >= 0, options.lingerTime >= 0 ? options.lingerTime : 0);
+            s.NoDelay = options.noDelay;
+            //s.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TypeOfService, trafficClass);
+
+            stream = new NetworkStream(socket);
+            // TODO do something about buffering this stream.
+        }
+
+        public void ShutdownInput()
+        {
+            CheckSocket().Shutdown(SocketShutdown.Receive);
+        }
+
+        public void ShutdownOutput()
+        {
+            CheckSocket().Shutdown(SocketShutdown.Send);
+        }
+
+        abstract protected Socket NewSocket();
+
+        abstract protected bool IsServer();
+
+        public override object TransportQuery(object query)
+        {
+            if (query.Equals(TransportConsts.IS_SERVER))
+                return IsServer();
+
+            return base.TransportQuery(query);
+        }
+
+        [MethodImpl(MethodImplOptions.Synchronized)]
+        protected override bool OpenSocket(bool reconnect)
+        {
+            // if a one time connection from a server socket listener, just
+            // return the existing socket.
+            if (!reconnect && socket != null)
+                return true;
+
+            // if a one time connection from a server socket listener, and
+            // this is a reconnect, then bail.
+            if (reconnect && IsServer())
+                return false;
+
+            // if a reconnect but no retries allowed, then bail.
+            if (reconnect && options.reconnectDelay == 0)
+                return false;
+
+            // ok, we don't have an existing socket, and this is either the first
+            // connection attempt or a reconnect with delay > 0.
+
+            bool first = true;
+
+            while (IsStarted())
+            {
+                // if reconnect is false and first is true, this is our
+                // very first attempt to connect. otherwise, we are trying
+                // to reconnect a broken link or establish a link where we
+                // have already failed at least once.
+
+                if (reconnect || !first)
+                {
+                    if (options.reconnectDelay == 0)
+                        return false;
+
+                    System.Threading.Monitor.Wait(this, options.reconnectDelay);
+
+                    if (!IsStarted())
+                        break;
+                }
+
+                // try to open a socket.
+
+                try
+                {
+                    socket = NewSocket();
+                    return true;
+                }
+                catch (Exception e)
+                {
+                    if (first)
+                    {
+                        first = false;
+                        FireException("open", e);
+                    }
+                }
+            }
+
+            return false;
+        }
+
+        protected override void ReadSocket()
+        {
+            Stream ns = checkStream();
+            FlexBuffer buf = new FlexBuffer(new byte[8192]);
+
+            try
+            {
+                while (IsStarted())
+                {
+                    int n = ns.Read(buf.GetBuf(), 0, buf.Length());
+
+                    if (n <= 0)
+                        break;
+
+                    buf.SetLength(n);
+                    buf.SetIndex(0);
+                    FireData(buf);
+                }
+            }
+            catch (Exception e)
+            {
+                if (e.Message == null)
+                    throw;
+                if (e.Message.Contains("connection was aborted"))
+                    return;
+                if (e.Message.Contains("blocking operation"))
+                    return;
+                if (e.Message.Contains("socket closed"))
+                    return;
+                if (e.Message.Contains("read operation failed"))
+                    return;
+                throw;
+            }
+        }
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TcpTransport.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TcpTransport.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Timer.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Timer.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Timer.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Timer.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,237 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    /// <summary>
+    /// Timer enables making high precision interval tests. In the usual
+    /// scenario, some code is going to be bracketed by calls to
+    /// initialize a timer and later get the elapsed time since the init.
+    /// 
+    /// Trying to use the system clock (System.currentTimeMillis) is
+    /// problematic because periodic system time adjustments (by ntp,
+    /// windows time, etc.) will invalidate any interval testing based
+    /// on the system clock. Also, the system clock resolution is not
+    /// all that good (15 ms typically on a windows box).
+    /// 
+    /// Timer tmr = new Timer().init();
+    /// foo();
+    /// long ns = tmr.elapsedNanos();
+    /// System.out.println( "foo() took "+ns+" nanos" );
+    /// 
+    /// Timer keeps state, initialized by init(), and used by elapsedBlah()
+    /// and thus is thread safe as long as calls to init() are serialized.
+    /// 
+    /// For lower cost timing needs, Timer supports a set of static interfaces.
+    /// 
+    /// long t0 = Timer.getStartTime();
+    /// foo();
+    /// long ns = Timer.getNanosSince( t0 );
+    /// System.out.println( "foo() took "+ns+" nanos" );
+    /// 
+    /// Note: reading the high precision clock (which all these methods
+    /// ultimately do) takes about 1,487 nanoseconds on Windows XP Pro
+    /// running on a Dell Precision 370 workstation using jdk 1.5.0_04.
+    /// By comparison, a method call takes about 1.97 nanoseconds. Also,
+    /// on the above platform, the resolution of the timer is 1,396 ns.
+    /// Could be that the resolution is smaller, but we'll never know it
+    /// because just getting the value from the OS is the dominant factor.
+    /// </summary>
+
+    public class Timer
+    {
+        /// <summary>
+        /// Constructs the Timer. The timer is not started.
+        /// </summary>
+        public Timer()
+        {
+            // nothing to do.
+        }
+
+        /// <summary>
+        /// Initializes the startTime of this timer.
+        /// </summary>
+        /// <returns>returns this timer.</returns>
+        public Timer Init()
+        {
+            startTime = Nanos;
+            return this;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the elapsed time in nanos since the last init.</returns>
+        public long ElapsedNanos()
+        {
+            if ( startTime == long.MinValue)
+                throw new Exception( "Timer not started" );
+            return GetNanosSince( startTime );
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the elapsed time in micros since the last init.</returns>
+        public long ElapsedMicros()
+        {
+            return ElapsedNanos() / NANOS_PER_MICRO;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the elapsed time in millis since the last init.</returns>
+        public long ElapsedMillis()
+        {
+            return ElapsedNanos() / NANOS_PER_MILLI;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the elapsed time in seconds since the last init.</returns>
+        public double ElapsedSeconds()
+        {
+            return ElapsedNanos() / NANOS_PER_SECOND;
+        }
+
+        private long startTime = long.MinValue;
+
+        /// <summary>
+        /// Number of nanoseconds per microsecond.
+        /// </summary>
+        public const long NANOS_PER_MICRO = 1000;
+
+        /// <summary>
+        /// Number of nanoseconds per milliseconds.
+        /// </summary>
+        public const long NANOS_PER_MILLI = 1000000;
+        
+        public const long TICKS_PER_MILLI = 10000; // 100 ns per tick
+        
+        public const long NANOS_PER_TICK = 100; // 100 ns per tick
+
+        /// <summary>
+        /// Number of nanoseconds per second.
+        /// </summary>
+        public const double NANOS_PER_SECOND = 1000000000.0;
+
+        //////////////////////
+        // STATIC INTERFACE //
+        //////////////////////
+
+        public static long Nanos
+        {
+            get
+            {
+                return DateTime.Now.Ticks * NANOS_PER_TICK;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the starting point of a timing test in millis.</returns>
+        public static long currentTimeMillis()
+        {
+            return DateTime.Now.Ticks / TICKS_PER_MILLI;
+        }
+        
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="startTime">a value returned by getStartTime.</param>
+        /// <returns>the number of nanos which have passed since startTime.</returns>
+        /// <see cref="Nanos"/>
+        public static long GetNanosSince( long startTime )
+        {
+            return Nanos - startTime;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="startTime">a value returned by getStartTime.</param>
+        /// <returns>the number of micros which have passed since startTime.</returns>
+        /// <see cref="Nanos"/>
+        public static long GetMicrosSince( long startTime )
+        {
+            return GetNanosSince( startTime ) / NANOS_PER_MICRO;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="startTime">a value returned by getStartTime.</param>
+        /// <returns>the number of millis which have passed since startTime.</returns>
+        /// <see cref="Nanos"/>
+        public static long GetMillisSince( long startTime )
+        {
+            return GetNanosSince( startTime ) / NANOS_PER_MILLI;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="startTime">a value returned by getStartTime.</param>
+        /// <returns>the number of seconds which have passed since startTime.</returns>
+        /// <see cref="Nanos"/>
+        public static double GetSecondsSince( long startTime )
+        {
+            return GetNanosSince( startTime ) / NANOS_PER_SECOND;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>returns the minimum value of many invocations of
+        /// getNanosSince( getStartTime() ).</returns>
+        public static long GetResolution()
+        {
+            long r = long.MaxValue;
+            for ( int i = 0; i < 100000; i++ )
+            {
+                r = Math.Min( r, GetNanosSince( Nanos ) );
+            }
+            return r;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="s">the number of seconds</param>
+        /// <returns>a nice text description of the amount of time</returns>
+        public static String HowLong( int s )
+        {
+            if ( s < 60 )
+                return s.ToString() + "s";
+
+            int m = s / 60;
+            if ( m < 60 )
+                return m.ToString() + "m" + ( s%60 ) + "s";
+
+            int h = m / 60;
+		    if (h < 24)
+                return h.ToString() + "h " + ( m%60 ) + "m";
+
+            int h_ = h / 24;
+            return h_.ToString() + "d " + ( h%24 ) + "h";
+        }
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Timer.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Timer.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TlsConnection.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TlsConnection.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TlsConnection.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TlsConnection.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,198 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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.Net;
+using System.Net.Security;
+using System.Net.Sockets;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    public class TlsConnection : TcpTransport
+    {
+        /// <summary>
+        /// Term on uri which specifies whether server certificate should be authenticated. 
+        /// </summary>
+        public const string AUTH_REQD = "TlsConnection.authReqd";
+
+        /// <summary>
+        /// Term on uri which specifies the certificate name of the server.
+        /// </summary>
+        public const string CERT_NAME = "TlsConnection.certName";
+
+        public TlsConnection(Socket socket, string uri, Resources resources)
+            : this(socket, new URL(uri), resources)
+        {
+            // nothing to do.
+        }
+
+        public TlsConnection(Socket socket, URL uri, Resources resources)
+            : base(uri, resources)
+        {
+            SetCertificateName(uri.GetTerm(CERT_NAME, "default"));
+            SetAuthReqd(uri.GetBooleanTerm(AUTH_REQD, true));
+
+            if (socket == null)
+            {
+                String host = uri.Host;
+                if (host == null)
+                    throw new ArgumentNullException("host == null");
+
+                int? port = uri.Port;
+                if (port == null)
+                    throw new ArgumentNullException("port == null");
+
+                if (port <= 0 || port >= 65536)
+                    throw new ArgumentOutOfRangeException("port <= 0 || port >= 65536");
+
+                this.socket = null;
+                this.host = host;
+                this.port = (int)port;
+            }
+            else
+            {
+                this.socket = socket;
+                this.host = null;
+                this.port = 0;
+            }
+        }
+
+        private readonly String host;
+
+        private readonly int port;
+
+        public override string ToString()
+        {
+            Socket s = socket;
+
+            if (s != null)
+                return String.Format("TlsConnection(up, {0}, {1})",
+                    s.LocalEndPoint, s.RemoteEndPoint);
+
+            return String.Format("TlsConnection(down, {0}, {1})", host, port);
+        }
+
+        protected override bool IsServer()
+        {
+            return host == null;
+        }
+
+        protected override Socket NewSocket()
+        {
+            IPAddress addr;
+
+            if (host != null)
+            {
+                IPAddress[] addrs = Dns.GetHostAddresses(host);
+                if (addrs == null || addrs.Length == 0)
+                    throw new ArgumentException("host is invalid");
+                addr = addrs[0];
+            }
+            else
+            {
+                addr = IPAddress.Any;
+            }
+
+            IPEndPoint ipe = new IPEndPoint(addr, port);
+            Socket socket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
+            socket.Connect(ipe);
+            return socket;
+        }
+
+        protected override void SetUpSocket()
+        {
+            base.SetUpSocket();
+
+            if (IsServer())
+            {
+                stream = new SslStream(stream, false);
+                try
+                {
+                    ((SslStream)stream).AuthenticateAsServer(GetServerCert(certName));
+                }
+                catch (AuthenticationException e)
+                {
+                    //Console.WriteLine(" Exception in authenticating certificate ");
+                    FireException("Certificate Authentication", e);
+                }
+            }
+            else
+            {
+                stream = new SslStream(stream, false,
+                     new RemoteCertificateValidationCallback(ValidateServerCertificate),
+                     null);
+
+                // The server name must match the name on the server certificate.
+
+                try
+                {
+                    ((SslStream)stream).AuthenticateAsClient(certName);
+                }
+                catch (AuthenticationException e)
+                {
+                    AuthenticationException e1 = new AuthenticationException(
+                        "Remote Certificate Mismatch Error. Problem in setting up"
+                        + " SSL Connection. Either disable server authentication by using"
+                        + " term TlsConnection.authReqd=false on uri or provide a valid"
+                        + " certificate name using term TlsConnection.certName=name on uri.", e);
+                    throw e1;
+                }
+            }
+        }
+
+        private void SetCertificateName(string certName)
+        {
+            this.certName = certName;
+        }
+
+        private string certName;
+
+        private void SetAuthReqd(bool authReqd)
+        {
+            this.authReqd = authReqd;
+        }
+
+        private bool authReqd;
+
+        public  bool ValidateServerCertificate(
+           object sender,
+           X509Certificate certificate,
+           X509Chain chain,
+           SslPolicyErrors sslPolicyErrors)
+        {
+            if (!authReqd)
+                return true;
+
+            if (sslPolicyErrors == SslPolicyErrors.None)
+                return true;
+
+            //Console.WriteLine("Certificate error: {0}", sslPolicyErrors);
+
+            // Do not allow this client to communicate with unauthenticated servers.
+            return false;
+        }
+
+        private  X509Certificate GetServerCert(string certName)
+        {
+            X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
+            store.Open(OpenFlags.ReadOnly);
+            X509CertificateCollection coll = store.Certificates.Find(X509FindType.FindBySubjectName, certName, true);
+            return coll[0];
+        }
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TlsConnection.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TlsConnection.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Todo.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Todo.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Todo.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Todo.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,42 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    /// <summary>
+    /// A TODO is used to perform a lightweight action
+    /// </summary>
+    public interface Todo
+    {
+        ///<summary>
+        /// Performs the action
+        /// </summary>
+        /// <param name="mgr">the todo manager where this todo was queued</param>
+        /// Exception:
+        ///     throws Exception
+        ///     
+        void Doit(TodoManager mgr);
+
+        /// <summary>
+        /// Reports an exception that occurred while running the todo.
+        /// </summary>
+        /// <param name="mgr">the todo manager where this todo was queued.</param>
+        /// <param name="e">the exception that the todo threw.</param>
+        void Exception(TodoManager mgr, Exception e);
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Todo.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Todo.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoDelegateImpl.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoDelegateImpl.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoDelegateImpl.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoDelegateImpl.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,72 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    /// <summary>
+    /// This class defines delegate for the methods
+    /// defined in Todo Interface. 
+    /// </summary>
+    public class TodoDelegateImpl : Todo
+    {
+        private DoitDelegate doIt = null;
+        private ExceptionToDoDelegate exc = null;
+
+
+
+        public TodoDelegateImpl(DoitDelegate d, ExceptionToDoDelegate e)
+        {
+            this.doIt = d;
+            this.exc = e;
+        }
+
+        public virtual void Doit(TodoManager mgr)
+        {
+            if (doIt == null)
+                throw new Exception("Doit method not defined");
+
+            doIt(mgr);
+        }
+
+        public virtual void Exception(TodoManager mgr, Exception e)
+        {
+            if (exc == null)
+                throw new Exception("Exception method not defined");
+
+            exc(mgr, e);
+
+        }
+
+
+        /// <summary>
+        /// Performs the action
+        /// </summary>
+        /// <param name="mgr">the todo manager where this todo was queued</param>
+
+        public delegate void DoitDelegate(TodoManager mgr);
+
+        /// <summary>
+        /// Reports an exception that occurred while running the todo.
+        /// </summary>
+        /// <param name="mgr">the todo manager where this todo was queued.</param>
+        /// <param name="e">the exception that the todo threw.</param>
+        /// 
+        public delegate void ExceptionToDoDelegate(TodoManager mgr, Exception e);
+
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoDelegateImpl.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoDelegateImpl.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoManager.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoManager.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoManager.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoManager.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,372 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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.Runtime.CompilerServices;
+using System.Threading;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    /// <summary>
+    /// A standalone version of a processor for todo items
+    /// </summary>
+    public class TodoManager : AbstractStartable
+    {
+        /// <summary>
+        /// Constructs the TodoManager
+        /// </summary>
+        /// <param name="maxEntries">the maximum number of entries in the queue</param>
+        /// <param name="entryDelay">milliseconds to delay a caller who tries to
+        /// add a entry over the limit.</param>
+        /// <param name="minWorkers">the minimum number of workers to keep waiting</param>
+        /// <param name="maxWorkers">the maximum number of workers to allow.</param>
+        /// <param name="workerLinger">milliseconds a worker will wait for a Todo
+        /// before considering quitting.</param>
+        /// <param name="threshold">the per worker threshold for queue length. if
+        /// queue length exceeds this amount, a new worker is added if allowed.</param>
+        /// 
+        public TodoManager( int maxEntries, int entryDelay, int minWorkers,
+            int maxWorkers, int workerLinger, int threshold )
+        {
+            if ( maxEntries < 1 )
+                throw new ArgumentException( "maxEntries < 1" );
+
+            if ( minWorkers < 0 )
+                throw new ArgumentException( "minWorkers < 0" );
+
+            if ( maxWorkers < minWorkers )
+                throw new ArgumentException( "maxWorkers < minWorkers" );
+
+            if ( maxWorkers < 1 )
+                throw new ArgumentException( "maxWorkers < 1" );
+
+            if ( workerLinger < 1 )
+                throw new ArgumentException( "workerLinger < 1" );
+
+            this.maxEntries = maxEntries;
+            this.entryDelay = entryDelay;
+            this.minWorkers = minWorkers;
+            this.maxWorkers = maxWorkers;
+            this.workerLinger = workerLinger;
+            this.threshold = threshold;
+        }
+
+        private int maxEntries;
+    	
+	    private int entryDelay;
+    	
+	    private int minWorkers;
+    	
+	    private int maxWorkers;
+    	
+	    private int workerLinger;
+    	
+	    private int threshold;
+
+        protected override void Start0()
+        {
+            // nothing to do
+        }
+     
+        protected override void Stop0()
+        {
+            lock (this)
+            {
+                Monitor.PulseAll(this);
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="todo"></param>
+        /// Exception:
+        ///     throws ThreadInterruptedException
+        [ MethodImpl ( MethodImplOptions.Synchronized ) ]
+        public void Add( Todo todo )
+        {
+            CheckIsStarted();
+
+            int n = AddEntry( todo );
+            Monitor.Pulse( this );
+
+            ConsiderStartingAWorker( n ) ;
+
+            if ( n > maxEntries )
+                Thread.Sleep( entryDelay );
+        }
+
+        public void Run()
+        {
+            bool needAdjust = true;
+            try
+            {
+                Todo todo;
+                while ( ( todo = GetNextTodo() ) != null )
+                {
+                    try
+                    {
+                        todo.Doit( this );
+                    }
+                    catch ( Exception e )
+                    {
+                        todo.Exception( this, e );
+                    }
+                }
+                needAdjust = false;
+            }
+            finally
+            {
+                if ( needAdjust )
+                    workers.Adjust( -1 );
+            }
+        }
+
+        # region Workers
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>number of workers</returns>
+        public int NumWorkers()
+        {
+            return workers.Get();
+        }
+
+        [MethodImpl( MethodImplOptions.Synchronized )]
+        private void ConsiderStartingAWorker( int qlen )
+        {
+            int n = NumWorkers();
+
+            if ( n >= maxWorkers )
+                return;
+
+            // Start a new worker if there are none or if the 
+            // queue length per worker has exceeded the threshold
+            if ( n == 0 || ( (qlen + n-1) / n ) > threshold )
+                StartAWorker();
+        }
+
+        private void StartAWorker()
+        {
+            workers.Adjust( 1 );
+            Thread t = new Thread(Run);
+            t.Start();
+        }
+
+        private IntCounter workers = new IntCounter();
+
+        # endregion Workers
+
+        # region Queue
+
+        private Entry head;
+        private Entry tail;
+        private IntCounter entries = new IntCounter();
+
+        /// <summary>
+        /// Adds the todo to the tail of the queue.
+        /// </summary>
+        /// <param name="todo">the todo to add.</param>
+        /// <returns>the current queue length.</returns>
+        /// 
+        [MethodImpl( MethodImplOptions.Synchronized )]
+        private int AddEntry( Todo todo )
+        {
+            Entry e = new Entry();
+
+            e.todo = todo;
+
+            if ( tail != null )
+                tail.next = e;
+            else
+                head = e;   // first instance
+
+            tail = e;
+
+            return entries.Adjust( 1 );
+        }
+
+        /// <summary>
+        /// Remove an entry from the queue.
+        /// </summary>
+        /// <returns>a todo from the head of the queue, or 
+        /// null if empty</returns>
+        /// 
+        [MethodImpl( MethodImplOptions.Synchronized )]
+        private Todo RemoveEntry()
+        {
+            if ( head == null )
+                return null;
+
+            Entry e = head;
+            head = e.next;
+
+            if ( head == null )
+                tail = null;
+
+            entries.Adjust( -1 );
+
+            return e.todo;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>number of TODOs</returns>
+        public int NumEntries()
+        {
+            return entries.Get();
+        }
+
+        /// <summary>
+        /// An entry in the todo queue
+        /// </summary>
+        public class Entry
+        {
+            /// <summary>
+            /// The todo to be performed
+            /// </summary>
+            public Todo todo;
+
+            /// <summary>
+            /// The next todo in the queue
+            /// </summary>
+            public Entry next;
+        }
+
+        # endregion Queue
+
+        # region BLAH
+
+        [MethodImpl( MethodImplOptions.Synchronized )]
+        private Todo GetNextTodo()
+        {
+            Todo todo = null;
+            bool lingered = false;
+
+            while ( IsStarted() && ( todo = RemoveEntry() ) == null )
+            {
+                try
+                {
+                    if ( lingered && workers.Get() > minWorkers )
+                    {
+                        workers.Adjust( -1 );
+                        return null;
+                    }
+
+                    Monitor.Wait( this, workerLinger );
+
+                    // we lingered. we might have been woken because
+                    // we're stopping, or a todo might have been
+                    // queued.
+
+                    lingered = true;
+                }
+                catch ( ThreadInterruptedException )
+                {
+                    workers.Adjust( -1 );
+                    return null;
+                }
+            }
+            return todo;
+        }
+
+        # endregion BLAH
+
+        # region Static Stuff
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="todo"></param>
+        /// Exception: 
+        ///     throws Exception
+        ///     
+        public static void AddTodo( Todo todo )
+        {
+            try
+            {
+                GetTodoManager().Add(todo);
+            }
+            catch(Exception e)
+            {
+                todo.Exception(null,e);
+            }
+            
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the configured TodoManager. If there isn't one, it makes
+        /// one with one worker thread.</returns>
+        /// Exception: 
+        ///     if there is a problem creating the TodoManager
+        public static TodoManager GetTodoManager()
+        {
+            if ( todomanager == null )
+            {
+                lock ( lockObject  )
+                {
+                    if ( todomanager == null )
+                    {
+                        todomanager = new TodoManager( 50, 10, 0, 5, 5000, 0 );
+                        todomanager.Start();
+                    }
+                }
+            }
+            return todomanager;
+        }
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="newTodoManager"></param>
+        /// <returns>the old todo manager</returns>
+        /// 
+        [MethodImpl( MethodImplOptions.Synchronized )]
+        public static TodoManager SetTodoManager( TodoManager newTodoManager )
+        {
+            TodoManager oldTodoManager = todomanager;
+            todomanager = newTodoManager;
+            return oldTodoManager;
+        }
+
+        /// <summary>
+        /// Shuts down the currently configured static todo manager if any.
+        /// </summary>
+        /// Exception:
+        ///     throws Exception
+        public static void ShutDown()
+        {
+            TodoManager oldTodoManager = SetTodoManager( null );
+            if ( oldTodoManager != null )
+                oldTodoManager.Stop();
+        }
+
+        private static TodoManager todomanager; 
+
+        /// <summary>
+        /// Since C# doesn't allow locking on an entire class, the substitute 
+        /// here is locking a static variable of the class.
+        /// </summary>
+        private static object lockObject = new Object() ;
+
+        # endregion Static Stuff
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoManager.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TodoManager.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Transport.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Transport.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Transport.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Transport.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,86 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    /// <summary>
+    /// Out-of-band query, control, and notification interface for transports.
+    /// </summary>
+    public interface Transport<S> where S:Session 
+    {
+        /// <summary>
+        /// Gets a configuration or operational value from the transport. The
+        /// request is passed down the chain of transports until some transport
+        /// recognises the query, whereupon it returns the requested value.
+        /// </summary>
+        /// <param name="query">an object representing a query, which could be as
+        /// simple as a string, integer, or enum, or more complex such as
+        /// a class with instance variables for query terms.</param>
+        /// <returns>the requested value, or null if not defined.</returns>
+        /// Exception:
+        ///     throws Exception if the query is not recognised
+        ///     by any transport (which is to say, if the last transport in the transport
+        ///     chain does not recognise it, it should throw this exception). Typically
+        ///     this would be some sort of transport mechanism such as tcp, udp, jms,\
+        ///     http, sip, etc.
+        ///     
+        Object TransportQuery( Object query );
+
+        /// <summary>
+        /// Sets a configuration or operational value in the transport. The
+        /// request is passed down the chain of transports until some transport
+        /// recognises the control, whereupon it stores the specified value
+        /// and returns.
+        /// </summary>
+        /// <param name="control">an object representing a control, which could be as
+        /// simple as a string, integer, or enum, or more complex such as
+        /// a class with instance variables for control terms.</param>
+        /// <param name="value">the value to be set</param>
+        /// Exception:
+        ///     throws ArgumentException if the value is not the right
+        ///     type or if the value is inappropriate.
+        ///     
+        ///     throws Exception if the query is not recognised
+        ///     by any transport (which is to say, if the last transport in the transport
+        ///     chain does not recognise it, it should throw this exception). Typically
+        ///     this would be some sort of transport mechanism such as tcp, udp, jms,\
+        ///     http, sip, etc.
+        ///     
+        void TransportControl( Object control, Object value );
+
+        /// <summary>
+        /// Notifies the chain of transports of the specified event. Unlike query
+        /// and control operations above, events are always passed down to the
+        /// bottom to allow all transports to notice them (though it is possible
+        /// that an event might be delayed for a bit).
+        /// </summary>
+        /// <param name="eventObj">a class which represents the event, possibly with
+        /// parameters. The simplest event could be a string, integer, or enum,
+        /// but any class instance will do (as long as some transport in the
+        /// chain expects it).</param>
+        /// 
+        void TransportNotify( Object eventObj );
+
+
+        void SetSession(S session);
+
+        S GetSession();
+
+        
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Transport.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/Transport.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportConsts.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportConsts.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportConsts.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportConsts.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,109 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    public class TransportConsts
+    {
+        #region Well-known queries, controls, and events.
+
+        /// <summary>
+        /// Name of value factory in resources. The value is "Transport.valueFactory".
+        /// The result of looking up this name should be a {@link ValueFactory} for
+        /// the service.
+        /// </summary>
+        public const String VALUE_FACTORY = "Transport.valueFactory";
+
+        /// <summary>
+        /// Transport control which starts the transport stack. The argument
+        /// should be null
+        /// </summary>
+        public const String START = "START";
+
+        /// <summary>
+        /// Transport control which starts the transport stack and waits
+        /// for it to come up. The argument should be the integer number of
+        /// milliseconds to wait before giving up.
+        /// </summary>
+        public const String START_AND_WAIT_UP = "START_AND_WAIT_UP";
+
+        /// <summary>
+        /// Transport query which waits for the transport stack to come up.
+        /// </summary>
+        public class WaitUp
+        {
+            public readonly int _maxDelay;
+
+            /// <summary>
+            /// 
+            /// </summary>
+            /// <param name="maxDelay">delay in milliseconds</param>
+            public WaitUp( int maxDelay )
+            {
+                _maxDelay = maxDelay;
+            }
+        }
+
+        /// <summary>
+        /// Transport control which stops the transport stack. The argument
+        /// should be null, or a Boolean reset (true for instant close,
+        /// false for a nicer, gentler close).
+        /// </summary>
+        public const String STOP = "STOP";
+
+        /// <summary>
+        /// Transport control which stops the transport stack and waits
+        /// for it to go down. The argument should be the integer number of
+        /// milliseconds to wait before giving up.
+        /// </summary>
+        public const String STOP_AND_WAIT_DOWN = "STOP_AND_WAIT_DOWN";
+
+        /// <summary>
+        /// Transport control which resets the transport stack (e.g., closes the
+        /// socket) without stopping it. If it is set to reconnect, then it will do
+        /// that. Only meaningful for connection oriented transports. Others types
+        /// will ignore this.
+        /// </summary>
+        public const String RESET = "RESET";
+
+        /// <summary>
+        /// Transport query which asks is this a listener initiated connection or
+        /// is this a client initiated connection.
+        /// </summary>
+        public const String IS_SERVER = "IS_SERVER";
+
+        /// <summary>
+        /// Transport query which waits for the transport stack to go down.
+        /// </summary>
+        public class WaitDown
+        {
+            public readonly int _maxDelay;
+
+            /// <summary>
+            /// 
+            /// </summary>
+            /// <param name="maxDelay">delay in milliseconds</param>
+            public WaitDown( int maxDelay )
+            {
+                _maxDelay = maxDelay;
+            }
+        }
+
+        #endregion
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportConsts.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportConsts.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportData.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportData.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportData.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportData.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,24 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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.
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    public interface TransportData : Transport<SessionData>
+    {
+
+        void TransportData(Who recipient, FlexBuffer buf);
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportData.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportData.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportPacket.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportPacket.cs?rev=739432&view=auto
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportPacket.cs (added)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportPacket.cs Fri Jan 30 22:25:03 2009
@@ -0,0 +1,25 @@
+// $Id$
+// 
+// Copyright 2007-2008 Cisco Systems Inc.
+// 
+// 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.
+
+namespace Org.Apache.Etch.Bindings.Csharp.Util
+{
+    public interface TransportPacket : Transport<SessionPacket>
+    {
+
+        int HeaderSize();
+        void TransportPacket(Who recipient, FlexBuffer buf);
+    }
+}

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportPacket.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Util/TransportPacket.cs
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"