예제 #1
0
        /// <summary>
        /// Sends a single Ack out.
        /// </summary>
        /// <param name="seq">Seq.</param>
        private void SendAck(UInt32 seq)
        {
            EncryptedPacket p = new EncryptedPacket(this.ID, 0);

            p.Ack = seq;
            //How should we handle ack packets? Should we add them to the Ack queue?
            p.Nonce = GetNextNonce();
            p.Seq   = this.GetNextSeq();
            p.EncryptPacket(mKeyPair.PrivateKey, recipentEPK);
            this.congestionController.SendAck(p);
        }
예제 #2
0
 /// <summary>
 /// Takes a GenericPacket, encrypts it and sends it down the pipe with the right Nonce, Seq and Encryption
 /// </summary>
 /// <param name="p"></param>
 public override void EncryptAndSendPacket(EncryptedPacket p)
 {
     if (this.State == TunnelState.WaitingForHelloResponse)
     {
         //we need to enqueue the GenericPacket until we're ready to send
         this.bufferedEncryptedPackets.Enqueue(p);
     }
     else
     {
         p.Nonce = GetNextNonce();
         p.Seq   = this.GetNextSeq();
         p.EncryptPacket(mKeyPair.PrivateKey, recipentEPK);
         SendPacket(p);
     }
 }