Documentation ¶
Overview ¶
Package slayers contains gopacket style layers for the SCION Header, HopByHop and EndToEnd Extension headers, SCMP, and SCION/UDP.
Basic Decoding ¶
There are multiple ways to decode a SCION packet. If performance is of no concern a new gopacket.Packet can be instantiated:
// Eagerly decode an entire SCION packet packet := gopacket.NewPacket(raw, LayerTypeSCION, gopacket.Default) // Access the SCION header if scnL := packet.Layer(LayerTypeSCION); scnL != nil { fmt.Println("This is a SCION packet.") // Access the actual SCION data from this layer s := scnL.(*slayers.SCION) // Guaranteed to work fmt.Printf("From %s to %s\n", s.SrcIA, s.DstIA) } // Similarly, a SCION/UDP payload can be accessed if udpL := packet.Layer(LayerTypeSCIONUDP); udpL != nil { u := udpL.(*slayers.UDP) // Guaranteed to work fmt.Printf("From %d to %d\n", u.SrcPort, u.DstPort) }
Decoding using gopacket.DecodingLayerParser ¶
Decoding using gopacket.DecodingLayerParser can yield speed ups for more than 10x compared to eager decoding. The following can be used to decode any SCION packet (including HBH and E2E extension) that have either a SCION/UDP or SCMP payload:
var scn slayers.SCION var hbh slayers.HopByHopExtn var e2e slayers.EndToEndExtn var udp slayers.UDP var scmp slayers.SCMP var pld gopacket.Payload parser := gopacket.NewDecodingLayerParser(LayerTypeSCION, &scn, &hbh, &e2e, &udp, &scmp, &pld) decoded := []gopacket.LayerType{} if err := parser.DecodeLayers(packetData, &decoded); err != nil { // Handle error } for _, layerType := range decoded { // Handle layers }
The important thing to note here is that the parser is modifying the passed in layers (scn, hbh, e2e, udp, scmp) instead of allocating new ones, thus greatly speeding up the decoding process. It's even branching based on layer type... it'll handle an (scn, e2e, udp) or (scn, hbh, scmp) stack.
Note: Great care has been taken to only lazily parse the SCION header, however, HBH and E2E extensions are currently eagerly parsed (if they exist). Thus, handling packets containing these extensions will be much slower (see the package benchmarks for reference).
Creating Packet Data ¶
Packet data can be created by instantiating the various slayers.* types. To generate an empty (and useless) SCION(HBH(UDP(Payload))) packet, for example, you can run:
s := &slayers.SCION{} hbh := &slayers.HopByHopExtn{} udp := &slayers.UDP{} pld := gopacket.Payload([]byte{1, 2, 3, 4})) buf := gopacket.NewSerializeBuffer() opts := gopacket.SerializeOptions{} if err := gopacket.SerializeLayers(buf, opts, s, hbh, udp, pld); err != nil { // Handle error } packedData := buf.Bytes()
Index ¶
- Constants
- Variables
- type AddrLen
- type AddrType
- type EndToEndExtn
- func (e *EndToEndExtn) CanDecode() gopacket.LayerClass
- func (e *EndToEndExtn) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (e *EndToEndExtn) LayerPayload() []byte
- func (e *EndToEndExtn) LayerType() gopacket.LayerType
- func (e *EndToEndExtn) NextLayerType() gopacket.LayerType
- func (e *EndToEndExtn) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type EndToEndOption
- type HopByHopExtn
- func (h *HopByHopExtn) CanDecode() gopacket.LayerClass
- func (h *HopByHopExtn) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (h *HopByHopExtn) LayerPayload() []byte
- func (h *HopByHopExtn) LayerType() gopacket.LayerType
- func (h *HopByHopExtn) NextLayerType() gopacket.LayerType
- func (h *HopByHopExtn) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type HopByHopOption
- type OptionType
- type SCION
- func (s *SCION) AddrHdrLen() int
- func (s *SCION) CanDecode() gopacket.LayerClass
- func (s *SCION) DecodeAddrHdr(data []byte) error
- func (s *SCION) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (s *SCION) DstAddr() (net.Addr, error)
- func (s *SCION) LayerPayload() []byte
- func (s *SCION) LayerType() gopacket.LayerType
- func (s *SCION) NetworkFlow() gopacket.Flow
- func (s *SCION) NextLayerType() gopacket.LayerType
- func (s *SCION) SerializeAddrHdr(buf []byte) error
- func (s *SCION) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- func (s *SCION) SetDstAddr(dst net.Addr) error
- func (s *SCION) SetSrcAddr(src net.Addr) error
- func (s *SCION) SrcAddr() (net.Addr, error)
- type SCMP
- func (s *SCMP) CanDecode() gopacket.LayerClass
- func (s *SCMP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (s *SCMP) LayerType() gopacket.LayerType
- func (s *SCMP) NextLayerType() gopacket.LayerType
- func (s *SCMP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- func (s *SCMP) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error
- func (s *SCMP) String() string
- type SCMPCode
- type SCMPDestinationUnreachable
- func (i *SCMPDestinationUnreachable) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (*SCMPDestinationUnreachable) LayerType() gopacket.LayerType
- func (*SCMPDestinationUnreachable) NextLayerType() gopacket.LayerType
- func (i *SCMPDestinationUnreachable) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type SCMPEcho
- type SCMPExternalInterfaceDown
- func (i *SCMPExternalInterfaceDown) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (i *SCMPExternalInterfaceDown) LayerType() gopacket.LayerType
- func (i *SCMPExternalInterfaceDown) NextLayerType() gopacket.LayerType
- func (i *SCMPExternalInterfaceDown) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type SCMPInternalConnectivityDown
- func (i *SCMPInternalConnectivityDown) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (*SCMPInternalConnectivityDown) LayerType() gopacket.LayerType
- func (*SCMPInternalConnectivityDown) NextLayerType() gopacket.LayerType
- func (i *SCMPInternalConnectivityDown) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type SCMPParameterProblem
- func (i *SCMPParameterProblem) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (*SCMPParameterProblem) LayerType() gopacket.LayerType
- func (*SCMPParameterProblem) NextLayerType() gopacket.LayerType
- func (i *SCMPParameterProblem) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type SCMPTraceroute
- func (i *SCMPTraceroute) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (*SCMPTraceroute) LayerType() gopacket.LayerType
- func (*SCMPTraceroute) NextLayerType() gopacket.LayerType
- func (i *SCMPTraceroute) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type SCMPType
- type SCMPTypeCode
- type UDP
Constants ¶
const ( // LineLen is the length of a SCION header line in bytes. LineLen = 4 // CmnHdrLen is the length of the SCION common header in bytes. CmnHdrLen = 12 // SCIONVersion is the currently supported version of the SCION header format. Different // versions are not guaranteed to be compatible to each other. SCIONVersion = 0 )
const MaxSCMPPacketLen = 1232
MaxSCMPPacketLen the maximum length a SCION packet including SCMP quote can have. This length includes the SCION, and SCMP header of the packet.
+-------------------------+ | Underlay | +-------------------------+ | SCION | \ | SCMP | \ +-------------------------+ \_ MaxSCMPPacketLen | Quote: | / | SCION Orig | / | L4 Orig | / +-------------------------+
Variables ¶
var ( LayerTypeSCION = gopacket.RegisterLayerType( 1000, gopacket.LayerTypeMetadata{ Name: "SCION", Decoder: gopacket.DecodeFunc(decodeSCION), }, ) LayerTypeSCIONUDP = gopacket.RegisterLayerType( 1001, gopacket.LayerTypeMetadata{ Name: "SCION/UDP", Decoder: gopacket.DecodeFunc(decodeSCIONUDP), }, ) LayerTypeSCMP = gopacket.RegisterLayerType( 1002, gopacket.LayerTypeMetadata{ Name: "SCMP", Decoder: gopacket.DecodeFunc(decodeSCMP), }, ) LayerTypeSCMPDummy = gopacket.RegisterLayerType( 2002, gopacket.LayerTypeMetadata{ Name: "SCMPDummy", Decoder: gopacket.DecodeFunc(decodeSCMP), }, ) LayerTypeHopByHopExtn gopacket.LayerType LayerTypeEndToEndExtn gopacket.LayerType LayerTypeSCMPExternalInterfaceDown = gopacket.RegisterLayerType( 1005, gopacket.LayerTypeMetadata{ Name: "SCMPExternalInterfaceDown", Decoder: gopacket.DecodeFunc(decodeSCMPExternalInterfaceDown), }, ) LayerTypeSCMPInternalConnectivityDown = gopacket.RegisterLayerType( 1006, gopacket.LayerTypeMetadata{ Name: "SCMPInternalConnectivityDown", Decoder: gopacket.DecodeFunc(decodeSCMPInternalConnectivityDown), }, ) LayerTypeSCMPParameterProblem = gopacket.RegisterLayerType( 1007, gopacket.LayerTypeMetadata{ Name: "SCMPParameterProblem", Decoder: gopacket.DecodeFunc(decodeSCMPParameterProblem), }, ) LayerTypeSCMPDestinationUnreachable = gopacket.RegisterLayerType( 1008, gopacket.LayerTypeMetadata{ Name: "SCMPDestinationUnreachable", Decoder: gopacket.DecodeFunc(decodeSCMPDestinationUnreachable), }, ) LayerTypeSCMPEcho = gopacket.RegisterLayerType( 1128, gopacket.LayerTypeMetadata{ Name: "SCMPEcho", Decoder: gopacket.DecodeFunc(decodeSCMPEcho), }, ) LayerTypeSCMPTraceroute = gopacket.RegisterLayerType( 1130, gopacket.LayerTypeMetadata{ Name: "SCMPTraceroute", Decoder: gopacket.DecodeFunc(decodeSCMPTraceroute), }, ) )
Functions ¶
This section is empty.
Types ¶
type AddrLen ¶
type AddrLen uint8
AddrLen indicates the length of a host address in the SCION header. The four possible lengths are 4, 8, 12, or 16 bytes.
type AddrType ¶
type AddrType uint8
AddrType indicates the type of a host address of a given length in the SCION header. There are four possible types per address length.
type EndToEndExtn ¶
type EndToEndExtn struct { Options []*EndToEndOption // contains filtered or unexported fields }
EndToEndExtn is the SCION end-to-end options extension.
func (*EndToEndExtn) CanDecode ¶
func (e *EndToEndExtn) CanDecode() gopacket.LayerClass
func (*EndToEndExtn) DecodeFromBytes ¶
func (e *EndToEndExtn) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes implementation according to gopacket.DecodingLayer
func (*EndToEndExtn) LayerPayload ¶
func (e *EndToEndExtn) LayerPayload() []byte
func (*EndToEndExtn) LayerType ¶
func (e *EndToEndExtn) LayerType() gopacket.LayerType
func (*EndToEndExtn) NextLayerType ¶
func (e *EndToEndExtn) NextLayerType() gopacket.LayerType
func (*EndToEndExtn) SerializeTo ¶
func (e *EndToEndExtn) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo implementation according to gopacket.SerializableLayer
type EndToEndOption ¶
type EndToEndOption tlvOption
EndToEndOption is a TLV option present in a SCION end-to-end extension.
type HopByHopExtn ¶
type HopByHopExtn struct { Options []*HopByHopOption // contains filtered or unexported fields }
HopByHopExtn is the SCION hop-by-hop options extension.
func (*HopByHopExtn) CanDecode ¶
func (h *HopByHopExtn) CanDecode() gopacket.LayerClass
func (*HopByHopExtn) DecodeFromBytes ¶
func (h *HopByHopExtn) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes implementation according to gopacket.DecodingLayer
func (*HopByHopExtn) LayerPayload ¶
func (h *HopByHopExtn) LayerPayload() []byte
func (*HopByHopExtn) LayerType ¶
func (h *HopByHopExtn) LayerType() gopacket.LayerType
func (*HopByHopExtn) NextLayerType ¶
func (h *HopByHopExtn) NextLayerType() gopacket.LayerType
func (*HopByHopExtn) SerializeTo ¶
func (h *HopByHopExtn) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo implementation according to gopacket.SerializableLayer
type HopByHopOption ¶
type HopByHopOption tlvOption
HopByHopOption is a TLV option present in a SCION hop-by-hop extension.
type OptionType ¶
type OptionType uint8
OptionType indicates the type of a TLV Option that is part of an extension header.
const ( OptTypePad1 OptionType = iota OptTypePadN )
Definition of option type constants.
type SCION ¶
type SCION struct { layers.BaseLayer // Version is version of the SCION Header. Currently, only 0 is supported. Version uint8 // TrafficClass denotes the traffic class. Its value in a received packet or fragment might be // different from the value sent by the packet’s source. The current use of the Traffic Class // field for Differentiated Services and Explicit Congestion Notification is specified in // RFC2474 and RFC3168 TrafficClass uint8 // FlowID is a 20-bit field used by a source to label sequences of packets to be treated in the // network as a single flow. It is mandatory to be set. FlowID uint32 // NextHdr encodes the type of the first header after the SCION header. This can be either a // SCION extension or a layer-4 protocol such as TCP or UDP. Values of this field respect and // extend IANA’s assigned internet protocol numbers. NextHdr common.L4ProtocolType // HdrLen is the length of the SCION header in multiples of 4 bytes. The SCION header length is // computed as HdrLen * 4 bytes. The 8 bits of the HdrLen field limit the SCION header to a // maximum of 1024 bytes. HdrLen uint8 // PayloadLen is the length of the payload in bytes. The payload includes extension headers and // the L4 payload. This field is 16 bits long, supporting a maximum payload size of 64KB. PayloadLen uint16 // PathType specifies the type of path in this SCION header. PathType path.Type // DstAddrType (2 bit) is the type of the destination address. DstAddrType AddrType // DstAddrLen (2 bit) is the length of the destination address. Supported address length are 4B // (0), 8B (1), 12B (2), and 16B (3). DstAddrLen AddrLen // SrcAddrType (2 bit) is the type of the source address. SrcAddrType AddrType // SrcAddrLen (2 bit) is the length of the source address. Supported address length are 4B (0), // 8B (1), 12B (2), and 16B (3). SrcAddrLen AddrLen // DstIA is the destination ISD-AS. DstIA addr.IA // SrcIA is the source ISD-AS. SrcIA addr.IA // RawDstAddr is the destination address. RawDstAddr []byte // RawSrcAddr is the source address. RawSrcAddr []byte // Path is the path contained in the SCION header. It depends on the PathType field. Path path.Path }
SCION is the header of a SCION packet.
func (*SCION) AddrHdrLen ¶
AddrHdrLen returns the length of the address header (destination and source ISD-AS-Host triples) in bytes.
func (*SCION) CanDecode ¶
func (s *SCION) CanDecode() gopacket.LayerClass
func (*SCION) DecodeAddrHdr ¶
DecodeAddrHdr decodes the destination and source ISD-AS-Host address triples from the provided buffer. The caller must ensure that the correct address types and lengths are set in the SCION layer, otherwise the results of this method are undefined.
func (*SCION) DecodeFromBytes ¶
func (s *SCION) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the SCION layer. DecodeFromBytes resets the internal state of this layer to the state defined by the passed-in bytes. Slices in the SCION layer reference the passed-in data, so care should be taken to copy it first should later modification of data be required before the SCION layer is discarded.
func (*SCION) DstAddr ¶
DstAddr parses the destination address into a net.Addr. The returned net.Addr references data from the underlaying layer data. Changing the net.Addr object might lead to inconsistent layer information and thus should be treated read-only. Instead, SetDstAddr should be used to update the destination address.
func (*SCION) LayerPayload ¶
func (*SCION) NetworkFlow ¶
func (*SCION) NextLayerType ¶
func (*SCION) SerializeAddrHdr ¶
SerializeAddrHdr serializes destination and source ISD-AS-Host address triples into the provided buffer. The caller must ensure that the correct address types and lengths are set in the SCION layer, otherwise the results of this method are undefined.
func (*SCION) SerializeTo ¶
func (s *SCION) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
func (*SCION) SetDstAddr ¶
SetDstAddr sets the destination address and updates the DstAddrLen/Type fields accordingly. SetDstAddr takes ownership of dst and callers should not write to it after calling SetDstAddr. Changes to dst might leave the layer in an inconsistent state.
func (*SCION) SetSrcAddr ¶
SetSrcAddr sets the source address and updates the DstAddrLen/Type fields accordingly. SetSrcAddr takes ownership of src and callers should not write to it after calling SetSrcAddr. Changes to src might leave the layer in an inconsistent state.
func (*SCION) SrcAddr ¶
SrcAddr parses the source address into a net.Addr. The returned net.Addr references data from the underlaying layer data. Changing the net.Addr object might lead to inconsistent layer information and thus should be treated read-only. Instead, SetDstAddr should be used to update the source address.
type SCMP ¶
type SCMP struct { layers.BaseLayer TypeCode SCMPTypeCode Checksum uint16 // contains filtered or unexported fields }
SCMP is the SCMP header on top of SCION header.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | InfoBlock | + + | (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DataBlock | + + | (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func (*SCMP) CanDecode ¶
func (s *SCMP) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*SCMP) DecodeFromBytes ¶
func (s *SCMP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*SCMP) NextLayerType ¶
NextLayerType use the typecode to select the right next decoder. If the SCMP type is unknown, the next layer is gopacket.LayerTypePayload.
func (*SCMP) SerializeTo ¶
func (s *SCMP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
func (*SCMP) SetNetworkLayerForChecksum ¶
func (s *SCMP) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error
SetNetworkLayerForChecksum tells this layer which network layer is wrapping it. This is needed for computing the checksum when serializing,
type SCMPCode ¶
type SCMPCode uint8
SCMPCode is the code of the SCMP type code.
const ( SCMPCodeNoRoute SCMPCode = 0 SCMPCodeAdminDeny SCMPCode = 1 SCMPCodeBeyondScopeOfSourceAddr SCMPCode = 2 SCMPCodeAddressUnreachable SCMPCode = 3 SCMPCodePortUnreachable SCMPCode = 4 SCMPCodeSourceAddressFailedPolicy SCMPCode = 5 SCMPCodeRejectRouteToDest SCMPCode = 6 )
Destination unreachable codes
const ( SCMPCodeErroneousHeaderField SCMPCode = 0 SCMPCodeUnknownNextHdrType SCMPCode = 1 SCMPCodeInvalidCommonHeader SCMPCode = 16 SCMPCodeUnknownSCIONVersion SCMPCode = 17 SCMPCodeFlowIDRequired SCMPCode = 18 SCMPCodeInvalidPacketSize SCMPCode = 19 SCMPCodeUnknownPathType SCMPCode = 20 SCMPCodeUnknownAddressFormat SCMPCode = 21 SCMPCodeInvalidAddressHeader SCMPCode = 32 SCMPCodeInvalidSourceAddress SCMPCode = 33 SCMPCodeInvalidDestinationAddress SCMPCode = 34 SCMPCodeNonLocalDelivery SCMPCode = 35 SCMPCodeInvalidPath SCMPCode = 48 SCMPCodeUnknownHopFieldIngress SCMPCode = 49 SCMPCodeUnknownHopFieldEgress SCMPCode = 50 SCMPCodeInvalidHopFieldMAC SCMPCode = 51 SCMPCodePathExpired SCMPCode = 52 SCMPCodeInvalidSegmentChange SCMPCode = 53 SCMPCodeInvalidExtensionHeader SCMPCode = 64 SCMPCodeUnknownHopByHopOption SCMPCode = 65 SCMPCodeUnknownEndToEndOption SCMPCode = 66 )
ParameterProblem
type SCMPDestinationUnreachable ¶
SCMPDestinationUnreachable represents the structure of a destination unreachable message.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func (*SCMPDestinationUnreachable) DecodeFromBytes ¶
func (i *SCMPDestinationUnreachable) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*SCMPDestinationUnreachable) LayerType ¶
func (*SCMPDestinationUnreachable) LayerType() gopacket.LayerType
LayerType returns LayerTypeSCMPTraceroute.
func (*SCMPDestinationUnreachable) NextLayerType ¶
func (*SCMPDestinationUnreachable) NextLayerType() gopacket.LayerType
NextLayerType returns the layer type contained by this DecodingLayer.
func (*SCMPDestinationUnreachable) SerializeTo ¶
func (i *SCMPDestinationUnreachable) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
type SCMPEcho ¶
SCMPEcho represents the structure of a ping.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identifier | Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func (*SCMPEcho) DecodeFromBytes ¶
func (i *SCMPEcho) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*SCMPEcho) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
func (*SCMPEcho) SerializeTo ¶
func (i *SCMPEcho) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
type SCMPExternalInterfaceDown ¶
SCMPExternalInterfaceDown message contains the data for that error.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ISD | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ AS + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Interface ID + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func (*SCMPExternalInterfaceDown) DecodeFromBytes ¶
func (i *SCMPExternalInterfaceDown) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*SCMPExternalInterfaceDown) LayerType ¶
func (i *SCMPExternalInterfaceDown) LayerType() gopacket.LayerType
LayerType returns LayerTypeSCMPExternalInterfaceDown.
func (*SCMPExternalInterfaceDown) NextLayerType ¶
func (i *SCMPExternalInterfaceDown) NextLayerType() gopacket.LayerType
NextLayerType returns the layer type contained by this DecodingLayer.
func (*SCMPExternalInterfaceDown) SerializeTo ¶
func (i *SCMPExternalInterfaceDown) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
type SCMPInternalConnectivityDown ¶
type SCMPInternalConnectivityDown struct { layers.BaseLayer IA addr.IA Ingress uint64 Egress uint64 }
SCMPInternalConnectivityDown indicates the AS internal connection between 2 routers is down. The format is as follows:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ISD | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ AS + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Ingress Interface ID + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Egress Interface ID + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func (*SCMPInternalConnectivityDown) DecodeFromBytes ¶
func (i *SCMPInternalConnectivityDown) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*SCMPInternalConnectivityDown) LayerType ¶
func (*SCMPInternalConnectivityDown) LayerType() gopacket.LayerType
LayerType returns LayerTypeSCMPInternalConnectivityDown.
func (*SCMPInternalConnectivityDown) NextLayerType ¶
func (*SCMPInternalConnectivityDown) NextLayerType() gopacket.LayerType
NextLayerType returns the layer type contained by this DecodingLayer.
func (*SCMPInternalConnectivityDown) SerializeTo ¶
func (i *SCMPInternalConnectivityDown) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
type SCMPParameterProblem ¶
SCMPParameterProblem represents the structure of a parameter problem message.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | reserved | Pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func (*SCMPParameterProblem) DecodeFromBytes ¶
func (i *SCMPParameterProblem) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*SCMPParameterProblem) LayerType ¶
func (*SCMPParameterProblem) LayerType() gopacket.LayerType
LayerType returns LayerTypeSCMPParameterProblem.
func (*SCMPParameterProblem) NextLayerType ¶
func (*SCMPParameterProblem) NextLayerType() gopacket.LayerType
NextLayerType returns the layer type contained by this DecodingLayer.
func (*SCMPParameterProblem) SerializeTo ¶
func (i *SCMPParameterProblem) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
type SCMPTraceroute ¶
type SCMPTraceroute struct { layers.BaseLayer Identifier uint16 Sequence uint16 IA addr.IA Interface uint64 }
SCMPTraceroute represents the structure of a traceroute.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identifier | Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ISD | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ AS + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Interface ID + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func (*SCMPTraceroute) DecodeFromBytes ¶
func (i *SCMPTraceroute) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*SCMPTraceroute) LayerType ¶
func (*SCMPTraceroute) LayerType() gopacket.LayerType
LayerType returns LayerTypeSCMPTraceroute.
func (*SCMPTraceroute) NextLayerType ¶
func (*SCMPTraceroute) NextLayerType() gopacket.LayerType
NextLayerType returns the layer type contained by this DecodingLayer.
func (*SCMPTraceroute) SerializeTo ¶
func (i *SCMPTraceroute) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
type SCMPType ¶
type SCMPType uint8
SCMPType is the type of the SCMP type code.
type SCMPTypeCode ¶
type SCMPTypeCode uint16
SCMPTypeCode represents SCMP type/code case.
func CreateSCMPTypeCode ¶
func CreateSCMPTypeCode(typ SCMPType, code SCMPCode) SCMPTypeCode
CreateSCMPTypeCode is a convenience function to create an SCMPTypeCode
func (SCMPTypeCode) InfoMsg ¶
func (a SCMPTypeCode) InfoMsg() bool
InfoMsg indicates if the SCMP message is an SCMP informational message.
func (SCMPTypeCode) SerializeTo ¶
func (a SCMPTypeCode) SerializeTo(bytes []byte)
SerializeTo writes the SCMPTypeCode value to the buffer.
func (SCMPTypeCode) String ¶
func (a SCMPTypeCode) String() string
type UDP ¶
UDP is the SCION/UDP header. It reuses layers.UDP as much as possible and only customizes checksum calculation.
func (*UDP) CanDecode ¶
func (u *UDP) CanDecode() gopacket.LayerClass
func (*UDP) SerializeTo ¶
func (u *UDP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
func (*UDP) SetNetworkLayerForChecksum ¶
func (u *UDP) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error