packets

package
v0.0.0-...-a0009fc Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2013 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const IPHeaderSize = 20
View Source
const ProtocolTCP = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type EthFrame

type EthFrame struct {
	*EthernetHeader
	Body interface{}
}

func Parse

func Parse(body []byte) (frame *EthFrame, err error)

type EthType

type EthType uint16
const EthTypeIP EthType = 0x0800

type EthernetHeader

type EthernetHeader struct {
	DstMAC [6]byte
	SrcMAC [6]byte
	Type   EthType
}

type IPFragment

type IPFragment struct {
	*IPHeader
	Body interface{}
}

func ParseIPFragment

func ParseIPFragment(buf io.Reader, h *EthernetHeader) (*IPFragment, error)

type IPHeader

type IPHeader struct {
	VersionIHL      uint8 // version and IHL fields
	TOS             uint8
	TotalLength     uint16
	Identification  uint16
	FlagsFragoffset uint16
	TTL             uint8
	Protocol        Protocol
	HeaderChecksum  uint16
	SrcAddr         uint32
	DstAddr         uint32
}

type Protocol

type Protocol uint8

type TCPHeader

type TCPHeader struct {
	SrcPort uint16
	DstPort uint16
}

func ParseTCPHeader

func ParseTCPHeader(buf io.Reader, h *IPHeader) (*TCPHeader, error)

Jump to

Keyboard shortcuts

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