MCPcopy
hub / github.com/google/gopacket / SerializableLayer

Interface SerializableLayer

writer.go:17–41  ·  view source on GitHub ↗

SerializableLayer allows its implementations to be written out as a set of bytes, so those bytes may be sent on the wire or otherwise used by the caller. SerializableLayer is implemented by certain Layer types, and can be encoded to bytes using the LayerWriter object.

Source from the content-addressed store, hash-verified

15// SerializableLayer is implemented by certain Layer types, and can be encoded to
16// bytes using the LayerWriter object.
17type SerializableLayer interface {
18 // SerializeTo writes this layer to a slice, growing that slice if necessary
19 // to make it fit the layer's data.
20 // Args:
21 // b: SerializeBuffer to write this layer on to. When called, b.Bytes()
22 // is the payload this layer should wrap, if any. Note that this
23 // layer can either prepend itself (common), append itself
24 // (uncommon), or both (sometimes padding or footers are required at
25 // the end of packet data). It's also possible (though probably very
26 // rarely needed) to overwrite any bytes in the current payload.
27 // After this call, b.Bytes() should return the byte encoding of
28 // this layer wrapping the original b.Bytes() payload.
29 // opts: options to use while writing out data.
30 // Returns:
31 // error if a problem was encountered during encoding. If an error is
32 // returned, the bytes in data should be considered invalidated, and
33 // not used.
34 //
35 // SerializeTo calls SHOULD entirely ignore LayerContents and
36 // LayerPayload. It just serializes based on struct fields, neither
37 // modifying nor using contents/payload.
38 SerializeTo(b SerializeBuffer, opts SerializeOptions) error
39 // LayerType returns the type of the layer that is being serialized to the buffer
40 LayerType() LayerType
41}
42
43// SerializeOptions provides options for behaviors that SerializableLayers may want to
44// implement.

Callers 10

SerializeLayersFunction · 0.65
serializeASFFunction · 0.65
SerializeToMethod · 0.65
SerializeToMethod · 0.65
SerializeToMethod · 0.65
SerializeToMethod · 0.65
SerializeToMethod · 0.65
serializeFunction · 0.65
SerializeLayersFunction · 0.65
SerializePacketFunction · 0.65

Implementers 15

GRElayers/gre.go
DHCPv6layers/dhcpv6.go
DHCPv4layers/dhcpv4.go
EAPOLlayers/eapol.go
EAPOLKeylayers/eapol.go
BFDlayers/bfd.go
RMCPlayers/rmcp.go
IPv4layers/ip4.go
IPv6layers/ip6.go
Loopbacklayers/loopback.go
ICMPv6Echolayers/icmp6msg.go
ICMPv6RouterSolicitationlayers/icmp6msg.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…