Documentation ¶
Index ¶
- Constants
- Variables
- func DHCPMarshalOption(o DHCPOption) (out []byte, err error)
- func DHCPWriteOption(w io.Writer, a DHCPOption) (n int, err error)
- func NewICMPv6ByHeaderType(packetType uint8) util.Message
- type ARP
- type ChassisTLV
- type DHCP
- func NewDHCP(xid uint32, op DHCPOperation, hwtype byte) (*DHCP, error)
- func NewDHCPAck(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
- func NewDHCPDiscover(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
- func NewDHCPNak(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
- func NewDHCPOffer(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
- func NewDHCPRequest(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
- type DHCPOperation
- type DHCPOption
- func DHCPIP4Option(tag byte, ips net.IP) (opt DHCPOption, err error)
- func DHCPIP4sOption(tag byte, ips []net.IP) (opt DHCPOption, err error)
- func DHCPNewOption(tag byte, data []byte) DHCPOption
- func DHCPParseOptions(in []byte) (opts []DHCPOption, err error)
- func DHCPStringOption(tag byte, s string) (opt DHCPOption, err error)
- type Ethernet
- type FragmentHeader
- type HopByHopHeader
- type ICMP
- type ICMPv6EchoReqRpl
- type ICMPv6Error
- type ICMPv6Header
- type IGMPMessage
- type IGMPv1or2
- type IGMPv3GroupRecord
- type IGMPv3MembershipReport
- type IGMPv3Query
- type IPv4
- type IPv6
- type LLDP
- type MLD
- type MLDQuery
- type MLDv2Record
- type MLDv2Report
- type Option
- type PortTLV
- type RoutingHeader
- type TCP
- type TTLTLV
- type UDP
- type VLAN
Constants ¶
const ( Type_Request = 1 Type_Reply = 2 )
const ( DHCP_MSG_BOOT_REQ byte = iota DHCP_MSG_BOOT_RES )
const ( DHCP_OPT_REQUEST_IP byte = iota + 50 // 0x32, 4, net.IP DHCP_OPT_LEASE_TIME // 0x33, 4, uint32 DHCP_OPT_EXT_OPTS // 0x34, 1, 1/2/3 DHCP_OPT_MESSAGE_TYPE // 0x35, 1, 1-7 DHCP_OPT_SERVER_ID // 0x36, 4, net.IP DHCP_OPT_PARAMS_REQUEST // 0x37, n, []byte DHCP_OPT_MESSAGE // 0x38, n, string DHCP_OPT_MAX_DHCP_SIZE // 0x39, 2, uint16 DHCP_OPT_T1 // 0x3a, 4, uint32 DHCP_OPT_T2 // 0x3b, 4, uint32 DHCP_OPT_CLASS_ID // 0x3c, n, []byte DHCP_OPT_CLIENT_ID // 0x3d, n >= 2, []byte )
const ( DHCP_OPT_PAD byte = iota DHCP_OPT_SUBNET_MASK // 0x01, 4, net.IP DHCP_OPT_TIME_OFFSET // 0x02, 4, int32 (signed seconds from UTC) DHCP_OPT_DEFAULT_GATEWAY // 0x03, n*4, [n]net.IP DHCP_OPT_TIME_SERVER // 0x04, n*4, [n]net.IP DHCP_OPT_NAME_SERVER // 0x05, n*4, [n]net.IP DHCP_OPT_DOMAIN_NAME_SERVERS // 0x06, n*4, [n]net.IP DHCP_OPT_LOG_SERVER // 0x07, n*4, [n]net.IP DHCP_OPT_COOKIE_SERVER // 0x08, n*4, [n]net.IP DHCP_OPT_LPR_SERVER // 0x09, n*4, [n]net.IP DHCP_OPT_IMPRESS_SERVER // 0x0a, n*4, [n]net.IP DHCP_OPT_RLSERVER // 0x0b, n*4, [n]net.IP DHCP_OPT_HOST_NAME // 0x0c, n, string DHCP_OPT_BOOTFILE_SIZE // 0x0d, 2, uint16 DHCP_OPT_MERIT_DUMP_FILE // 0x0e, >1, string DHCP_OPT_DOMAIN_NAME // 0x0f, n, string DHCP_OPT_SWAP_SERVER // 0x10, n*4, [n]net.IP DHCP_OPT_ROOT_PATH // 0x11, n, string DHCP_OPT_EXTENSIONS_PATH // 0x12, n, string DHCP_OPT_IP_FORWARDING // 0x13, 1, bool DHCP_OPT_SOURCE_ROUTING // 0x14, 1, bool DHCP_OPT_POLICY_FILTER // 0x15, 8*n, [n]{net.IP/net.IP} DHCP_OPT_DGRAM_MTU // 0x16, 2, uint16 DHCP_OPT_DEFAULT_TTL // 0x17, 1, byte DHCP_OPT_PATH_MTU_AGING_TIMEOUT // 0x18, 4, uint32 DHCP_OPT_PATH_PLATEAU_TABLE_OPTION // 0x19, 2*n, []uint16 DHCP_OPT_INTERFACE_MTU //0x1a, 2, uint16 DHCP_OPT_ALL_SUBS_LOCAL // 0x1b, 1, bool DHCP_OPT_BROADCAST_ADDR // 0x1c, 4, net.IP DHCP_OPT_MASK_DISCOVERY // 0x1d, 1, bool DHCP_OPT_MASK_SUPPLIER // 0x1e, 1, bool DHCP_OPT_ROUTER_DISCOVERY // 0x1f, 1, bool DHCP_OPT_ROUTER_SOLICIT_ADDR // 0x20, 4, net.IP DHCP_OPT_STATIC_ROUTE // 0x21, n*8, [n]{net.IP/net.IP} -- note the 2nd is router not mask DHCP_OPT_ARP_TRAILERS // 0x22, 1, bool DHCP_OPT_ARP_TIMEOUT // 0x23, 4, uint32 DHCP_OPT_ETHERNET_ENCAP // 0x24, 1, bool DHCP_OPT_TCP_TTL // 0x25,1, byte DHCP_OPT_TCP_KEEPALIVE_INT // 0x26,4, uint32 DHCP_OPT_TCP_KEEPALIVE_GARBAGE // 0x27,1, bool DHCP_OPT_NIS_DOMAIN // 0x28,n, string DHCP_OPT_NIS_SERVERS // 0x29,4*n, [n]net.IP DHCP_OPT_NTP_SERVERS // 0x2a, 4*n, [n]net.IP DHCP_OPT_VENDOR_OPT // 0x2b, n, [n]byte // may be encapsulated. DHCP_OPT_NETBIOS_IPNS // 0x2c, 4*n, [n]net.IP DHCP_OPT_NETBIOS_DDS // 0x2d, 4*n, [n]net.IP DHCP_OPT_NETBIOS_NODE_TYPE // 0x2e, 1, magic byte DHCP_OPT_NETBIOS_SCOPE // 0x2f, n, string DHCP_OPT_X_FONT_SERVER // 0x30, n, string DHCP_OPT_X_DISPLAY_MANAGER // 0x31, n, string DHCP_OPT_SIP_SERVERS byte = 0x78 // 0x78!, n, url DHCP_OPT_END byte = 0xff )
Standard options (RFC1533)
const ( IPv4_MSG = 0x0800 ARP_MSG = 0x0806 LLDP_MSG = 0x88cc WOL_MSG = 0x0842 RARP_MSG = 0x8035 VLAN_MSG = 0x8100 IPv6_MSG = 0x86DD STP_MSG = 0x4242 STP_BPDU_MSG = 0xAAAA )
see http://en.wikipedia.org/wiki/EtherType
const ( PCP_MASK = 0xe000 DEI_MASK = 0x1000 VID_MASK = 0x0fff )
const ( ICMPv6_Type_EchoRequest = 128 ICMPv6_Type_EchoReply = 129 ICMPv6_Type_MLD_Query = 130 ICMPv6_Type_MLDv2_Report = 143 ICMPv6_Type_MLD_Report = 131 ICMPv6_Type_MLD_Done = 132 ICMPv6_ErrType_Destination_Unreachable = 1 ICMPv6_ErrType_Packet_Large = 2 ICMPv6_ErrType_Timeout = 3 ICMPv6_ErrType_Parameter = 4 // Code for ICMPv6 Error: Destination Unreachable ICMPv6_ErrCode_NoRoute = 0 ICMPv6_ErrCode_AdminProhibited = 1 ICMPv6_ErrCode_BeyondOfSource = 2 ICMPv6_ErrCode_AddrUnreachable = 3 ICMPv6_ErrCode_PortUnreachable = 4 ICMPv6_ErrCode_SourcePolicy = 5 ICMPv6_ErrCode_Reject = 6 // Code for ICMPv6 Error: Timeout ICMPv6_ErrCode_TTL = 0 ICMPv6_ErrCode_Fragment_Timeout = 1 // Code for ICMPv6 Error: Parameter ICMPv6_ErrCode_Err_Header = 0 ICMPv6_ErrCode_Unknown_Header = 1 ICMPv6_ErrCode_Unknown_Option = 2 )
const ( IGMPQuery = 0x11 IGMPv1Report = 0x12 IGMPv2Report = 0x16 IGMPv2LeaveGroup = 0x17 IGMPv3Report = 0x22 IGMPIsIn = 0x01 // Type MODE_IS_INCLUDE, source addresses x IGMPIsEx = 0x02 // Type MODE_IS_EXCLUDE, source addresses x IGMPToIn = 0x03 // Type CHANGE_TO_INCLUDE_MODE, source addresses x IGMPToEx = 0x04 // Type CHANGE_TO_EXCLUDE_MODE, source addresses x IGMPAllow = 0x05 // Type ALLOW_NEW_SOURCES, source addresses x IGMPBlock = 0x06 // Type BLOCK_OLD_SOURCES, source addresses x )
const ( Type_ICMP = 0x01 Type_IGMP = 0x02 Type_TCP = 0x06 Type_UDP = 0x11 Type_IPv6 = 0x29 Type_IPv6ICMP = 0x3a )
const ( Type_HBH = 0x0 Type_Routing = 0x2b Type_Fragment = 0x2c )
const ( CH_CHASSIS_COMPONENT CH_IFACE_ALIAS CH_PORT_COMPONENT CH_MAC_ADDR CH_NET_ADDR CH_IFACE_NAME CH_LOCAL_ASSGN )
Chassis ID subtypes
const ( PT_IFACE_ALIAS PT_PORT_COMPONENT PT_MAC_ADDR PT_NET_ADDR PT_IFACE_NAME PT_CIRCUIT_ID PT_LOCAL_ASSGN )
Port ID subtypes
const (
DHCP_FLAG_BROADCAST uint16 = 0x80
)
const (
DHCP_HW_ETHERNET byte = 0x01
)
Variables ¶
var DHCPOptionTypeStrings = [256]string{ DHCP_OPT_PAD: "(padding)", DHCP_OPT_SUBNET_MASK: "SubnetMask", DHCP_OPT_TIME_OFFSET: "TimeOffset", DHCP_OPT_DEFAULT_GATEWAY: "DefaultGateway", DHCP_OPT_TIME_SERVER: "rfc868", DHCP_OPT_NAME_SERVER: "ien116", DHCP_OPT_DOMAIN_NAME_SERVERS: "DNS", DHCP_OPT_LOG_SERVER: "mitLCS", DHCP_OPT_COOKIE_SERVER: "OPT_COOKIE_SERVER", DHCP_OPT_LPR_SERVER: "OPT_LPR_SERVER", DHCP_OPT_IMPRESS_SERVER: "OPT_IMPRESS_SERVER", DHCP_OPT_RLSERVER: "OPT_RLSERVER", DHCP_OPT_HOST_NAME: "Hostname", DHCP_OPT_BOOTFILE_SIZE: "BootfileSize", DHCP_OPT_MERIT_DUMP_FILE: "OPT_MERIT_DUMP_FILE", DHCP_OPT_DOMAIN_NAME: "DomainName", DHCP_OPT_SWAP_SERVER: "OPT_SWAP_SERVER", DHCP_OPT_ROOT_PATH: "RootPath", DHCP_OPT_EXTENSIONS_PATH: "OPT_EXTENSIONS_PATH", DHCP_OPT_IP_FORWARDING: "OPT_IP_FORWARDING", DHCP_OPT_SOURCE_ROUTING: "OPT_SOURCE_ROUTING", DHCP_OPT_POLICY_FILTER: "OPT_POLICY_FILTER", DHCP_OPT_DGRAM_MTU: "OPT_DGRAM_MTU", DHCP_OPT_DEFAULT_TTL: "OPT_DEFAULT_TTL", DHCP_OPT_PATH_MTU_AGING_TIMEOUT: "OPT_PATH_MTU_AGING_TIMEOUT", DHCP_OPT_PATH_PLATEAU_TABLE_OPTION: "OPT_PATH_PLATEAU_TABLE_OPTION", DHCP_OPT_INTERFACE_MTU: "OPT_INTERFACE_MTU", DHCP_OPT_ALL_SUBS_LOCAL: "OPT_ALL_SUBS_LOCAL", DHCP_OPT_BROADCAST_ADDR: "OPT_BROADCAST_ADDR", DHCP_OPT_MASK_DISCOVERY: "OPT_MASK_DISCOVERY", DHCP_OPT_MASK_SUPPLIER: "OPT_MASK_SUPPLIER", DHCP_OPT_ROUTER_DISCOVERY: "OPT_ROUTER_DISCOVERY", DHCP_OPT_ROUTER_SOLICIT_ADDR: "OPT_ROUTER_SOLICIT_ADDR", DHCP_OPT_STATIC_ROUTE: "OPT_STATIC_ROUTE", DHCP_OPT_ARP_TRAILERS: "OPT_ARP_TRAILERS", DHCP_OPT_ARP_TIMEOUT: "OPT_ARP_TIMEOUT", DHCP_OPT_ETHERNET_ENCAP: "OPT_ETHERNET_ENCAP", DHCP_OPT_TCP_TTL: "OPT_TCP_TTL", DHCP_OPT_TCP_KEEPALIVE_INT: "OPT_TCP_KEEPALIVE_INT", DHCP_OPT_TCP_KEEPALIVE_GARBAGE: "OPT_TCP_KEEPALIVE_GARBAGE", DHCP_OPT_NIS_DOMAIN: "OPT_NIS_DOMAIN", DHCP_OPT_NIS_SERVERS: "OPT_NIS_SERVERS", DHCP_OPT_NTP_SERVERS: "OPT_NTP_SERVERS", DHCP_OPT_VENDOR_OPT: "OPT_VENDOR_OPT", DHCP_OPT_NETBIOS_IPNS: "OPT_NETBIOS_IPNS", DHCP_OPT_NETBIOS_DDS: "OPT_NETBIOS_DDS", DHCP_OPT_NETBIOS_NODE_TYPE: "OPT_NETBIOS_NODE_TYPE", DHCP_OPT_NETBIOS_SCOPE: "OPT_NETBIOS_SCOPE", DHCP_OPT_X_FONT_SERVER: "OPT_X_FONT_SERVER", DHCP_OPT_X_DISPLAY_MANAGER: "OPT_X_DISPLAY_MANAGER", DHCP_OPT_END: "(end)", DHCP_OPT_SIP_SERVERS: "SipServers", DHCP_OPT_REQUEST_IP: "RequestIP", DHCP_OPT_LEASE_TIME: "LeaseTime", DHCP_OPT_EXT_OPTS: "ExtOpts", DHCP_OPT_MESSAGE_TYPE: "MessageType", DHCP_OPT_SERVER_ID: "ServerID", DHCP_OPT_PARAMS_REQUEST: "ParamsRequest", DHCP_OPT_MESSAGE: "Message", DHCP_OPT_MAX_DHCP_SIZE: "MaxDHCPSize", DHCP_OPT_T1: "Timer1", DHCP_OPT_T2: "Timer2", DHCP_OPT_CLASS_ID: "ClassID", DHCP_OPT_CLIENT_ID: "ClientID", }
I'm amazed that this is syntactically valid. cool though.
Functions ¶
func DHCPMarshalOption ¶
func DHCPMarshalOption(o DHCPOption) (out []byte, err error)
A more json.Marshal like version of WriteOption.
func DHCPWriteOption ¶
func DHCPWriteOption(w io.Writer, a DHCPOption) (n int, err error)
Write an option to an io.Writer, including tag & length (if length is appropriate to the tag type). Utilizes the MarshalOption as the underlying serializer.
func NewICMPv6ByHeaderType ¶ added in v0.7.0
Types ¶
type ARP ¶
type ARP struct { HWType uint16 ProtoType uint16 HWLength uint8 ProtoLength uint8 Operation uint16 HWSrc net.HardwareAddr IPSrc net.IP HWDst net.HardwareAddr IPDst net.IP }
func (*ARP) MarshalBinary ¶
func (*ARP) UnmarshalBinary ¶
type ChassisTLV ¶
type DHCP ¶
type DHCP struct { Operation DHCPOperation HardwareType byte HardwareLen uint8 HardwareOpts uint8 Xid uint32 Secs uint16 Flags uint16 ClientIP net.IP YourIP net.IP ServerIP net.IP GatewayIP net.IP ClientHWAddr net.HardwareAddr ServerName [64]byte File [128]byte Options []DHCPOption }
func NewDHCPAck ¶
func NewDHCPAck(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
func NewDHCPDiscover ¶
func NewDHCPDiscover(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
func NewDHCPNak ¶
func NewDHCPNak(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
func NewDHCPOffer ¶
func NewDHCPOffer(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
func NewDHCPRequest ¶
func NewDHCPRequest(xid uint32, hwAddr net.HardwareAddr) (d *DHCP, err error)
type DHCPOperation ¶
type DHCPOperation byte
const ( DHCP_MSG_UNSPEC DHCPOperation = iota DHCP_MSG_DISCOVER DHCP_MSG_OFFER DHCP_MSG_REQUEST DHCP_MSG_DECLINE DHCP_MSG_ACK DHCP_MSG_NAK DHCP_MSG_RELEASE DHCP_MSG_INFORM )
type DHCPOption ¶
func DHCPIP4Option ¶
func DHCPIP4Option(tag byte, ips net.IP) (opt DHCPOption, err error)
NB: We don't validate that you have /any/ IP's in the option here, simply that if you do that they're valid. Most DHCP options are only valid with 1(+|) values
func DHCPIP4sOption ¶
func DHCPIP4sOption(tag byte, ips []net.IP) (opt DHCPOption, err error)
NB: We don't validate that you have /any/ IP's in the option here, simply that if you do that they're valid. Most DHCP options are only valid with 1(+|) values
func DHCPNewOption ¶
func DHCPNewOption(tag byte, data []byte) DHCPOption
func DHCPParseOptions ¶
func DHCPParseOptions(in []byte) (opts []DHCPOption, err error)
func DHCPStringOption ¶
func DHCPStringOption(tag byte, s string) (opt DHCPOption, err error)
NB: I'm not checking tag : min length here!
type Ethernet ¶
type Ethernet struct { Delimiter uint8 HWDst net.HardwareAddr HWSrc net.HardwareAddr VLANID VLAN Ethertype uint16 Data util.Message }
func NewEthernet ¶
func NewEthernet() *Ethernet
func (*Ethernet) MarshalBinary ¶
func (*Ethernet) UnmarshalBinary ¶
type FragmentHeader ¶
type FragmentHeader struct { NextHeader uint8 Reserved uint8 FragmentOffset uint16 MoreFragments bool Identification uint32 }
func NewFragmentHeader ¶
func NewFragmentHeader() *FragmentHeader
func (*FragmentHeader) Len ¶
func (h *FragmentHeader) Len() uint16
func (*FragmentHeader) MarshalBinary ¶
func (h *FragmentHeader) MarshalBinary() (data []byte, err error)
func (*FragmentHeader) UnmarshalBinary ¶
func (h *FragmentHeader) UnmarshalBinary(data []byte) error
type HopByHopHeader ¶
func NewHopByHopHeader ¶
func NewHopByHopHeader() *HopByHopHeader
func (*HopByHopHeader) Len ¶
func (h *HopByHopHeader) Len() uint16
func (*HopByHopHeader) MarshalBinary ¶
func (h *HopByHopHeader) MarshalBinary() (data []byte, err error)
func (*HopByHopHeader) UnmarshalBinary ¶
func (h *HopByHopHeader) UnmarshalBinary(data []byte) error
type ICMPv6EchoReqRpl ¶ added in v0.7.0
type ICMPv6EchoReqRpl struct { ICMPv6Header Identifier uint16 SeqNum uint16 Data util.Message }
func NewICMPv6EchoReply ¶ added in v0.7.0
func NewICMPv6EchoReply(identifier, sequenceNumber uint16) *ICMPv6EchoReqRpl
func NewICMPv6EchoRequest ¶ added in v0.7.0
func NewICMPv6EchoRequest(identifier, sequenceNumber uint16) *ICMPv6EchoReqRpl
func (*ICMPv6EchoReqRpl) Len ¶ added in v0.7.0
func (i *ICMPv6EchoReqRpl) Len() (n uint16)
func (*ICMPv6EchoReqRpl) MarshalBinary ¶ added in v0.7.0
func (i *ICMPv6EchoReqRpl) MarshalBinary() (data []byte, err error)
func (*ICMPv6EchoReqRpl) UnmarshalBinary ¶ added in v0.7.0
func (i *ICMPv6EchoReqRpl) UnmarshalBinary(data []byte) error
type ICMPv6Error ¶ added in v0.7.0
type ICMPv6Error ICMPv6Header
type ICMPv6Header ¶ added in v0.7.0
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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Message Body + | |
func (*ICMPv6Header) Len ¶ added in v0.7.0
func (i *ICMPv6Header) Len() uint16
func (*ICMPv6Header) MarshalBinary ¶ added in v0.7.0
func (i *ICMPv6Header) MarshalBinary() (data []byte, err error)
func (*ICMPv6Header) UnmarshalBinary ¶ added in v0.7.0
func (i *ICMPv6Header) UnmarshalBinary(data []byte) error
type IGMPMessage ¶ added in v0.5.0
type IGMPMessage interface {
GetMessageType() uint8
}
type IGMPv1or2 ¶ added in v0.5.0
type IGMPv1or2 struct { Type uint8 MaxResponseTime uint8 // It is 0 for IGMPv1 message. Checksum uint16 GroupAddress net.IP }
IGMPv1:
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| Type | Unused | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Group Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
IGMPv2:
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 | Max Resp Time | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Group Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func NewIGMPv1Query ¶ added in v0.5.0
func NewIGMPv1Report ¶ added in v0.5.0
func NewIGMPv2Leave ¶ added in v0.5.0
func NewIGMPv2Query ¶ added in v0.5.0
func NewIGMPv2Report ¶ added in v0.5.0
func (*IGMPv1or2) GetMessageType ¶ added in v0.5.0
func (*IGMPv1or2) MarshalBinary ¶ added in v0.5.0
func (*IGMPv1or2) UnmarshalBinary ¶ added in v0.5.0
type IGMPv3GroupRecord ¶ added in v0.5.0
type IGMPv3GroupRecord struct { Type uint8 AuxDataLen uint8 // this should always be 0 as per IGMPv3 spec. NumberOfSources uint16 MulticastAddress net.IP SourceAddresses []net.IP AuxData []uint32 // NOT USED }
IGMPv3GroupRecord:
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Record Type | Aux Data Len | Number of Sources (N) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Multicast Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address [1] | +- -+ | Source Address [2] | +- -+ . . . . . . . . . +- -+ | Source Address [N] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Auxiliary Data . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func NewGroupRecord ¶ added in v0.5.0
func (*IGMPv3GroupRecord) Len ¶ added in v0.5.0
func (p *IGMPv3GroupRecord) Len() uint16
func (*IGMPv3GroupRecord) MarshalBinary ¶ added in v0.5.0
func (p *IGMPv3GroupRecord) MarshalBinary() (data []byte, err error)
func (*IGMPv3GroupRecord) UnmarshalBinary ¶ added in v0.5.0
func (p *IGMPv3GroupRecord) UnmarshalBinary(data []byte) error
type IGMPv3MembershipReport ¶ added in v0.5.0
type IGMPv3MembershipReport struct { Type uint8 Reserved uint8 Checksum uint16 Reserved2 uint16 NumberOfGroups uint16 GroupRecords []IGMPv3GroupRecord }
IGMPv3MembershipReport:
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 = 0x22 | Reserved | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | Number of Group Records (M) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Group Record [1] . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Group Record [2] . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | . | . . . | . | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Group Record [M] . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func NewIGMPv3Report ¶ added in v0.5.0
func NewIGMPv3Report(groups []IGMPv3GroupRecord) *IGMPv3MembershipReport
func (*IGMPv3MembershipReport) GetMessageType ¶ added in v0.5.0
func (p *IGMPv3MembershipReport) GetMessageType() uint8
func (*IGMPv3MembershipReport) Len ¶ added in v0.5.0
func (p *IGMPv3MembershipReport) Len() uint16
func (*IGMPv3MembershipReport) MarshalBinary ¶ added in v0.5.0
func (p *IGMPv3MembershipReport) MarshalBinary() (data []byte, err error)
func (*IGMPv3MembershipReport) UnmarshalBinary ¶ added in v0.5.0
func (p *IGMPv3MembershipReport) UnmarshalBinary(data []byte) error
type IGMPv3Query ¶ added in v0.5.0
type IGMPv3Query struct { Type uint8 MaxResponseTime uint8 Checksum uint16 GroupAddress net.IP Reserved uint8 SuppressRouterProcessing bool RobustnessValue uint8 IntervalTime uint8 NumberOfSources uint16 SourceAddresses []net.IP }
IGMPv3Query:
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 = 0x11 | Max Resp Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Group Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Resv |S| QRV | QQIC | Number of Sources (N) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address [1] | +- -+ | Source Address [2] | +- . -+ . . . . . . +- -+ | Source Address [N] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func NewIGMPv3Query ¶ added in v0.5.0
func (*IGMPv3Query) GetMessageType ¶ added in v0.5.0
func (p *IGMPv3Query) GetMessageType() uint8
func (*IGMPv3Query) Len ¶ added in v0.5.0
func (p *IGMPv3Query) Len() uint16
func (*IGMPv3Query) MarshalBinary ¶ added in v0.5.0
func (p *IGMPv3Query) MarshalBinary() (data []byte, err error)
func (*IGMPv3Query) UnmarshalBinary ¶ added in v0.5.0
func (p *IGMPv3Query) UnmarshalBinary(data []byte) error
type IPv4 ¶
type IPv4 struct { Version uint8 //4-bits IHL uint8 //4-bits DSCP uint8 //6-bits ECN uint8 //2-bits Length uint16 Id uint16 Flags uint16 //3-bits FragmentOffset uint16 //13-bits TTL uint8 Protocol uint8 Checksum uint16 NWSrc net.IP NWDst net.IP Options util.Buffer Data util.Message }
func (*IPv4) MarshalBinary ¶
func (*IPv4) UnmarshalBinary ¶
type IPv6 ¶
type IPv6 struct { Version uint8 //4-bits TrafficClass uint8 FlowLabel uint32 //20-bits Length uint16 NextHeader uint8 HopLimit uint8 NWSrc net.IP NWDst net.IP HbhHeader *HopByHopHeader RoutingHeader *RoutingHeader FragmentHeader *FragmentHeader Data util.Message }
func (*IPv6) MarshalBinary ¶
func (*IPv6) UnmarshalBinary ¶
type LLDP ¶
type LLDP struct { Chassis ChassisTLV Port PortTLV TTL TTLTLV }
type MLD ¶ added in v0.7.0
type MLD struct { ICMPv6Header MaxResponse uint16 Reserved uint16 MulticastAddress net.IP }
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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Maximum Response Delay | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Multicast Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func NewMLDDone ¶ added in v0.7.0
func NewMLDReport ¶ added in v0.7.0
func (*MLD) MarshalBinary ¶ added in v0.7.0
func (*MLD) UnmarshalBinary ¶ added in v0.7.0
type MLDQuery ¶ added in v0.7.0
type MLDQuery struct { ICMPv6Header MaxResponse uint16 Reserved uint16 MulticastAddress net.IP Version2 bool Reserved2 uint8 SuppressRouterProcessing bool RobustnessValue uint8 IntervalTime uint8 NumberOfSources uint16 SourceAddresses []net.IP }
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 = 130 | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Maximum Response Code | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | * * | | * Multicast Address * | | * * | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Resv |S| QRV | QQIC | Number of Sources (N) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | * * | | * Source Address [1] * | | * * | | +- -+ | | * * | | * Source Address [2] * | | * * | | +- . -+ . . . . . . +- -+ | | * * | | * Source Address [N] * | | * * | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func NewMLDQuery ¶ added in v0.7.0
func NewMLDv2Query ¶ added in v0.7.0
func (*MLDQuery) MarshalBinary ¶ added in v0.7.0
func (*MLDQuery) UnmarshalBinary ¶ added in v0.7.0
type MLDv2Record ¶ added in v0.7.0
type MLDv2Record struct { Type uint8 AuxDataLen uint8 // this may be 0 to indicate the absence of any auxiliary data. NumberOfSources uint16 MulticastAddress net.IP SourceAddresses []net.IP AuxData []uint32 // NOT USED }
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Record Type | Aux Data Len | Number of Sources (N) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | * * | | * Multicast Address * | | * * | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | * * | | * Source Address [1] * | | * * | | +- -+ | | * * | | * Source Address [2] * | | * * | | +- -+ . . . . . . . . . +- -+ | | * * | | * Source Address [N] * | | * * | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Auxiliary Data . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func NewMLDv2Record ¶ added in v0.7.0
func (*MLDv2Record) Len ¶ added in v0.7.0
func (r *MLDv2Record) Len() uint16
func (*MLDv2Record) MarshalBinary ¶ added in v0.7.0
func (r *MLDv2Record) MarshalBinary() (data []byte, err error)
func (*MLDv2Record) UnmarshalBinary ¶ added in v0.7.0
func (r *MLDv2Record) UnmarshalBinary(data []byte) error
type MLDv2Report ¶ added in v0.7.0
type MLDv2Report struct { ICMPv6Header Reserved2 uint16 NumberOfRecords uint16 GroupRecords []MLDv2Record }
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 = 143 | Reserved | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved |Nr of Mcast Address Records (M)| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Multicast Address Record [1] . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Multicast Address Record [2] . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | . | . . . | . | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Multicast Address Record [M] . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func NewMLDv2Report ¶ added in v0.7.0
func NewMLDv2Report(records []MLDv2Record) *MLDv2Report
func (*MLDv2Report) Len ¶ added in v0.7.0
func (r *MLDv2Report) Len() (n uint16)
func (*MLDv2Report) MarshalBinary ¶ added in v0.7.0
func (r *MLDv2Report) MarshalBinary() (data []byte, err error)
func (*MLDv2Report) UnmarshalBinary ¶ added in v0.7.0
func (r *MLDv2Report) UnmarshalBinary(data []byte) error
type RoutingHeader ¶
type RoutingHeader struct { NextHeader uint8 HEL uint8 RoutingType uint8 SegmentsLeft uint8 Data *util.Buffer }
func NewRoutingHeader ¶
func NewRoutingHeader() *RoutingHeader
func (*RoutingHeader) Len ¶
func (h *RoutingHeader) Len() uint16
func (*RoutingHeader) MarshalBinary ¶
func (h *RoutingHeader) MarshalBinary() (data []byte, err error)
func (*RoutingHeader) UnmarshalBinary ¶
func (h *RoutingHeader) UnmarshalBinary(data []byte) error
type TCP ¶
type TCP struct { PortSrc uint16 PortDst uint16 SeqNum uint32 AckNum uint32 HdrLen uint8 Code uint8 WinSize uint16 Checksum uint16 UrgFlag uint16 Data []byte }