server

package
v0.0.0-...-ac9ef1f Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubnetMaskOptCode         uint8 = 1 //ParamReqItemCode = 1
	RouterOptCode             uint8 = 3 //ParamReqItemCode = 3
	DNSOptCode                uint8 = 6 //ParamReqItemCode = 6
	HostNameOptCode           uint8 = 12
	DomainNameOptCode         uint8 = 15 //ParamReqItemCode = 15
	StaticRouteOptCode        uint8 = 33 //ParamReqItemCode = 33
	VendorSpecificInfoOptCode uint8 = 43 //ParamReqItemCode = 43
	NetBIOSServerOptCode      uint8 = 44 //ParamReqItemCode = 44
	ReqIPAddrOptCode          uint8 = 50
	IPAddrLeaseTimeOptCode    uint8 = 51
	DhcpMsgTypeOptCode        uint8 = 53
	ServerIdOptCode           uint8 = 54
	ParamReqListOptCode       uint8 = 55
	MaxDhcpMsgSizeOptCode     uint8 = 57
	RenewalTimeOptCode        uint8 = 58
	RebindingTimeOptCode      uint8 = 59
	ClientIdOptCode           uint8 = 61
	TFTPServerAddrOptCode     uint8 = 150 //ParamReqItemCode = 150
	EndOptCode                uint8 = 255
)
View Source
const (
	DHCPServerPort        uint16 = 67
	DHCPClientPort        uint16 = 68
	UDPProto              uint8  = 17
	BootPReply            uint8  = 2
	BootPRequest          uint8  = 1
	UDP_HDR_LEN           uint16 = 8
	CLIENT_HW_ADDR_LEN    int    = 16
	MAX_LEN_SERVER_NAME   int    = 64
	MAX_LEN_BOOT_FILENAME int    = 128
	DHCPDISCOVER          uint8  = 1
	DHCPOFFER             uint8  = 2
	DHCPREQUEST           uint8  = 3
	DHCPACK               uint8  = 5
	DHCPRELEASE           uint8  = 7
	BOOTP_MSG_SIZE        uint16 = 236
)
View Source
const (
	OFFERED uint8 = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsicdClient

type AsicdClient struct {
	DhcpClientBase
	ClientHdl *asicdServices.ASICDServicesClient
}

type BootPMsgStruct

type BootPMsgStruct struct {
	OPCode           uint8
	HWAddrType       uint8
	HWAddrLen        uint8
	Hops             uint8
	TransactionId    uint32
	TimeElapsed      uint16
	Flags            uint16
	ClientIPAddr     uint32
	YourIPAddr       uint32
	ServerIPAddr     uint32
	RelayAgentIPAddr uint32
	ClientHWAddr     []byte
	ServerName       []byte
	BootFilename     []byte
	MagicCookie      uint32
	//DhcpOptFields    OptionFields
	DhcpOptionMap map[uint8]DhcpOptionData
}

func NewBootPMsgStruct

func NewBootPMsgStruct() *BootPMsgStruct

type ClientIdStruct

type ClientIdStruct struct {
	OptMd    OptionMetadata
	ClientId []byte
}

type ClientJson

type ClientJson struct {
	Name string `json:Name`
	Port int    `json:Port`
}

type DHCPServer

type DHCPServer struct {
	DhcpGlobalConf    DhcpGlobalConfig
	DhcpGlobalConfCh  chan DhcpGlobalConfig
	DhcpIntfConfCh    chan DhcpIntfConfig
	DhcpIntfConfRetCh chan error
	DhcpIntfConfMap   map[DhcpIntfKey]DhcpIntfData

	InitDone chan bool
	// contains filtered or unexported fields
}

func NewDHCPServer

func NewDHCPServer(logger *logging.Writer) *DHCPServer

func (*DHCPServer) InitServer

func (server *DHCPServer) InitServer(paramDir string)

func (*DHCPServer) ProcessRecvPkts

func (server *DHCPServer) ProcessRecvPkts(port int32, pkt gopacket.Packet)

func (*DHCPServer) StartAllDhcpServer

func (server *DHCPServer) StartAllDhcpServer()

func (*DHCPServer) StartDhcpServer

func (server *DHCPServer) StartDhcpServer(ifIdx int32)

func (*DHCPServer) StartLeaseEntryHandler

func (server *DHCPServer) StartLeaseEntryHandler(port int32, ipAddr uint32, macAddr string)

func (*DHCPServer) StartRxDhcpPkt

func (server *DHCPServer) StartRxDhcpPkt(port int32)

func (*DHCPServer) StartServer

func (server *DHCPServer) StartServer(paramDir string)

func (*DHCPServer) StartStaleEntryHandler

func (server *DHCPServer) StartStaleEntryHandler(port int32, ipAddr uint32, macAddr string)

func (*DHCPServer) StopAllDhcpServer

func (server *DHCPServer) StopAllDhcpServer()

func (*DHCPServer) StopDhcpServer

func (server *DHCPServer) StopDhcpServer(ifIdx int32)

type DNSStruct

type DNSStruct struct {
	OptMd OptionMetadata
	DNS   []byte
}

type DhcpClientBase

type DhcpClientBase struct {
	Address            string
	Transport          thrift.TTransport
	PtrProtocolFactory *thrift.TBinaryProtocolFactory
}

type DhcpGlobalConfig

type DhcpGlobalConfig struct {
	Enable           bool
	DefaultLeaseTime uint32
	MaxLeaseTime     uint32
}

type DhcpIntfConfig

type DhcpIntfConfig struct {
	Enable        bool
	IntfRef       string
	Subnet        uint32
	SubnetMask    uint32
	LowerIPBound  uint32
	HigherIPBound uint32
	BCastAddr     uint32
	RtrAddr       uint32
	DnsAddr       uint32
	DomainName    string
}

type DhcpIntfData

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

type DhcpIntfKey

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

type DhcpMsgTypeStruct

type DhcpMsgTypeStruct struct {
	OptMd   OptionMetadata
	MsgType []byte
}

type DhcpOfferedData

type DhcpOfferedData struct {
	LeaseTime     uint32
	MacAddr       string
	TransactionId uint32
	RefreshTimer  *time.Timer
	StaleTimer    *time.Timer
	State         uint8
}

type DhcpOptionData

type DhcpOptionData struct {
	Length uint8
	Data   []byte
}

type DomainNameStruct

type DomainNameStruct struct {
	OptMd      OptionMetadata
	DomainName []byte
}

type EthHdrMetadata

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

func NewEthHdrMetadata

func NewEthHdrMetadata() *EthHdrMetadata

type HostNameStruct

type HostNameStruct struct {
	OptMd    OptionMetadata
	HostName []byte
}

type IPAddrLeaseTimeStruct

type IPAddrLeaseTimeStruct struct {
	OptMd           OptionMetadata
	IPAddrLeaseTime []byte
}

type IPHdrMetadata

type IPHdrMetadata struct {
	HdrLen   uint8
	Length   uint16
	Protocol uint8
	SrcIP    uint32
	DstIP    uint32
}

func NewIPHdrMetadata

func NewIPHdrMetadata() *IPHdrMetadata

type L3Property

type L3Property struct {
	//State      uint8
	IpAddr     uint32
	Mask       uint32
	DhcpIfKey  DhcpIntfKey
	DhcpConfig bool
}

type LagProperty

type LagProperty struct {
	PortMap map[int32]bool
}

type MaxDhcpMsgSizeStruct

type MaxDhcpMsgSizeStruct struct {
	OptMd          OptionMetadata
	MaxDhcpMsgSize []byte
}

type NetBIOSServerStruct

type NetBIOSServerStruct struct {
	OptMd         OptionMetadata
	NetBIOSServer []byte
}

type OptionFields

type OptionFields struct {
	SubnetMaskOpt         bool
	SubnetMaskVar         SubnetMaskStruct
	RouterOpt             bool
	RouterVar             RouterStruct
	DNSOpt                bool
	DNSVar                DNSStruct
	HostNameOpt           bool
	HostNameVar           HostNameStruct
	DomainNameOpt         bool
	DomainNameVar         DomainNameStruct
	StaticRouteOpt        bool
	StaticRouteVar        StaticRouteStruct
	VendorSpecificInfoOpt bool
	VendorSpecificInfoVar VendorSpecificInfoStruct
	NetBIOSServerOpt      bool
	NetBIOSServerVar      NetBIOSServerStruct
	ReqIPAddrOpt          bool
	ReqIPAddrVar          ReqIPAddrStruct
	IPAddrLeaseTimeOpt    bool
	IPAddrLeaseTimeVar    IPAddrLeaseTimeStruct
	DhcpMsgTypeOpt        bool
	DhcpMsgTypeVar        DhcpMsgTypeStruct
	ServerIdOpt           bool
	ServerIdVar           ServerIdStruct
	ParamReqListOpt       bool
	ParamReqListVar       ParamReqListStruct
	MaxDhcpMsgSizeOpt     bool
	MaxDhcpMsgSizeVar     MaxDhcpMsgSizeStruct
	RenewalTimeOpt        bool
	RenewalTimeVar        RenewalTimeStruct
	RebindingTimeOpt      bool
	RebindingTimeVar      RebindingTimeStruct
	ClientIdOpt           bool
	ClientIdVar           ClientIdStruct
	TFTPServerAddrOpt     bool
	TFTPServerAddrVar     TFTPServerAddrStruct
}

type OptionMetadata

type OptionMetadata struct {
	OPCode uint8
	Length uint8
}

type ParamReqListStruct

type ParamReqListStruct struct {
	OptMd        OptionMetadata
	ParamReqList []byte
}

type PktMetadata

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

func NewPktMetadata

func NewPktMetadata() *PktMetadata

type PortProperty

type PortProperty struct {
	IfName    string
	MacAddr   string
	IpAddr    uint32
	Mask      uint32
	L3IfIndex int32
	CtrlCh    chan bool
	PcapHdl   *pcap.Handle
}

type RebindingTimeStruct

type RebindingTimeStruct struct {
	OptMd         OptionMetadata
	RebindingTime []byte
}

type RenewalTimeStruct

type RenewalTimeStruct struct {
	OptMd       OptionMetadata
	RenewalTime []byte
}

type ReqIPAddrStruct

type ReqIPAddrStruct struct {
	OptMd     OptionMetadata
	ReqIPAddr []byte
}

type RouterStruct

type RouterStruct struct {
	OptMd  OptionMetadata
	Router []byte
}

type ServerIdStruct

type ServerIdStruct struct {
	OptMd    OptionMetadata
	ServerId []byte
}

type StaticRouteStruct

type StaticRouteStruct struct {
	OptMd       OptionMetadata
	StaticRoute []byte
}

type SubnetMaskStruct

type SubnetMaskStruct struct {
	OptMd      OptionMetadata
	SubnetMask []byte
}

type TFTPServerAddrStruct

type TFTPServerAddrStruct struct {
	OptMd          OptionMetadata
	TFTPServerAddr []byte
}

type UDPHdrMetadata

type UDPHdrMetadata struct {
	SrcPort uint16
	DstPort uint16
	Length  uint16
}

func NewUDPHdrMetadata

func NewUDPHdrMetadata() *UDPHdrMetadata

type VendorSpecificInfoStruct

type VendorSpecificInfoStruct struct {
	OptMd              OptionMetadata
	VendorSpecificInfo []byte
}

type VlanProperty

type VlanProperty struct {
	UntagPortMap map[int32]bool
}

Jump to

Keyboard shortcuts

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