void parse_ipv4(packet_in b, Parsed_packet p) { b.extract <Ipv4_h>(out p.ip); vss_model.VSSModel.verify((p.ip.version == 4), error.IPv4IncorrectVersion); vss_model.VSSModel.verify((p.ip.ihl == 5), error.IPv4OptionsNotSupported); ck.clear(); ck.update <Ipv4_h>(p.ip); vss_model.VSSModel.verify((ck.get() == 0), error.IPv4ChecksumError); accept(b, p); }
private void parse_ipv4(packet_in b, Parsed_packet p) { b.extract(out p.ip); verify.apply(p.ip.version == (bit4)4, new IPv4IncorrectVersion()); // FIXME how are we handling errors? D: NOTE P4 gives it as error.IPV4IncorrectVersion verify.apply(p.ip.ihl == (bit4)5, new IPv4OptionsNotSupported()); ck.clear(); ck.update(p.ip); verify.apply(ck.get() == (bit16)0, new IPv4ChecksumError()); // transition accept }
public void apply(ref Parsed_packet p, packet_out b) { b.emit(p.ethernet); if (p.ip.isValid()) { ck.clear(); p.ip.hdrChecksum = (bit16)0; ck.update(p.ip); p.ip.hdrChecksum = ck.get(); } b.emit(p.ip); }