Choco OS  V.0.16.9.0
Join to the chocolate world
Dhcp

Functions

oC_ErrorCode_t oC_Dhcp_SendMessage (oC_Netif_t Netif, oC_Dhcp_Message_t *Message, uint16_t Size, oC_Time_t Timeout)
 sends DHCP message to DHCP server More...
 
oC_ErrorCode_t oC_Dhcp_ReceiveMessage (oC_Netif_t Netif, oC_Dhcp_Message_t *outMessage, oC_Time_t Timeout)
 receives DHCP message from DHCP server More...
 
oC_ErrorCode_t oC_Dhcp_RequestIp (oC_Netif_t Netif, oC_Time_t Timeout)
 performs DHCP IP request procedure More...
 
oC_ErrorCode_t oC_Dhcp_SendDiscovery (oC_Netif_t Netif, oC_Time_t Timeout)
 sends DHCP discovery message to DHCP server More...
 
oC_ErrorCode_t oC_Dhcp_ReceiveOffer (oC_Netif_t Netif, oC_Time_t Timeout)
 receives offer from the DHCP server More...
 
oC_ErrorCode_t oC_Dhcp_SendRequest (oC_Netif_t Netif, oC_Time_t Timeout)
 sends request message to the DHCP server More...
 
oC_ErrorCode_t oC_Dhcp_ReceiveAcknowledge (oC_Netif_t Netif, oC_Time_t Timeout)
 receives ACK message from DHCP server More...
 

Detailed Description

Function Documentation

oC_ErrorCode_t oC_Dhcp_ReceiveAcknowledge ( oC_Netif_t  Netif,
oC_Time_t  Timeout 
)

The function allows to receive an DHCP acknowledge from the DHCP server. The function oC_Dhcp_SendRequest should be called before this one.

Warning
When more than 2 threads tries to receive an acknowledge at the same time, from the same network interface, they can disturb each other, as this function reads all messages transfered by the given Netif, and it throws out the not matched messages.
Parameters
NetifPointer to the configured network interface
TimeoutMaximum time for the receive request
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Netif is not correct (address is not correct or not valid anymore)
oC_ErrorCode_NotConfiguredYet The Netif is not configured (oC_Netif_Configure has not been called)
oC_ErrorCode_Timeout Maximum time for the request elapsed
See also
oC_Dhcp_SendRequest

Definition at line 712 of file oc_dhcp.c.

oC_ErrorCode_t oC_Dhcp_ReceiveMessage ( oC_Netif_t  Netif,
oC_Dhcp_Message_t outMessage,
oC_Time_t  Timeout 
)

The function receives DHCP message from DHCP server.

Parameters
NetifPointer to the configured network interface
outMessageDestination for the DHCP message
TimeoutMaximum time for the receive request
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Netif is not correct (address is not correct or not valid anymore)
oC_ErrorCode_OutputAddressNotInRAM outMessage address does not contain address in RAM section
oC_ErrorCode_NotConfiguredYet The Netif is not configured (oC_Netif_Configure has not been called)
oC_ErrorCode_PortNotReserved DHCP client UDP port is not reserved - please reserve it by using oC_Udp_ReservePort interface

Definition at line 179 of file oc_dhcp.c.

oC_ErrorCode_t oC_Dhcp_ReceiveOffer ( oC_Netif_t  Netif,
oC_Time_t  Timeout 
)

The function allows to receive an DHCP offer from the DHCP server. The function oC_Dhcp_SendDiscovery should be called before this one.

Warning
When more than 2 threads tries to receive an offer at the same time, from the same network interface, they can disturb each other, as this function reads all messages transfered by the given Netif, and it throws out the not matched messages.
Parameters
NetifPointer to the configured network interface
TimeoutMaximum time for the receive request
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Netif is not correct (address is not correct or not valid anymore)
oC_ErrorCode_NotConfiguredYet The Netif is not configured (oC_Netif_Configure has not been called)
oC_ErrorCode_Timeout Maximum time for the request elapsed
See also
oC_Dhcp_SendDiscovery

Definition at line 423 of file oc_dhcp.c.

oC_ErrorCode_t oC_Dhcp_RequestIp ( oC_Netif_t  Netif,
oC_Time_t  Timeout 
)

The function is for performing DHCP request IP procedure. It can be called only by the root user.

Parameters
NetifPointer to the configured network interface
TimeoutMaximum time for the request
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_NetifNotCorrect Netif is not correct (address is not correct or not valid anymore)
oC_ErrorCode_NotConfiguredYet The Netif is not configured (oC_Netif_Configure has not been called)
oC_ErrorCode_LinkNotDetected The Netif list state is not UP
oC_ErrorCode_TimeNotCorrect Timeout is smaller than 0!
oC_ErrorCode_Timeout Maximum time for the request elapsed
oC_ErrorCode_PermissionDenied You are not root user!
See also
oC_Dhcp_ReceiveOffer

Definition at line 232 of file oc_dhcp.c.

oC_ErrorCode_t oC_Dhcp_SendDiscovery ( oC_Netif_t  Netif,
oC_Time_t  Timeout 
)

The function sends DHCP discovery message to the DHCP server, which begins the IP reservation process. The next function that should be called after this one is oC_Dhcp_ReceiveOffer.

Parameters
NetifPointer to the configured network interface
TimeoutMaximum time for the receive request
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Netif is not correct (address is not correct or not valid anymore)
oC_ErrorCode_UnknownHardwareType Netif is an network interface with unknown or unsupported hardware type.
oC_ErrorCode_NotConfiguredYet The Netif is not configured (oC_Netif_Configure has not been called)
oC_ErrorCode_Timeout Maximum time for the request elapsed
See also
oC_Dhcp_ReceiveOffer

Definition at line 286 of file oc_dhcp.c.

oC_ErrorCode_t oC_Dhcp_SendMessage ( oC_Netif_t  Netif,
oC_Dhcp_Message_t Message,
uint16_t  Size,
oC_Time_t  Timeout 
)

The function sends the DHCP message to the DHCP server.

Parameters
NetifPointer to the configured network interface
MessageDHCP message to send
SizeAligned size of the DHCP message
TimeoutMaximum time for the request
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Netif is not correct (address is not correct or not valid anymore)
oC_ErrorCode_WrongAddress Message address is not correct
oC_ErrorCode_NotConfiguredYet The Netif is not configured (oC_Netif_Configure has not been called)
oC_ErrorCode_AllocationError Cannot allocate memory for a packet
oC_ErrorCode_PortNotReserved DHCP client UDP port is not reserved - please reserve it by using oC_Udp_ReservePort interface

More error codes can be returned from the function oC_Udp_Send

Definition at line 112 of file oc_dhcp.c.

oC_ErrorCode_t oC_Dhcp_SendRequest ( oC_Netif_t  Netif,
oC_Time_t  Timeout 
)

The function sends DHCP requet message to the DHCP server.

Parameters
NetifPointer to the configured network interface
TimeoutMaximum time for the request
Returns
code of error or oC_ErrorCode_None if success

List of standard error codes, that can be returned by the function:

Code of error Description
oC_ErrorCode_ObjectNotCorrect Netif is not correct (address is not correct or not valid anymore)
oC_ErrorCode_UnknownHardwareType Type of the network interface hardware is not supported or not correct
oC_ErrorCode_NotConfiguredYet The Netif is not configured (oC_Netif_Configure has not been called)
oC_ErrorCode_Timeout Maximum time for the request elapsed
See also
oC_Dhcp_SendDiscovery

Definition at line 604 of file oc_dhcp.c.