Example #1
0
                }                               // out

                public TopPipe_Args(Parsed_packet headers, core.error parseError, InControl inCtrl, OutControl outCtrl)
                {
                    this.headers    = headers;
                    this.parseError = parseError;
                    this.inCtrl     = inCtrl;
                    this.outCtrl    = outCtrl;
                }
Example #2
0
            public void apply(ref Parsed_packet headers,
                              core.error parseError, // parser error
                              InControl inCtrl,      // input port
                              out OutControl outCtrl)
            {
                outCtrl = new OutControl(); // NOTE instantiate all out params to satisfy csc
                TopPipe_Args args = new TopPipe_Args(headers, parseError, inCtrl, outCtrl);

                IPv4Address nextHop = new IPv4Address(); // Have to instantiate ref params, more compact than using out params and instantiating at bottom

                if (parseError != error.NoError)
                {
                    Drop_action(args);
                    return;
                }

                ipv4_match.apply(args, ref nextHop);
                if (args.outCtrl.outputPort == DROP_PORT)
                {
                    return;
                }

                check_ttl.apply(args);
                if (args.outCtrl.outputPort == CPU_OUT_PORT)
                {
                    return;
                }

                dmac.apply(args, nextHop);
                if (args.outCtrl.outputPort == DROP_PORT)
                {
                    return;
                }

                smac.apply(args);

                // Copy params back out
                headers = args.headers;
                outCtrl = args.outCtrl;
            }