Exemplo n.º 1
0
        public OfpFlowMod(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            //var pos = stream.Position;
            Match = new OfpMatch(stream);
            //pos = stream.Position;
            br.Parse(out Cookie);
            br.Parse(out Command);
            br.Parse(out IdleTimeout);
            br.Parse(out HardTimeout);
            br.Parse(out Priority);
            br.Parse(out BufferId);
            br.Parse(out OutPort); //FIXED:
            br.Parse(out Flags);
            //pos = stream.Position;
            IOfpAction action = OfpActionHeader.ParseAction(stream);

            while (action != null)
            {
                Actions[action.Header.Type] = action;
                action = OfpActionHeader.ParseAction(stream);
            }
        }
Exemplo n.º 2
0
        public OfpPortStatsRequest(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            br.Parse(out PortNo);
            br.ReadBytes(6);
        }
Exemplo n.º 3
0
        public OfpPacketOut(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out BufferId);
            br.Parse(out InPort);
            br.Parse(out ActionsLen);

            int length = ActionsLen;

            while (length >= 8)
            {
                var action = OfpActionHeader.ParseAction(stream);
                Actions[action.Header.Type] = action;
                length -= action.Header.Len;
            }

            if (BufferId == uint.MaxValue) //-1
            {
                length = Header.Length - (int)Size - ActionsLen;
                if (length > 0)
                {
                    br.Parse(out Data, length);
                }
            }
        }
Exemplo n.º 4
0
        public OfpQueueGetConfigRequest(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out Port);
            br.ReadBytes(2);
        }
Exemplo n.º 5
0
        public OfpSwitchConfig(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out Flags);
            br.Parse(out MissSendLen);
        }
Exemplo n.º 6
0
        public OfpAggregateStatsRequest(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Match = new OfpMatch(stream);
            br.Parse(out TableId);
            br.ReadBytes(1);
            br.Parse(out OutPort);
        }
Exemplo n.º 7
0
        public OfpStatsReply(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out Type);
            br.Parse(out Flags);
            br.Parse(out Body, (int)(Header.Length - Size));
        }
Exemplo n.º 8
0
        public OfpPortStatus(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out Reason);
            br.ReadBytes(7);
            Desc = new OfpPhyPort(stream);
        }
Exemplo n.º 9
0
        public OfpErrorMsg(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out Type);
            br.Parse(out Code);
            int length = (int)(Header.Length - Size);

            br.Parse(out Data, length);
        }
Exemplo n.º 10
0
        public OfpEcho(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            var length = Header.Length - Size;

            if (length > 0)
            {
                Data = br.ReadBytes((int)length);
            }
        }
Exemplo n.º 11
0
        public OfpQueueGetConfig(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out Port);
            br.ReadBytes(6); //PAD 6
            var count = (Header.Length - Size) / OfpPacketQueue.Size;

            for (int i = 0; i < count; i++)
            {
                Queues.Add(new OfpPacketQueue(stream));
            }
        }
Exemplo n.º 12
0
        public OfpPacketIn(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out BufferId);
            br.Parse(out TotalLen);
            br.Parse(out InPort);
            br.Parse(out Reason);
            br.ReadBytes(1);
            int length = (int)(Header.Length - Size + 2); //FIXED:

            Data = br.ReadBytes(length);
        }
Exemplo n.º 13
0
        public OfpFlowRemoved(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            Match  = new OfpMatch(stream);
            br.Parse(out Cookie);
            br.Parse(out Priority);
            br.Parse(out Reason);
            br.ReadBytes(1);
            br.Parse(out DurationSec);
            br.Parse(out DurationNsec);
            br.Parse(out IdleTimeout);
            br.ReadBytes(2);
            br.Parse(out PacketCount);
            br.Parse(out ByteCount);
        }
Exemplo n.º 14
0
        public OfpSwitchFeatures(Stream stream, OfpHeader header = null)
        {
            BeBinaryReader br = new BeBinaryReader(stream, Encoding.ASCII, true);

            Header = header ?? new OfpHeader(stream);
            br.Parse(out DatapathId);
            br.Parse(out NBuffers);
            br.Parse(out NTables);
            br.ReadBytes(3); //PAD 3
            br.Parse(out Capabilities);
            br.Parse(out Actions);
            var portCount = (Header.Length - Size) / OfpPhyPort.Size;

            for (int i = 0; i < portCount; i++)
            {
                OfpPhyPort port = new OfpPhyPort(stream);
                Ports.Add(port);
            }
        }
Exemplo n.º 15
0
 public OfpBarrier(OfpHeader header)
 {
     Header = header;
 }