Example #1
0
 public NetworkPoolDecrypt(NetworkPoolListener listener, long identifier, NetworkIncomingBuffer buffer, NetworkIncomingMessageHandler handler, int count)
 {
     this.listener   = listener;
     this.identifier = identifier;
     this.buffer     = buffer;
     this.handler    = handler;
     this.count      = count;
 }
Example #2
0
        /// <summary>
        /// Creates a new instance of the network connection from the existing
        /// instance. The inner socket and direction will copied, but the caller
        /// can decide how the encryption and decryption will work.
        /// </summary>
        /// <param name="connection">The existing instance of the connection.</param>
        /// <param name="configurer">The new configuration.</param>
        public NetworkPoolConnection(NetworkPoolConnection connection, NetworkConfiguration configurer)
        {
            listener   = connection.listener;
            socket     = connection.socket;
            remote     = connection.remote;
            direction  = connection.direction;
            identifier = connection.identifier;

            incoming = new NetworkIncomingBuffer(connection.incoming, configurer.Decryptor);
            outgoing = new NetworkOutgoingBuffer(connection.outgoing, configurer.Encryptor);
        }
Example #3
0
        /// <summary>
        /// Creates a new instance of the network connection relying on the
        /// already connected socket instance and direction value indicating
        /// who is the initiator of the connection.
        /// </summary>
        /// <param name="listener"></param>
        /// <param name="socket">The already connected socket.</param>
        /// <param name="direction">The direction indicating who initiated the connection.</param>
        /// <param name="identifier"></param>
        public NetworkPoolConnection(NetworkPoolListener listener, TcpSocket socket, NetworkDirection direction, long identifier, IPEndPoint remote)
        {
            this.listener   = listener;
            this.socket     = socket;
            this.direction  = direction;
            this.identifier = identifier;

            this.remote = NetworkAddress.Parse(remote);

            incoming = new NetworkIncomingBuffer(listener, socket, identifier);
            outgoing = new NetworkOutgoingBuffer(listener, socket, identifier);
        }
Example #4
0
        /// <summary>
        /// Creates a new instance of the network incoming buffer from the existing instance.
        /// The inner socket and the already downloaded and waiting data will be
        /// copied, but the caller can change the decryption algorithm.
        /// </summary>
        /// <param name="buffer">The existing instance of the newtwork buffer.</param>
        /// <param name="decryptor">The new decryptor.</param>
        public NetworkIncomingBuffer(NetworkIncomingBuffer buffer, NetworkIncomingDecryptor decryptor)
        {
            this.decryptor = decryptor;

            listener   = buffer.listener;
            socket     = buffer.socket;
            identifier = buffer.identifier;
            memory     = buffer.memory;
            length     = buffer.length;
            offset     = buffer.offset;

            Decrypt(offset, length);
        }
 public NetworkIncomingBufferMessage(NetworkIncomingBuffer buffer)
 {
     this.buffer = buffer;
     this.view   = buffer.View();
 }