private void InitIPPacket(IPVersions version) { ipv4 = null; ipv6 = null; if (version == IPVersions.IPv4) { ipv4 = new IPv4Packet(EthernetHeaderLength, Bytes); _ipPayloadOffset = _ethPayloadOffset + IPv4Fields_Fields.IP_HEADER_LEN; } else if (version == IPVersions.IPv6) { ipv6 = new IPv6Packet(EthernetHeaderLength, Bytes); _ipPayloadOffset = _ethPayloadOffset + IPv6Fields_Fields.IPv6_HEADER_LEN; } else { throw new System.InvalidOperationException("unknown IPVersions version of " + version); } }
private void InitIPPacket(IPVersions version) { ipv4 = null; ipv6 = null; if (version == IPVersions.IPv4) { ipv4 = new IPv4Packet(EthernetHeaderLength, Bytes); _ipOffset = _ethOffset + IPv4Fields_Fields.IP_HEADER_LEN; } else if (version == IPVersions.IPv6) { ipv6 = new IPv6Packet(EthernetHeaderLength, Bytes); _ipOffset = _ethOffset + IPv6Fields_Fields.IPv6_HEADER_LEN; } else { //lame default _ipOffset = _ethOffset; } }