Documentation ¶
Overview ¶
Dhcp Relay Agent Interface Handling
Main entry point for DHCP_RELAY
Index ¶
- Constants
- func DhcpRelayAgentAddOptionsToPacket(reqOptions DhcpRelayAgentOptions, mt MessageType, ...) (string, string)
- func DhcpRelayAgentAllocateMemory()
- func DhcpRelayAgentConnectToClients(client ClientJson) error
- func DhcpRelayAgentCreateClientServerConn()
- func DhcpRelayAgentDecodeInPkt(data []byte, bytesRead int) (DhcpRelayAgentPacket, DhcpRelayAgentOptions, MessageType)
- func DhcpRelayAgentGetIpv4IntfList()
- func DhcpRelayAgentGetPortList()
- func DhcpRelayAgentGetVlanList()
- func DhcpRelayAgentInitDB() error
- func DhcpRelayAgentInitGblHandling(ifNum int32, enable bool)
- func DhcpRelayAgentInitIntfServerState(serverIp string, id int32)
- func DhcpRelayAgentInitIntfState(IntfId int32)
- func DhcpRelayAgentInitVlanInfo(VlanName string, VlanId int32)
- func DhcpRelayAgentListenAsicUpdate(address string) error
- func DhcpRelayAgentOSSignalHandle()
- func DhcpRelayAgentReadDB()
- func DhcpRelayAgentReceiveDhcpPkt(clientHandler *net.UDPConn)
- func DhcpRelayAgentSendClientOptPacket(ch *net.UDPConn, gblEntry DhcpRelayAgentGlobalInfo, inReq DhcpRelayAgentPacket, ...)
- func DhcpRelayAgentSendDiscoverPacket(ch *net.UDPConn, gblEntry DhcpRelayAgentGlobalInfo, inReq DhcpRelayAgentPacket, ...)
- func DhcpRelayAgentSendPacket(clientHandler *net.UDPConn, cm *ipv4.ControlMessage, ...)
- func DhcpRelayAgentSendPacketToDhcpClient(gblEntry DhcpRelayAgentGlobalInfo, logicalId int32, inReq DhcpRelayAgentPacket, ...)
- func DhcpRelayAgentSendPacketToDhcpServer(ch *net.UDPConn, gblEntry DhcpRelayAgentGlobalInfo, inReq DhcpRelayAgentPacket, ...)
- func DhcpRelayAgentUpdateIntfIpAddr(ifIndexList []int32)
- func DhcpRelayAgentUpdateIntfPortMap(msg asicdCommonDefs.IPv4IntfNotifyMsg, msgType uint8)
- func DhcpRelayAgentUpdateIntfServerIp(ifNum int32, serverIp string)
- func DhcpRelayAgentUpdateL3IntfStateChange(msg asicdCommonDefs.IPv4L3IntfStateNotifyMsg)
- func DhcpRelayAgentUpdateVlanInfo(vlanNotifyMsg asicdCommonDefs.VlanNotifyMsg, msgType uint8)
- func DhcpRelayAsicdSubscriber()
- func DhcpRelayConnectToAsicd(client ClientJson) error
- func DhcpRelayGlobalInit(enable bool)
- func DhcpRelayInitPortParams() error
- func DhcpRelayProcessReceivedBuf(rcvdCh <-chan DhcpRelayPktChannel)
- func DhcpRelaySignalHandler(sigChannel <-chan os.Signal)
- func InitDhcpRelayPortPktHandler() error
- func ParseMessageTypeToString(mtype MessageType) string
- func StartServer(log *logging.Writer, handler *DhcpRelayServiceHandler, params string) error
- func UtiltrimNull(d []byte) []byte
- type AsicdClient
- type ClientJson
- type DHCPRELAYClientBase
- type DhcpOptionCode
- type DhcpRelayAgentGlobalInfo
- type DhcpRelayAgentIntfInfo
- type DhcpRelayAgentOptions
- type DhcpRelayAgentPacket
- func (p *DhcpRelayAgentPacket) AddDhcpOptions(op DhcpOptionCode, value []byte)
- func (p DhcpRelayAgentPacket) AllocateOptions() []byte
- func (p DhcpRelayAgentPacket) GetCHAddr() net.HardwareAddr
- func (p DhcpRelayAgentPacket) GetCIAddr() net.IP
- func (p DhcpRelayAgentPacket) GetCookie() []byte
- func (p DhcpRelayAgentPacket) GetFile() []byte
- func (p DhcpRelayAgentPacket) GetFlags() []byte
- func (p DhcpRelayAgentPacket) GetGIAddr() net.IP
- func (p DhcpRelayAgentPacket) GetHeaderLen() byte
- func (p DhcpRelayAgentPacket) GetHeaderType() byte
- func (p DhcpRelayAgentPacket) GetHops() byte
- func (p DhcpRelayAgentPacket) GetOpCode() OpCode
- func (p DhcpRelayAgentPacket) GetSIAddr() net.IP
- func (p DhcpRelayAgentPacket) GetSName() []byte
- func (p DhcpRelayAgentPacket) GetSecs() []byte
- func (p DhcpRelayAgentPacket) GetXId() []byte
- func (p DhcpRelayAgentPacket) GetYIAddr() net.IP
- func (p *DhcpRelayAgentPacket) PadToMinSize()
- func (p DhcpRelayAgentPacket) ParseDhcpOptions() DhcpRelayAgentOptions
- func (p DhcpRelayAgentPacket) SetCHAddr(a net.HardwareAddr)
- func (p DhcpRelayAgentPacket) SetCIAddr(ip net.IP)
- func (p DhcpRelayAgentPacket) SetCookie(cookie []byte)
- func (p DhcpRelayAgentPacket) SetFile(file []byte)
- func (p DhcpRelayAgentPacket) SetFlags(flags []byte)
- func (p DhcpRelayAgentPacket) SetGIAddr(ip net.IP)
- func (p DhcpRelayAgentPacket) SetHeaderType(hType byte)
- func (p DhcpRelayAgentPacket) SetHops(hops byte)
- func (p DhcpRelayAgentPacket) SetOpCode(c OpCode)
- func (p DhcpRelayAgentPacket) SetSIAddr(ip net.IP)
- func (p DhcpRelayAgentPacket) SetSName(sName []byte)
- func (p DhcpRelayAgentPacket) SetSecs(secs []byte)
- func (p DhcpRelayAgentPacket) SetXId(xId []byte)
- func (p DhcpRelayAgentPacket) SetYIAddr(ip net.IP)
- type DhcpRelayClientJson
- type DhcpRelayPktChannel
- type DhcpRelayServiceHandler
- func (h *DhcpRelayServiceHandler) CreateDhcpRelayGlobal(config *dhcprelayd.DhcpRelayGlobal) (bool, error)
- func (h *DhcpRelayServiceHandler) CreateDhcpRelayIntf(config *dhcprelayd.DhcpRelayIntf) (bool, error)
- func (h *DhcpRelayServiceHandler) DeleteDhcpRelayGlobal(config *dhcprelayd.DhcpRelayGlobal) (bool, error)
- func (h *DhcpRelayServiceHandler) DeleteDhcpRelayIntf(config *dhcprelayd.DhcpRelayIntf) (bool, error)
- func (h *DhcpRelayServiceHandler) GetBulkDhcpRelayHostDhcpState(fromIndex dhcprelayd.Int, count dhcprelayd.Int) (hostEntry *dhcprelayd.DhcpRelayHostDhcpStateGetInfo, err error)
- func (h *DhcpRelayServiceHandler) GetBulkDhcpRelayIntfServerState(fromIndex dhcprelayd.Int, count dhcprelayd.Int) (intfServerEntry *dhcprelayd.DhcpRelayIntfServerStateGetInfo, err error)
- func (h *DhcpRelayServiceHandler) GetBulkDhcpRelayIntfState(fromIndex dhcprelayd.Int, count dhcprelayd.Int) (intfEntry *dhcprelayd.DhcpRelayIntfStateGetInfo, err error)
- func (h *DhcpRelayServiceHandler) GetDhcpRelayHostDhcpState(macAddr string) (*dhcprelayd.DhcpRelayHostDhcpState, error)
- func (h *DhcpRelayServiceHandler) GetDhcpRelayIntfServerState(ifIndex int32) (*dhcprelayd.DhcpRelayIntfServerState, error)
- func (h *DhcpRelayServiceHandler) GetDhcpRelayIntfState(ifIndex int32) (*dhcprelayd.DhcpRelayIntfState, error)
- func (h *DhcpRelayServiceHandler) UpdateDhcpRelayGlobal(origconfig *dhcprelayd.DhcpRelayGlobal, newconfig *dhcprelayd.DhcpRelayGlobal, ...) (bool, error)
- func (h *DhcpRelayServiceHandler) UpdateDhcpRelayIntf(origconfig *dhcprelayd.DhcpRelayIntf, newconfig *dhcprelayd.DhcpRelayIntf, ...) (bool, error)
- type IPv4Intf
- type MessageType
- type OpCode
- type Option
Constants ¶
const ( DHCP_PACKET_MIN_SIZE = 272 DHCP_PACKET_HEADER_SIZE = 16 DHCP_PACKET_MIN_BYTES = 240 DHCP_SERVER_PORT = 67 DHCP_CLIENT_PORT = 68 DHCP_BROADCAST_IP = "255.255.255.255" DHCP_NO_IP = "0.0.0.0" DHCP_REDDIS_DB_PORT = ":6379" )
DHCP Packet global constants
const (
CLIENT_CONNECTION_NOT_REQUIRED = "Connection to client is not required"
)
Variables ¶
This section is empty.
Functions ¶
func DhcpRelayAgentAddOptionsToPacket ¶
func DhcpRelayAgentAddOptionsToPacket(reqOptions DhcpRelayAgentOptions, mt MessageType, outPacket *DhcpRelayAgentPacket) (string, string)
func DhcpRelayAgentAllocateMemory ¶
func DhcpRelayAgentAllocateMemory()
func DhcpRelayAgentConnectToClients ¶
func DhcpRelayAgentConnectToClients(client ClientJson) error
* ConnectToClients: * This API will accept configFile location and from that it will * connect to clients like asicd, etc..
func DhcpRelayAgentCreateClientServerConn ¶
func DhcpRelayAgentCreateClientServerConn()
func DhcpRelayAgentDecodeInPkt ¶
func DhcpRelayAgentDecodeInPkt(data []byte, bytesRead int) (DhcpRelayAgentPacket, DhcpRelayAgentOptions, MessageType)
========================= END OF HELPER FUNCTION ===========================
- APT to decode incoming Packet by converting the byte into DHCP packet format
func DhcpRelayAgentGetIpv4IntfList ¶
func DhcpRelayAgentGetIpv4IntfList()
func DhcpRelayAgentGetPortList ¶
func DhcpRelayAgentGetPortList()
func DhcpRelayAgentGetVlanList ¶
func DhcpRelayAgentGetVlanList()
func DhcpRelayAgentInitDB ¶
func DhcpRelayAgentInitDB() error
func DhcpRelayAgentInitIntfState ¶
func DhcpRelayAgentInitIntfState(IntfId int32)
func DhcpRelayAgentOSSignalHandle ¶
func DhcpRelayAgentOSSignalHandle()
func DhcpRelayAgentReadDB ¶
func DhcpRelayAgentReadDB()
func DhcpRelayAgentSendClientOptPacket ¶
func DhcpRelayAgentSendClientOptPacket(ch *net.UDPConn, gblEntry DhcpRelayAgentGlobalInfo, inReq DhcpRelayAgentPacket, reqOptions DhcpRelayAgentOptions, mt MessageType, intfStateEntry *dhcprelayd.DhcpRelayIntfState)
func DhcpRelayAgentSendDiscoverPacket ¶
func DhcpRelayAgentSendDiscoverPacket(ch *net.UDPConn, gblEntry DhcpRelayAgentGlobalInfo, inReq DhcpRelayAgentPacket, reqOptions DhcpRelayAgentOptions, mt MessageType, intfStateEntry *dhcprelayd.DhcpRelayIntfState)
func DhcpRelayAgentSendPacket ¶
func DhcpRelayAgentSendPacket(clientHandler *net.UDPConn, cm *ipv4.ControlMessage, inReq DhcpRelayAgentPacket, reqOptions DhcpRelayAgentOptions, mType MessageType, intfStateEntry *dhcprelayd.DhcpRelayIntfState)
func DhcpRelayAgentSendPacketToDhcpClient ¶
func DhcpRelayAgentSendPacketToDhcpClient(gblEntry DhcpRelayAgentGlobalInfo, logicalId int32, inReq DhcpRelayAgentPacket, linuxInterface *net.Interface, reqOptions DhcpRelayAgentOptions, mt MessageType, server net.IP, intfStateEntry *dhcprelayd.DhcpRelayIntfState)
func DhcpRelayAgentSendPacketToDhcpServer ¶
func DhcpRelayAgentSendPacketToDhcpServer(ch *net.UDPConn, gblEntry DhcpRelayAgentGlobalInfo, inReq DhcpRelayAgentPacket, reqOptions DhcpRelayAgentOptions, mt MessageType, intfStateEntry *dhcprelayd.DhcpRelayIntfState)
DhcpDiscover MessageType = 1 // From Client - Can I have an IP? DhcpOffer MessageType = 2 // From Server - Here's an IP DhcpRequest MessageType = 3 // From Client - I'll take that IP (Also start for renewals) DhcpDecline MessageType = 4 // From Client - Sorry I can't use that IP DhcpACK MessageType = 5 // From Server, Yes you can have that IP DhcpNAK MessageType = 6 // From Server, No you cannot have that IP DhcpRelease MessageType = 7 // From Client, I don't need that IP anymore DhcpInform MessageType = 8 // From Client, I have this IP and there's nothing you can do about it
func DhcpRelayAgentUpdateIntfIpAddr ¶
func DhcpRelayAgentUpdateIntfIpAddr(ifIndexList []int32)
func DhcpRelayAgentUpdateIntfPortMap ¶
func DhcpRelayAgentUpdateIntfPortMap(msg asicdCommonDefs.IPv4IntfNotifyMsg, msgType uint8)
func DhcpRelayAgentUpdateL3IntfStateChange ¶
func DhcpRelayAgentUpdateL3IntfStateChange(msg asicdCommonDefs.IPv4L3IntfStateNotifyMsg)
func DhcpRelayAgentUpdateVlanInfo ¶
func DhcpRelayAgentUpdateVlanInfo(vlanNotifyMsg asicdCommonDefs.VlanNotifyMsg, msgType uint8)
func DhcpRelayAsicdSubscriber ¶
func DhcpRelayAsicdSubscriber()
func DhcpRelayConnectToAsicd ¶
func DhcpRelayConnectToAsicd(client ClientJson) error
func DhcpRelayGlobalInit ¶
func DhcpRelayGlobalInit(enable bool)
func DhcpRelayInitPortParams ¶
func DhcpRelayInitPortParams() error
* DhcpRelayInitPortParams: * API to handle initialization of port parameter
func DhcpRelayProcessReceivedBuf ¶
func DhcpRelayProcessReceivedBuf(rcvdCh <-chan DhcpRelayPktChannel)
func DhcpRelaySignalHandler ¶
* DhcpRelaySignalHandler: * This API will catch any os signals for DRA and if the signal is of * SIGHUP type then it exit the process
func InitDhcpRelayPortPktHandler ¶
func InitDhcpRelayPortPktHandler() error
* InitDhcpRelayPktHandler: * This API is used to initialize all the data structures varialbe that * is needed by relay agent to perform its operation
func ParseMessageTypeToString ¶
func ParseMessageTypeToString(mtype MessageType) string
func StartServer ¶
func StartServer(log *logging.Writer, handler *DhcpRelayServiceHandler, params string) error
func UtiltrimNull ¶
Types ¶
type AsicdClient ¶
type AsicdClient struct { DHCPRELAYClientBase ClientHdl *asicdServices.ASICDServicesClient }
type ClientJson ¶
type DHCPRELAYClientBase ¶
type DHCPRELAYClientBase struct { Address string Transport thrift.TTransport PtrProtocolFactory *thrift.TBinaryProtocolFactory IsConnected bool }
type DhcpOptionCode ¶
type DhcpOptionCode byte
type is similar to typedef in c
const ( End DhcpOptionCode = 255 Pad DhcpOptionCode = 0 OptionSubnetMask DhcpOptionCode = 1 OptionTimeOffset DhcpOptionCode = 2 OptionRouter DhcpOptionCode = 3 OptionTimeServer DhcpOptionCode = 4 OptionNameServer DhcpOptionCode = 5 OptionDomainNameServer DhcpOptionCode = 6 OptionLogServer DhcpOptionCode = 7 OptionCookieServer DhcpOptionCode = 8 OptionLPRServer DhcpOptionCode = 9 OptionImpressServer DhcpOptionCode = 10 OptionResourceLocationServer DhcpOptionCode = 11 OptionHostName DhcpOptionCode = 12 OptionBootFileSize DhcpOptionCode = 13 OptionMeritDumpFile DhcpOptionCode = 14 OptionDomainName DhcpOptionCode = 15 OptionSwapServer DhcpOptionCode = 16 OptionRootPath DhcpOptionCode = 17 OptionExtensionsPath DhcpOptionCode = 18 // IP Layer Parameters per Host OptionIPForwardingEnableDisable DhcpOptionCode = 19 OptionNonLocalSourceRoutingEnableDisable DhcpOptionCode = 20 OptionPolicyFilter DhcpOptionCode = 21 OptionMaximumDatagramReassemblySize DhcpOptionCode = 22 OptionDefaultIPTimeToLive DhcpOptionCode = 23 OptionPathMTUAgingTimeout DhcpOptionCode = 24 OptionPathMTUPlateauTable DhcpOptionCode = 25 // IP Layer Parameters per Interface OptionInterfaceMTU DhcpOptionCode = 26 OptionAllSubnetsAreLocal DhcpOptionCode = 27 OptionBroadcastAddress DhcpOptionCode = 28 OptionPerformMaskDiscovery DhcpOptionCode = 29 OptionMaskSupplier DhcpOptionCode = 30 OptionPerformRouterDiscovery DhcpOptionCode = 31 OptionRouterSolicitationAddress DhcpOptionCode = 32 OptionStaticRoute DhcpOptionCode = 33 // Link Layer Parameters per Interface OptionTrailerEncapsulation DhcpOptionCode = 34 OptionARPCacheTimeout DhcpOptionCode = 35 OptionEthernetEncapsulation DhcpOptionCode = 36 // TCP Parameters OptionTCPDefaultTTL DhcpOptionCode = 37 OptionTCPKeepaliveInterval DhcpOptionCode = 38 OptionTCPKeepaliveGarbage DhcpOptionCode = 39 // Application and Service Parameters OptionNetworkInformationServiceDomain DhcpOptionCode = 40 OptionNetworkInformationServers DhcpOptionCode = 41 OptionNetworkTimeProtocolServers DhcpOptionCode = 42 OptionVendorSpecificInformation DhcpOptionCode = 43 OptionNetBIOSOverTCPIPNameServer DhcpOptionCode = 44 OptionNetBIOSOverTCPIPDatagramDistributionServer DhcpOptionCode = 45 OptionNetBIOSOverTCPIPNodeType DhcpOptionCode = 46 OptionNetBIOSOverTCPIPScope DhcpOptionCode = 47 OptionXWindowSystemFontServer DhcpOptionCode = 48 OptionXWindowSystemDisplayManager DhcpOptionCode = 49 OptionNetworkInformationServicePlusDomain DhcpOptionCode = 64 OptionNetworkInformationServicePlusServers DhcpOptionCode = 65 OptionMobileIPHomeAgent DhcpOptionCode = 68 OptionSimpleMailTransportProtocol DhcpOptionCode = 69 OptionPostOfficeProtocolServer DhcpOptionCode = 70 OptionNetworkNewsTransportProtocol DhcpOptionCode = 71 OptionDefaultWorldWideWebServer DhcpOptionCode = 72 OptionDefaultFingerServer DhcpOptionCode = 73 OptionDefaultInternetRelayChatServer DhcpOptionCode = 74 OptionStreetTalkServer DhcpOptionCode = 75 OptionStreetTalkDirectoryAssistance DhcpOptionCode = 76 OptionRelayAgentInformation DhcpOptionCode = 82 // DHCP Extensions OptionRequestedIPAddress DhcpOptionCode = 50 OptionIPAddressLeaseTime DhcpOptionCode = 51 OptionOverload DhcpOptionCode = 52 OptionDHCPMessageType DhcpOptionCode = 53 OptionServerIdentifier DhcpOptionCode = 54 OptionParameterRequestList DhcpOptionCode = 55 OptionMessage DhcpOptionCode = 56 OptionMaximumDHCPMessageSize DhcpOptionCode = 57 OptionRenewalTimeValue DhcpOptionCode = 58 OptionRebindingTimeValue DhcpOptionCode = 59 OptionVendorClassIdentifier DhcpOptionCode = 60 OptionClientIdentifier DhcpOptionCode = 61 OptionTFTPServerName DhcpOptionCode = 66 OptionBootFileName DhcpOptionCode = 67 OptionUserClass DhcpOptionCode = 77 OptionClientArchitecture DhcpOptionCode = 93 OptionTZPOSIXString DhcpOptionCode = 100 OptionTZDatabaseString DhcpOptionCode = 101 OptionClasslessRouteFormat DhcpOptionCode = 121 )
DHCP Available Options enum type.... This will cover most of the options type
type DhcpRelayAgentGlobalInfo ¶
type DhcpRelayAgentGlobalInfo struct { IntfConfig dhcprelayd.DhcpRelayIntf PcapHandle *pcap.Handle IpAddr string Netmask string }
* Global DRA Data Structure: * IntfConfig Info * PCAP Handler specific to Interface
type DhcpRelayAgentIntfInfo ¶
type DhcpRelayAgentIntfInfo struct { IfIndex int32 // contains filtered or unexported fields }
type DhcpRelayAgentOptions ¶
type DhcpRelayAgentOptions map[DhcpOptionCode][]byte
Map of DHCP options
func (DhcpRelayAgentOptions) SelectOrder ¶
func (o DhcpRelayAgentOptions) SelectOrder(order []byte) []Option
SelectOrder returns a slice of options ordered and selected by a byte array usually defined by OptionParameterRequestList. This result is expected to be used in ReplyPacket()'s []Option parameter.
func (DhcpRelayAgentOptions) SelectOrderOrAll ¶
func (o DhcpRelayAgentOptions) SelectOrderOrAll(order []byte) []Option
SelectOrderOrAll has same functionality as SelectOrder, except if the order param is nil, whereby all options are added (in arbitary order).
type DhcpRelayAgentPacket ¶
type DhcpRelayAgentPacket []byte
A DHCP packet
func DhcpRelayAgentCreateNewPacket ¶
func DhcpRelayAgentCreateNewPacket(opCode OpCode, inReq DhcpRelayAgentPacket) DhcpRelayAgentPacket
* API to create a new Dhcp packet with Relay Agent information in it
func (*DhcpRelayAgentPacket) AddDhcpOptions ¶
func (p *DhcpRelayAgentPacket) AddDhcpOptions(op DhcpOptionCode, value []byte)
Appends a DHCP option to the end of a packet
func (DhcpRelayAgentPacket) AllocateOptions ¶
func (p DhcpRelayAgentPacket) AllocateOptions() []byte
func (DhcpRelayAgentPacket) GetCHAddr ¶
func (p DhcpRelayAgentPacket) GetCHAddr() net.HardwareAddr
func (DhcpRelayAgentPacket) GetCIAddr ¶
func (p DhcpRelayAgentPacket) GetCIAddr() net.IP
func (DhcpRelayAgentPacket) GetCookie ¶
func (p DhcpRelayAgentPacket) GetCookie() []byte
func (DhcpRelayAgentPacket) GetFlags ¶
func (p DhcpRelayAgentPacket) GetFlags() []byte
func (DhcpRelayAgentPacket) GetGIAddr ¶
func (p DhcpRelayAgentPacket) GetGIAddr() net.IP
func (DhcpRelayAgentPacket) GetHeaderLen ¶
func (p DhcpRelayAgentPacket) GetHeaderLen() byte
========================HELPER FUNCTIONS FOR DHCP =========================
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | op (1) | htype (1) | hlen (1) | hops (1) | +---------------+---------------+---------------+---------------+ | xid (4) | +-------------------------------+-------------------------------+ | secs (2) | flags (2) | +-------------------------------+-------------------------------+ | ciaddr (4) | +---------------------------------------------------------------+ | yiaddr (4) | +---------------------------------------------------------------+ | siaddr (4) | +---------------------------------------------------------------+ | giaddr (4) | +---------------------------------------------------------------+ | | | chaddr (16) | | | | | +---------------------------------------------------------------+ | | | sname (64) | +---------------------------------------------------------------+ | | | file (128) | +---------------------------------------------------------------+ | | | options (variable) | +---------------------------------------------------------------+
* ========================GET API's FOR ABOVE MESSAGE FORMAT==================
func (DhcpRelayAgentPacket) GetHeaderType ¶
func (p DhcpRelayAgentPacket) GetHeaderType() byte
func (DhcpRelayAgentPacket) GetHops ¶
func (p DhcpRelayAgentPacket) GetHops() byte
func (DhcpRelayAgentPacket) GetOpCode ¶
func (p DhcpRelayAgentPacket) GetOpCode() OpCode
func (DhcpRelayAgentPacket) GetSIAddr ¶
func (p DhcpRelayAgentPacket) GetSIAddr() net.IP
func (DhcpRelayAgentPacket) GetSecs ¶
func (p DhcpRelayAgentPacket) GetSecs() []byte
func (DhcpRelayAgentPacket) GetXId ¶
func (p DhcpRelayAgentPacket) GetXId() []byte
func (DhcpRelayAgentPacket) GetYIAddr ¶
func (p DhcpRelayAgentPacket) GetYIAddr() net.IP
func (*DhcpRelayAgentPacket) PadToMinSize ¶
func (p *DhcpRelayAgentPacket) PadToMinSize()
func (DhcpRelayAgentPacket) ParseDhcpOptions ¶
func (p DhcpRelayAgentPacket) ParseDhcpOptions() DhcpRelayAgentOptions
Parses the packet's options into an Options map
func (DhcpRelayAgentPacket) SetCHAddr ¶
func (p DhcpRelayAgentPacket) SetCHAddr(a net.HardwareAddr)
func (DhcpRelayAgentPacket) SetCIAddr ¶
func (p DhcpRelayAgentPacket) SetCIAddr(ip net.IP)
func (DhcpRelayAgentPacket) SetCookie ¶
func (p DhcpRelayAgentPacket) SetCookie(cookie []byte)
func (DhcpRelayAgentPacket) SetFile ¶
func (p DhcpRelayAgentPacket) SetFile(file []byte)
BOOTP legacy
func (DhcpRelayAgentPacket) SetFlags ¶
func (p DhcpRelayAgentPacket) SetFlags(flags []byte)
func (DhcpRelayAgentPacket) SetGIAddr ¶
func (p DhcpRelayAgentPacket) SetGIAddr(ip net.IP)
func (DhcpRelayAgentPacket) SetHeaderType ¶
func (p DhcpRelayAgentPacket) SetHeaderType(hType byte)
func (DhcpRelayAgentPacket) SetHops ¶
func (p DhcpRelayAgentPacket) SetHops(hops byte)
func (DhcpRelayAgentPacket) SetOpCode ¶
func (p DhcpRelayAgentPacket) SetOpCode(c OpCode)
* ========================SET API's FOR ABOVE MESSAGE FORMAT==================
func (DhcpRelayAgentPacket) SetSIAddr ¶
func (p DhcpRelayAgentPacket) SetSIAddr(ip net.IP)
func (DhcpRelayAgentPacket) SetSName ¶
func (p DhcpRelayAgentPacket) SetSName(sName []byte)
BOOTP legacy
func (DhcpRelayAgentPacket) SetSecs ¶
func (p DhcpRelayAgentPacket) SetSecs(secs []byte)
func (DhcpRelayAgentPacket) SetXId ¶
func (p DhcpRelayAgentPacket) SetXId(xId []byte)
func (DhcpRelayAgentPacket) SetYIAddr ¶
func (p DhcpRelayAgentPacket) SetYIAddr(ip net.IP)
type DhcpRelayClientJson ¶
func DhcpRelayGetClient ¶
type DhcpRelayPktChannel ¶
type DhcpRelayPktChannel struct {
// contains filtered or unexported fields
}
type DhcpRelayServiceHandler ¶
type DhcpRelayServiceHandler struct { }
* Global DS local to DHCP RELAY AGENT
func NewDhcpRelayServer ¶
func NewDhcpRelayServer() *DhcpRelayServiceHandler
func (*DhcpRelayServiceHandler) CreateDhcpRelayGlobal ¶
func (h *DhcpRelayServiceHandler) CreateDhcpRelayGlobal(config *dhcprelayd.DhcpRelayGlobal) (bool, error)
func (*DhcpRelayServiceHandler) CreateDhcpRelayIntf ¶
func (h *DhcpRelayServiceHandler) CreateDhcpRelayIntf(config *dhcprelayd.DhcpRelayIntf) (bool, error)
func (*DhcpRelayServiceHandler) DeleteDhcpRelayGlobal ¶
func (h *DhcpRelayServiceHandler) DeleteDhcpRelayGlobal(config *dhcprelayd.DhcpRelayGlobal) (bool, error)
func (*DhcpRelayServiceHandler) DeleteDhcpRelayIntf ¶
func (h *DhcpRelayServiceHandler) DeleteDhcpRelayIntf(config *dhcprelayd.DhcpRelayIntf) (bool, error)
func (*DhcpRelayServiceHandler) GetBulkDhcpRelayHostDhcpState ¶
func (h *DhcpRelayServiceHandler) GetBulkDhcpRelayHostDhcpState(fromIndex dhcprelayd.Int, count dhcprelayd.Int) (hostEntry *dhcprelayd.DhcpRelayHostDhcpStateGetInfo, err error)
func (*DhcpRelayServiceHandler) GetBulkDhcpRelayIntfServerState ¶
func (h *DhcpRelayServiceHandler) GetBulkDhcpRelayIntfServerState(fromIndex dhcprelayd.Int, count dhcprelayd.Int) (intfServerEntry *dhcprelayd.DhcpRelayIntfServerStateGetInfo, err error)
func (*DhcpRelayServiceHandler) GetBulkDhcpRelayIntfState ¶
func (h *DhcpRelayServiceHandler) GetBulkDhcpRelayIntfState(fromIndex dhcprelayd.Int, count dhcprelayd.Int) (intfEntry *dhcprelayd.DhcpRelayIntfStateGetInfo, err error)
func (*DhcpRelayServiceHandler) GetDhcpRelayHostDhcpState ¶
func (h *DhcpRelayServiceHandler) GetDhcpRelayHostDhcpState(macAddr string) (*dhcprelayd.DhcpRelayHostDhcpState, error)
func (*DhcpRelayServiceHandler) GetDhcpRelayIntfServerState ¶
func (h *DhcpRelayServiceHandler) GetDhcpRelayIntfServerState(ifIndex int32) (*dhcprelayd.DhcpRelayIntfServerState, error)
func (*DhcpRelayServiceHandler) GetDhcpRelayIntfState ¶
func (h *DhcpRelayServiceHandler) GetDhcpRelayIntfState(ifIndex int32) (*dhcprelayd.DhcpRelayIntfState, error)
func (*DhcpRelayServiceHandler) UpdateDhcpRelayGlobal ¶
func (h *DhcpRelayServiceHandler) UpdateDhcpRelayGlobal(origconfig *dhcprelayd.DhcpRelayGlobal, newconfig *dhcprelayd.DhcpRelayGlobal, attrset []bool, op []*dhcprelayd.PatchOpInfo) (bool, error)
func (*DhcpRelayServiceHandler) UpdateDhcpRelayIntf ¶
func (h *DhcpRelayServiceHandler) UpdateDhcpRelayIntf(origconfig *dhcprelayd.DhcpRelayIntf, newconfig *dhcprelayd.DhcpRelayIntf, attrset []bool, op []*dhcprelayd.PatchOpInfo) (bool, error)
type MessageType ¶
type MessageType byte // Option 53
const ( DhcpDiscover MessageType = 1 // From Client DhcpOffer MessageType = 2 // From Server DhcpRequest MessageType = 3 // From Client DhcpDecline MessageType = 4 // From Client DhcpACK MessageType = 5 // From Server DhcpNAK MessageType = 6 // From Server DhcpRelease MessageType = 7 // From Client DhcpInform MessageType = 8 // From Client )
DHCP Client/Server Message Type 53
type Option ¶
type Option struct { Code DhcpOptionCode Value []byte }