示例#1
0
        /// <summary>Create a DtlsFilter.</summary>
        /// <param name="key">A CryptoKey initialized by the OpenSSL.NET library.</param>
        /// <param name="cert">The path to the certificate to use.</param>
        /// <param name="ca_cert">The path to the ca certificate to use.</param>
        /// <param name="client">Use client initialization parameters.</param>
        public DtlsAssociation(ISender sender, CertificateHandler ch, PType ptype,
                               Ssl ssl, bool client) : base(sender, ch)
        {
            _ip     = new IdentifierPair();
            PType   = ptype;
            _ssl    = ssl;
            _client = client;
            _ssl.SetReadAhead(1);
            // Buggy SSL versions have issue with compression and dtls
            _ssl.SetOptions((int)SslOptions.SSL_OP_NO_COMPRESSION);
            if (client)
            {
                _ssl.SetConnectState();
            }
            else
            {
                _ssl.SetAcceptState();
            }

            // The ssl object will take control
            _read              = BIO.MemoryBuffer(false);
            _read.NonBlocking  = true;
            _write             = BIO.MemoryBuffer(false);
            _write.NonBlocking = true;

            _ssl.SetBIO(_read, _write);
            _ssl.DoHandshake();

            _buffer      = new byte[Int16.MaxValue];
            _buffer_sync = new object();
            _fe_lock     = 0;
        }
示例#2
0
 /// <summary>Create a XmppEdge.</summary>
 public XmppEdge(IEdgeSendHandler send_handler, XmppTransportAddress local_ta,
                 XmppTransportAddress remote_ta, bool inbound) :
     base(send_handler, inbound)
 {
     _ip        = new IdentifierPair();
     _local_ta  = local_ta;
     _remote_ta = remote_ta;
     To         = remote_ta.JID;
 }
示例#3
0
 /// <summary>Constructor for an outgoing edge, since we don't know the remote
 /// id yet, it must be outgoing!</summary>
 public SubringEdge(TransportAddress local_ta, TransportAddress remote_ta,
                    bool inbound, ISender sender, PType ptype) :
     base(null, inbound)
 {
     _ip             = new IdentifierPair();
     _local_ta       = local_ta;
     _remote_ta      = remote_ta;
     _ptype          = ptype;
     _overlay_sender = sender;
 }