Choco OS  V.0.16.9.0
Join to the chocolate world
oc_dhcp.c File Reference

The file with sources for the DHCP module. More...

#include <oc_dhcp.h>
#include <oc_netif.h>
#include <oc_debug.h>
#include <oc_memman.h>
#include <oc_math.h>
#include <oc_ktime.h>
#include <oc_udp.h>

Go to the source code of this file.

Functions

static oC_Dhcp_HardwareType_t TranslateToDhcpHardwareType (oC_Net_HardwareType_t HardwareType)
 translates oC_Net_HardwareType_t to oC_Dhcp_HardwareType_t
 
static uint32_t GetHardwareAddressLength (oC_Dhcp_HardwareType_t HardwareType)
 returns number of bytes required for storing hardware address
 
static uint8_t * AddOption (uint8_t *OptionsArray, uint32_t *LeftBytes, oC_Dhcp_Option_t Option, oC_Dhcp_OptionLength_t Length, uint8_t *Data)
 adds option to the options array More...
 
static bool FindNextOption (uint8_t *OptionsArray, uint32_t LeftBytes, oC_Dhcp_Option_t *outOption, oC_Dhcp_OptionLength_t *outLength)
 checks if is there any more option in the options array
 
static uint8_t * ReadOption (uint8_t *OptionsArray, uint32_t *LeftBytes, uint8_t *outData)
 reads option in the Options array and returns pointer to the next option
 
static void ConvertToNetworkEndianess (oC_Dhcp_Message_t *Message)
 converts message to network endianess
 
static void ConvertFromNetworkEndianess (oC_Dhcp_Message_t *Message)
 converts message from network endianess
 
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


Author
Patryk Kubiak
Note
Copyright (C) 2016 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak9.nosp@m.0@gm.nosp@m.ail.c.nosp@m.om

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Definition in file oc_dhcp.c.

Function Documentation

static uint8_t * AddOption ( uint8_t *  OptionsArray,
uint32_t *  LeftBytes,
oC_Dhcp_Option_t  Option,
oC_Dhcp_OptionLength_t  Length,
uint8_t *  Data 
)
static

The function adds DHCP option do the options array.

Parameters
OptionsArrayPointer to the options array
LeftBytesPointer to the variable that stores number of bytes that left in the options array. It is updated by the function after
OptionOption to add
LengthLength of the option
DataOptional (can be NULL) pointer to the data that should be added after this option
Returns
new pointer to the end of the array

Definition at line 941 of file oc_dhcp.c.