Exemplo n.º 1
0
        public void Encapsulate(VpnChannel channel, VpnPacketBufferList packets, VpnPacketBufferList encapulatedPackets)
        {
            try
            {
                uint packetCount = packets.Size;
                var  tun         = context.tun;
                if (tun == null)
                {
                    return;
                }
                while (packetCount-- > 0)
                {
#if YTLOG_VERBOSE
                    LogLine("Encapsulating " + packets.Size.ToString(), channel);
#endif
                    var packet = packets.RemoveAtBegin();
                    tun.PushPacket(packet.Buffer.ToArray());
                    packets.Append(packet);
                }
            }
            catch (Exception ex)
            {
                DebugLogger.Log("Error encapsulating packets: " + ex.ToString());
            }
        }
 public void Encapsulate(VpnChannel channel, VpnPacketBufferList packets, VpnPacketBufferList encapulatedPackets)
 {
     while (packets.Size > 0)
     {
         encapulatedPackets.Append(packets.RemoveAtBegin());
     }
 }
Exemplo n.º 3
0
 public void Encapsulate(VpnChannel channel, VpnPacketBufferList packets, VpnPacketBufferList encapulatedPackets)
 {
     // LogLine("Encapsulating", channel);
     while (packets.Size > 0)
     {
         var packet = packets.RemoveAtBegin();
         encapulatedPackets.Append(packet);
         //LogLine("Encapsulated one packet", channel);
     }
 }
Exemplo n.º 4
0
        public void Encapsulate(VpnChannel channel, VpnPacketBufferList packets, VpnPacketBufferList encapulatedPackets)
        {
            //Debug.WriteLine("Encapsulate++");
            while (packets.Size > 0)
            {
                encapulatedPackets.Append(packets.RemoveAtBegin());
            }

            //Debug.WriteLine("Encapsulate--");
        }
Exemplo n.º 5
0
        public void Encapsulate(VpnChannel channel, VpnPacketBufferList packets, VpnPacketBufferList encapulatedPackets)
        {
            while (packets.Size > 0)
            {
#if YTLOG_VERBOSE
                LogLine("Encapsulating " + packets.Size.ToString(), channel);
#endif
                var packet = packets.RemoveAtBegin();
                encapulatedPackets.Append(packet);
                //LogLine("Encapsulated one packet", channel);
            }
        }
Exemplo n.º 6
0
 public void Encapsulate(VpnChannel channel, VpnPacketBufferList packets, VpnPacketBufferList encapulatedPackets)
 {
     while (packets.Size > 0)
     {
         var packet = packets.RemoveAtBegin();
         if (packet.Buffer.Capacity <= ushort.MaxValue)
         {
             var packetBuffer = packet.Buffer.ToArray();
             packetBuffer.CopyTo(0, packet.Buffer, 0, packetBuffer.Length);
             encapulatedPackets.Append(packet);
         }
     }
 }
Exemplo n.º 7
0
        public void Encapsulate(VpnChannel channel, VpnPacketBufferList packets, VpnPacketBufferList encapulatedPackets)
        {
            var context = channel.PlugInContext as VpnContext;

            // LogLine("Encapsulating", channel);
            while (packets.Size > 0)
            {
                var packet = packets.RemoveAtBegin();
                // encapulatedPackets.Append(packet);
                context.PushPacket(packet.Buffer.ToArray());
                LogLine("Encapsulated one packet" + packet.Buffer.ToArray().Length, channel);
            }
            context.CheckPendingPacket();
        }