fserde

package module
v0.0.0-...-3cc22ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

The FrameSerde (fserde) package provides a framework to deserialize/serialize frames from text string format to a binary byte slice or binary to text string.

Serialize - Converts a ethernet binary frame to a text string. ToString Deserialize - Converts a ethernet text string to a binary ethernet frame. ToBinary

Index

Constants

View Source
const (
	EtherTypeIPv4   = 0x0800 // IPv4 EtherType value
	EtherTypeIPv6   = 0x86dd // IPv6 EtherType value
	EtherTypeARP    = 0x0806 // ARP EtherType value
	Dot1QID         = 0x8100 // IEEE 802.1Q VLAN ID EtherType value
	QinQID          = 0x88a8 // IEEE 802.1Q QinQ VLAN ID EtherType value
	HardwareAddrLen = 6      // Length of hardware MAC address
	MinPacketLen    = 60     // Minimum Ethernet frame length without FCS
	MaxPacketLen    = 1514   // Maximum Ethernet frame length without FCS
	ProtocolUDP     = 17     // UDP protocol number
	ProtocolTCP     = 6      // TCP protocol number
	ProtocolIPv4    = 4      // IPv4 protocol number
	ProtocolIPv6    = 41     // IPv6 protocol number
	ProtocolICMPv4  = 1      // ICMPv4 protocol number
	ProtocolICMPv6  = 58     // ICMPv6 protocol number
)
View Source
const (
	ProtoL2 = iota
	ProtoL3
	ProtoL4
	ProtoL5
	ProtoL6
	ProtoL7
	MaxProtocols
)
View Source
const (
	Tag8021Q   = 0x8100
	DefaultVid = 0x0001
)
View Source
const (
	NormalFrameType = iota
	DefaultFrameType
	AllFrameTypes
)
View Source
const (
	ICMPv4MinLen = 8
	ICMPv6MinLen = 40
)
View Source
const (
	IPv4MinLen    = 20
	IPv4DefaultID = 1234
	DefaultTTL    = 64
)
View Source
const (
	TCPMinLen         = 20
	TCPHeaderLen      = 20
	TCPDefaultLen     = 20
	TCPChecksumOffset = 16
)
View Source
const (
	TCPFinFlag = 1 << iota
	TCPSynFlag
	TCPRstFlag
	TCPPshFlag
	TCPAckFlag
	TCPUrgFlag
	TCPEceFlag
	TCPCwrFlag
)

Flags that may be set in a TCP segment.

View Source
const (
	UDPHeaderLen      = 8
	UDPDefaultLen     = 8
	UDPChecksumOffset = 6
)

Variables

Functions

func IPv4AddrChecksum

func IPv4AddrChecksum(hdr *ipv4.Header) uint32

func IPv4HeaderChecksum

func IPv4HeaderChecksum(hdr *ipv4.Header) uint16

IPv4HeaderChecksum calculates checksum of IP header

func IPv4ICMPChecksum

func IPv4ICMPChecksum(hdr *ipv4.Header, icmp *ICMPHeader, data []byte) uint16

IPv4ICMPChecksum calculates ICMP checksum in case if L3 protocol is IPv4.

func IPv4TCPChecksum

func IPv4TCPChecksum(ip *ipv4.Header, tcp *TCPHdr, data []byte) uint16

IPv4TCPChecksum calculates TCP checksum for case if L3 protocol is IPv4. Here data pointer should point to end of minimal TCP header because we consider TCP options as part of data.

func IPv4UDPChecksum

func IPv4UDPChecksum(ip *ipv4.Header, udp *UDPHdr, data []byte) uint16

IPv4UDPChecksum calculates UDP checksum for case if L3 protocol is IPv4.

func IPv6AddrChecksum

func IPv6AddrChecksum(ip *ipv6.Header) uint32

func IPv6ICMPChecksum

func IPv6ICMPChecksum(ip *ipv6.Header, icmp *ICMPHeader, data []byte) uint16

IPv6ICMPChecksum calculates ICMP checksum in case if L3 protocol is IPv6.

func IPv6TCPChecksum

func IPv6TCPChecksum(ip *ipv6.Header, tcp *TCPHdr, data []byte) uint16

IPv6TCPChecksum calculates TCP checksum for case if L3 protocol is IPv6.

func IPv6UDPChecksum

func IPv6UDPChecksum(ip *ipv6.Header, udp *UDPHdr, data []byte) uint16

IPv6UDPChecksum calculates UDP checksum for case if L3 protocol is IPv6.

func PseudoHdrIPv4Checksum

func PseudoHdrIPv4Checksum(ipSrc, ipDst net.IP, proto int, length uint16) uint32

func PseudoHdrIPv4TCPChecksum

func PseudoHdrIPv4TCPChecksum(hdr *ipv4.Header) uint16

PseudoHdrIPv4TCPChecksum implements one step of TCP checksum calculation. Separately computes checksum for TCP pseudo-header for case if L3 protocol is IPv4. This precalculation is required for checksum compute by hardware offload. Result should be put into TCP.Cksum field.

func PseudoHdrIPv4UDPChecksum

func PseudoHdrIPv4UDPChecksum(hdr *ipv4.Header, udp *UDPHdr) uint16

PseudoHdrIPv4UDPChecksum implements one step of UDP checksum calculation. Separately computes checksum for UDP pseudo-header for case if L3 protocol is IPv4. This precalculation is required for checksum compute by hardware offload. Result should be put into UDP.DgramCksum field.

func PseudoHdrIPv6TCPChecksum

func PseudoHdrIPv6TCPChecksum(hdr *ipv6.Header) uint16

PseudoHdrIPv6TCPChecksum implements one step of TCP checksum calculation. Separately computes checksum for TCP pseudo-header for case if L3 protocol is IPv6. This precalculation is required for checksum compute by hardware offload. Result should be put into TCP.Cksum field.

func PseudoHdrIPv6UDPChecksum

func PseudoHdrIPv6UDPChecksum(hdr *ipv6.Header, udp *UDPHdr) uint16

PseudoHdrIPv6UDPChecksum implements one step of UDP checksum calculation. Separately computes checksum for UDP pseudo-header for case if L3 protocol is IPv6. This precalculation is required for checksum compute by hardware offload. Result should be put into UDP.DgramCksum field.

func Roundup

func Roundup(v, mul uint64) uint64

func SwapIPv4Addr

func SwapIPv4Addr(x net.IP) net.IP

func SwapUint16

func SwapUint16(x uint16) uint16

SwapBytesUint16 swaps uint16 in Little Endian and Big Endian

func SwapUint32

func SwapUint32(x uint32) uint32

SwapBytesUint32 swaps uint32 in Little Endian and Big Endian

func TCPChecksum

func TCPChecksum(tcp *TCPHdr) uint32

func ToHardwareAddr

func ToHardwareAddr(mac string) (net.HardwareAddr, error)

Types

type CountLayer

type CountLayer struct {
	// contains filtered or unexported fields
}

CountLayer the structure holding the information on each layer.

func CountNew

func CountNew(fr *Frame) *CountLayer

CountNew creates a new CountLayer and is called the NewFuncs structure.

func (*CountLayer) ApplyDefaults

func (l *CountLayer) ApplyDefaults() error

ApplyDefaults applies the default values for the layer.

func (*CountLayer) Name

func (l *CountLayer) Name() LayerName

Name returns the name of the layer.

func (*CountLayer) Parse

func (l *CountLayer) Parse(opts string) error

Parse parses the layer options string.

func (*CountLayer) String

func (l *CountLayer) String() string

func (*CountLayer) WriteLayer

func (l *CountLayer) WriteLayer() error

WriteLayer writes the layer to hdr.frame []byte.

type DefaultsLayer

type DefaultsLayer struct {
	// contains filtered or unexported fields
}

DefaultsLayer is the default implementation of the Layer interface.

func DefaultsNew

func DefaultsNew(fr *Frame) *DefaultsLayer

func (*DefaultsLayer) ApplyDefaults

func (l *DefaultsLayer) ApplyDefaults() error

func (*DefaultsLayer) Name

func (l *DefaultsLayer) Name() LayerName

func (*DefaultsLayer) Parse

func (l *DefaultsLayer) Parse(opts string) error

func (*DefaultsLayer) String

func (l *DefaultsLayer) String() string

String returns a string representation of the layer.

func (*DefaultsLayer) WriteLayer

func (l *DefaultsLayer) WriteLayer() error

type Dot1Q

type Dot1Q struct {
	// contains filtered or unexported fields
}

type Dot1adLayer

type Dot1adLayer struct {
	// contains filtered or unexported fields
}

func Dot1adNew

func Dot1adNew(fr *Frame) *Dot1adLayer

func (*Dot1adLayer) ApplyDefaults

func (l *Dot1adLayer) ApplyDefaults() error

func (*Dot1adLayer) Name

func (d *Dot1adLayer) Name() LayerName

func (*Dot1adLayer) Parse

func (l *Dot1adLayer) Parse(opts string) error

func (*Dot1adLayer) String

func (l *Dot1adLayer) String() string

func (*Dot1adLayer) WriteLayer

func (l *Dot1adLayer) WriteLayer() error

type Dot1qLayer

type Dot1qLayer struct {
	// contains filtered or unexported fields
}

func Dot1qNew

func Dot1qNew(fr *Frame) *Dot1qLayer

func (*Dot1qLayer) ApplyDefaults

func (l *Dot1qLayer) ApplyDefaults() error

func (*Dot1qLayer) Name

func (d *Dot1qLayer) Name() LayerName

func (*Dot1qLayer) Parse

func (d *Dot1qLayer) Parse(opts string) error

func (*Dot1qLayer) ParseDot1q

func (d *Dot1qLayer) ParseDot1q(opts string) error

func (*Dot1qLayer) String

func (d *Dot1qLayer) String() string

func (*Dot1qLayer) WriteLayer

func (l *Dot1qLayer) WriteLayer() error

type EchoLayer

type EchoLayer struct {
	// contains filtered or unexported fields
}

func EchoNew

func EchoNew(fr *Frame) *EchoLayer

func (*EchoLayer) ApplyDefaults

func (l *EchoLayer) ApplyDefaults() error

func (*EchoLayer) Name

func (l *EchoLayer) Name() LayerName

func (*EchoLayer) Parse

func (el *EchoLayer) Parse(opts string) error

func (*EchoLayer) String

func (l *EchoLayer) String() string

func (*EchoLayer) WriteLayer

func (l *EchoLayer) WriteLayer() error

type EtherHdr

type EtherHdr struct {
	DstMac, SrcMac net.HardwareAddr
	EtherType      uint16
}

type EtherLayer

type EtherLayer struct {
	// contains filtered or unexported fields
}

func EtherNew

func EtherNew(fr *Frame) *EtherLayer

func (*EtherLayer) ApplyDefaults

func (l *EtherLayer) ApplyDefaults() error

func (*EtherLayer) Name

func (e *EtherLayer) Name() LayerName

func (*EtherLayer) Parse

func (el *EtherLayer) Parse(opts string) error

parseEther a formatted string into a byte array or frame.

func (*EtherLayer) String

func (e *EtherLayer) String() string

func (*EtherLayer) WriteLayer

func (l *EtherLayer) WriteLayer() error

type Frame

type Frame struct {
	// contains filtered or unexported fields
}

Frame is the representation of a packet in text and binary format. A frame string or binary representation of a packet string is deserialized/serialized into this structure.

func (*Frame) AddProtocol

func (fr *Frame) AddProtocol(proto *ProtoInfo) error

func (*Frame) FrameDump

func (fr *Frame) FrameDump() string

frameDump is a helper function that returns a string representation of the given frame.

func (*Frame) GetLayer

func (fr *Frame) GetLayer(name LayerName) interface{}

GetLayer returns a pointer to the layer with the given name.

func (*Frame) GetLength

func (fr *Frame) GetLength(name LayerName) uint16

GetLength returns the length of the following layers starting with the given layer name.

func (*Frame) GetOffset

func (fr *Frame) GetOffset(name LayerName) uint16

GetOffset returns the offset to the given layer name. The offset is the offset to the beginning of the protocol layer name

func (*Frame) GetProtocol

func (fr *Frame) GetProtocol(name LayerName) *ProtoInfo

GetProtocol returns a pointer to the protocol with the given name.

func (*Frame) GetProtocolID

func (fr *Frame) GetProtocolID() int

func (*Frame) String

func (f *Frame) String() string

String converts a Frame structure to a string.

type FrameKey

type FrameKey struct {
	// contains filtered or unexported fields
}

type FrameMap

type FrameMap map[FrameKey]*Frame // Frame Mapping between frame type and frame

func (FrameMap) String

func (f FrameMap) String() string

String converts a EncodedFrame map to a string.

type FrameSerde

type FrameSerde struct {
	// contains filtered or unexported fields
}

Serde is the main structure of the fserde package. Holding the deserialized and serialized frame data.

func Create

func Create(name string, cfg *FrameSerdeConfig) (*FrameSerde, error)

Create a FrameSerde structure from the default values. If the default values are present then parse them to the FrameSerde structure.

func (*FrameSerde) DefaultToBinary

func (f *FrameSerde) DefaultToBinary(frameString string) error

func (*FrameSerde) DefaultsToBinary

func (f *FrameSerde) DefaultsToBinary(frameStrings []string) error

func (*FrameSerde) Delete

func (f *FrameSerde) Delete()

func (*FrameSerde) DeleteFrame

func (f *FrameSerde) DeleteFrame(frameName string, ftype FrameType) error

func (*FrameSerde) Destroy

func (f *FrameSerde) Destroy()

func (*FrameSerde) FrameMap

func (f *FrameSerde) FrameMap(ftype FrameType) FrameMap

func (*FrameSerde) FrameNames

func (f *FrameSerde) FrameNames(ftype FrameType) []string

func (*FrameSerde) GetFrame

func (f *FrameSerde) GetFrame(frameName string, ftype FrameType) (*Frame, error)

func (*FrameSerde) GetFrames

func (f *FrameSerde) GetFrames(ftype FrameType) []*Frame

func (*FrameSerde) StringToBinary

func (f *FrameSerde) StringToBinary(frameString string) error

StringToBinary converts a string formatted frame to a binary frame

func (*FrameSerde) StringsToBinary

func (f *FrameSerde) StringsToBinary(frameStrings []string) error

StringsToBinary converts a slice of string frames to a binary formatted frames

func (*FrameSerde) WritePCAP

func (fg *FrameSerde) WritePCAP(path string, frameType FrameType) error

type FrameSerdeConfig

type FrameSerdeConfig struct {
	Defaults []string // List of default layers to apply to the frames
}

FrameSerdeConfig is the configuration structure for the FrameSerde.Create() call.

type FrameType

type FrameType int

type ICMPHeader

type ICMPHeader struct {
	Type       uint8  // Message type
	Code       uint8  // Message code
	Cksum      uint16 // Checksum set to zero
	Identifier uint16 // Message identifier in some messages
	SeqNum     uint16 // Message sequence number in some messages
}

ICMPHdr L4 header.

type ICMPv4Layer

type ICMPv4Layer struct {
	// contains filtered or unexported fields
}

func ICMPv4New

func ICMPv4New(fr *Frame) *ICMPv4Layer

func (*ICMPv4Layer) ApplyDefaults

func (l *ICMPv4Layer) ApplyDefaults() error

func (*ICMPv4Layer) Name

func (l *ICMPv4Layer) Name() LayerName

func (*ICMPv4Layer) Parse

func (l *ICMPv4Layer) Parse(opts string) error

func (*ICMPv4Layer) String

func (l *ICMPv4Layer) String() string

func (*ICMPv4Layer) WriteLayer

func (l *ICMPv4Layer) WriteLayer() error

type ICMPv6Layer

type ICMPv6Layer struct {
	// contains filtered or unexported fields
}

func ICMPv6New

func ICMPv6New(fr *Frame) *ICMPv6Layer

func (*ICMPv6Layer) ApplyDefaults

func (l *ICMPv6Layer) ApplyDefaults() error

func (*ICMPv6Layer) Name

func (l *ICMPv6Layer) Name() LayerName

func (*ICMPv6Layer) Parse

func (el *ICMPv6Layer) Parse(opts string) error

func (*ICMPv6Layer) String

func (l *ICMPv6Layer) String() string

func (*ICMPv6Layer) WriteLayer

func (l *ICMPv6Layer) WriteLayer() error

type IPv4Layer

type IPv4Layer struct {
	// contains filtered or unexported fields
}

func IPv4New

func IPv4New(fr *Frame) *IPv4Layer

func (*IPv4Layer) ApplyDefaults

func (l *IPv4Layer) ApplyDefaults() error

func (*IPv4Layer) Name

func (e *IPv4Layer) Name() LayerName

func (*IPv4Layer) Parse

func (ip *IPv4Layer) Parse(opts string) error

func (*IPv4Layer) String

func (ip *IPv4Layer) String() string

func (*IPv4Layer) WriteLayer

func (l *IPv4Layer) WriteLayer() error

type IPv6Layer

type IPv6Layer struct {
	// contains filtered or unexported fields
}

func IPv6New

func IPv6New(fr *Frame) *IPv6Layer

func (*IPv6Layer) ApplyDefaults

func (l *IPv6Layer) ApplyDefaults() error

func (*IPv6Layer) Name

func (l *IPv6Layer) Name() LayerName

func (*IPv6Layer) Parse

func (l *IPv6Layer) Parse(opts string) error

func (*IPv6Layer) String

func (l *IPv6Layer) String() string

func (*IPv6Layer) WriteLayer

func (l *IPv6Layer) WriteLayer() error

type LayerHdr

type LayerHdr struct {
	// contains filtered or unexported fields
}

LayerHdr is the header for each layer containing common fields

func LayerConstructor

func LayerConstructor(fr *Frame, layerName LayerName, layerType LayerType) *LayerHdr

LayerConstructor is a function that creates a new layer header

func (*LayerHdr) String

func (ln *LayerHdr) String() string

String returns a string representation of the layer header

type LayerInfo

type LayerInfo struct {
	Name  LayerName   // Name of the layer i.e., "TCP" or "UDP" or "ipv4" or ...
	Type  LayerType   // Layer index or type value
	Opts  string      // Layer strings
	Layer interface{} // Layer structure pointer
}

type LayerMap

type LayerMap map[LayerName]interface{} // interface{} is the given layer structure

type LayerName

type LayerName string // Layer type name
const (
	// These strings are used for displaying layer names.
	// Must match the order of the layers above.
	LayerEther    LayerName = "Ether"
	LayerDot1Q    LayerName = "Dot1Q"
	LayerQinQ     LayerName = "QinQ"
	LayerDot1AD   LayerName = "Dot1AD"
	LayerIPv4     LayerName = "IPv4"
	LayerIPv6     LayerName = "IPv6"
	LayerTCP      LayerName = "TCP"
	LayerUDP      LayerName = "UDP"
	LayerICMPv4   LayerName = "ICMPv4"
	LayerICMPv6   LayerName = "ICMPv6"
	LayerSCTP     LayerName = "SCTP"
	LayerVxLan    LayerName = "VxLan"
	LayerEcho     LayerName = "Echo"
	LayerTSC      LayerName = "TSC"
	LayerPayload  LayerName = "Payload"
	LayerDefaults LayerName = "Defaults"
	LayerCount    LayerName = "Count"
	LayerDone     LayerName = "Done"
)

type LayerType

type LayerType int // Layer type index value
const (
	// Index values for each layer, must match the list below set of constants.
	LayerEtherType LayerType = iota
	LayerDot1QType
	LayerQinQType
	LayerDot1ADType
	LayerIPv4Type
	LayerIPv6Type
	LayerTCPType
	LayerUDPType
	LayerICMPv4Type
	LayerICMPv6Type
	LayerSCTPType
	LayerVxLanType
	LayerEchoType
	LayerTSCType
	LayerPayloadType
	LayerDefaultsType
	LayerCountType
	MaxLayerType
)

func (LayerType) String

func (l LayerType) String() LayerName

String returns the string representation of the layer name string

type MyBuffer

type MyBuffer struct {
	Buf bytes.Buffer
}

func (*MyBuffer) Append

func (b *MyBuffer) Append(val interface{})

func (*MyBuffer) BufferDump

func (b *MyBuffer) BufferDump() string

BufferDump is a helper function that returns a string representation of the given frame.

func (*MyBuffer) Bytes

func (b *MyBuffer) Bytes() []byte

func (*MyBuffer) Cap

func (b *MyBuffer) Cap() int

func (*MyBuffer) Len

func (b *MyBuffer) Len() int

func (*MyBuffer) Read

func (b *MyBuffer) Read(p []byte) (n int, err error)

func (*MyBuffer) Reset

func (b *MyBuffer) Reset()

func (*MyBuffer) Write

func (b *MyBuffer) Write(p []byte) (n int, err error)

func (*MyBuffer) WriteAt

func (b *MyBuffer) WriteAt(index int, val []byte) error

func (*MyBuffer) WriteByte

func (b *MyBuffer) WriteByte(p byte) error

func (*MyBuffer) WriteValueAt

func (b *MyBuffer) WriteValueAt(index int, val interface{}) error

type NewFuncs

type NewFuncs struct {
	// contains filtered or unexported fields
}

Structure to hold all of the layer create functions

type PayloadLayer

type PayloadLayer struct {
	// contains filtered or unexported fields
}

func PayloadNew

func PayloadNew(fr *Frame) *PayloadLayer

func (*PayloadLayer) ApplyDefaults

func (l *PayloadLayer) ApplyDefaults() error

func (*PayloadLayer) Name

func (l *PayloadLayer) Name() LayerName

func (*PayloadLayer) Parse

func (l *PayloadLayer) Parse(opts string) error

func (*PayloadLayer) String

func (pl *PayloadLayer) String() string

func (*PayloadLayer) WriteLayer

func (l *PayloadLayer) WriteLayer() error

type ProtoInfo

type ProtoInfo struct {
	// contains filtered or unexported fields
}

ProtoInfo is the protocol offset and length information in the packet data.

func (*ProtoInfo) String

func (p *ProtoInfo) String() string

type ProtoMap

type ProtoMap map[LayerName]*ProtoInfo // Protocol Mapping

type QinQLayer

type QinQLayer struct {
	// contains filtered or unexported fields
}

func QinQNew

func QinQNew(fr *Frame) *QinQLayer

func (*QinQLayer) ApplyDefaults

func (l *QinQLayer) ApplyDefaults() error

func (*QinQLayer) Name

func (l *QinQLayer) Name() LayerName

func (*QinQLayer) Parse

func (l *QinQLayer) Parse(opts string) error

func (*QinQLayer) String

func (e *QinQLayer) String() string

func (*QinQLayer) WriteLayer

func (l *QinQLayer) WriteLayer() error

type SCTPLayer

type SCTPLayer struct {
	// contains filtered or unexported fields
}

func SCTPNew

func SCTPNew(fr *Frame) *SCTPLayer

func (*SCTPLayer) ApplyDefaults

func (l *SCTPLayer) ApplyDefaults() error

func (*SCTPLayer) Name

func (l *SCTPLayer) Name() LayerName

func (*SCTPLayer) Parse

func (l *SCTPLayer) Parse(opts string) error

func (*SCTPLayer) String

func (l *SCTPLayer) String() string

func (*SCTPLayer) WriteLayer

func (l *SCTPLayer) WriteLayer() error

type TCPHdr

type TCPHdr struct {
	SrcPort  uint16 // TCP source port
	DstPort  uint16 // TCP destination port
	SeqNum   uint32 // TCP sequence number
	AckNum   uint32 // TCP acknowledgment number
	Flags    uint16 // TCP flags
	Window   uint16 // TCP window size
	Checksum uint16 // Always 0 and not configurable
	Urgent   uint16 // TCP urgent pointer
	HdrLen   uint16 // TCP header length
	Options  []byte // TCP options bytes total length multiple of 4, max 40 bytes
	// contains filtered or unexported fields
}

type TCPLayer

type TCPLayer struct {
	// contains filtered or unexported fields
}

func TCPNew

func TCPNew(fr *Frame) *TCPLayer

func (*TCPLayer) ApplyDefaults

func (l *TCPLayer) ApplyDefaults() error

func (*TCPLayer) Name

func (l *TCPLayer) Name() LayerName

func (*TCPLayer) Parse

func (l *TCPLayer) Parse(opts string) error

func (*TCPLayer) String

func (t *TCPLayer) String() string

func (*TCPLayer) WriteLayer

func (l *TCPLayer) WriteLayer() error

type TCPOptions

type TCPOptions struct {
	// contains filtered or unexported fields
}

type TSCLayer

type TSCLayer struct {
	// contains filtered or unexported fields
}

func TSCNew

func TSCNew(fr *Frame) *TSCLayer

func (*TSCLayer) ApplyDefaults

func (l *TSCLayer) ApplyDefaults() error

func (*TSCLayer) Name

func (l *TSCLayer) Name() LayerName

func (*TSCLayer) Parse

func (l *TSCLayer) Parse(opts string) error

func (*TSCLayer) String

func (l *TSCLayer) String() string

func (*TSCLayer) WriteLayer

func (l *TSCLayer) WriteLayer() error

type ToBinaryConverter

type ToBinaryConverter interface {
	// Methods for ToBinary
	Parse(opts string) error
	ApplyDefaults() error
	WriteLayer() error
}

type UDPHdr

type UDPHdr struct {
	SrcPort  uint16
	DstPort  uint16
	Length   uint16
	Checksum bool
}

type UDPLayer

type UDPLayer struct {
	// contains filtered or unexported fields
}

func UDPNew

func UDPNew(fr *Frame) *UDPLayer

func (*UDPLayer) ApplyDefaults

func (l *UDPLayer) ApplyDefaults() error

func (*UDPLayer) Name

func (l *UDPLayer) Name() LayerName

func (*UDPLayer) Parse

func (u *UDPLayer) Parse(opts string) error

func (*UDPLayer) String

func (u *UDPLayer) String() string

func (*UDPLayer) WriteLayer

func (l *UDPLayer) WriteLayer() error

type VxLanLayer

type VxLanLayer struct {
	// contains filtered or unexported fields
}

func VxLanNew

func VxLanNew(fr *Frame) *VxLanLayer

func (*VxLanLayer) ApplyDefaults

func (l *VxLanLayer) ApplyDefaults() error

func (*VxLanLayer) Name

func (l *VxLanLayer) Name() LayerName

func (*VxLanLayer) Parse

func (l *VxLanLayer) Parse(opts string) error

func (*VxLanLayer) String

func (vx *VxLanLayer) String() string

func (*VxLanLayer) WriteLayer

func (l *VxLanLayer) WriteLayer() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL