Definitions common to DHCP client and server. More...
Go to the source code of this file.
Macros | |
#define | DHCP_SERVER_PORT 67 |
#define | DHCP_CLIENT_PORT 68 |
#define | DHCP_MIN_MSG_SIZE 300 |
#define | DHCP_MAX_MSG_SIZE 548 |
#define | DHCP_HARDWARE_TYPE_ETH 1 |
#define | DHCP_MAGIC_COOKIE 0x63825363 |
#define | DHCP_INFINITE_TIME 0xFFFFFFFF |
Functions | |
error_t | dhcpAddOption (DhcpMessage *message, size_t *messageLen, uint8_t optionCode, const void *optionValue, size_t optionLen) |
Append an option to a DHCP message. More... | |
DhcpOption * | dhcpGetOption (const DhcpMessage *message, size_t length, uint8_t optionCode) |
Search a DHCP message for a given option. More... | |
Variables | |
typedef | __packed_struct |
DHCP message. More... | |
uint8_t | htype |
uint8_t | hlen |
uint8_t | hops |
uint32_t | xid |
uint16_t | secs |
uint16_t | flags |
Ipv4Addr | ciaddr |
Ipv4Addr | yiaddr |
Ipv4Addr | siaddr |
Ipv4Addr | giaddr |
MacAddr | chaddr |
uint8_t | unused [10] |
uint8_t | sname [64] |
uint8_t | file [128] |
uint32_t | magicCookie |
uint8_t | options [] |
DhcpMessage | |
uint8_t | length |
uint8_t | value [] |
DhcpOption | |
Detailed Description
Definitions common to DHCP client and server.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file dhcp_common.h.
Macro Definition Documentation
◆ DHCP_CLIENT_PORT
#define DHCP_CLIENT_PORT 68 |
Definition at line 41 of file dhcp_common.h.
◆ DHCP_HARDWARE_TYPE_ETH
#define DHCP_HARDWARE_TYPE_ETH 1 |
Definition at line 49 of file dhcp_common.h.
◆ DHCP_INFINITE_TIME
#define DHCP_INFINITE_TIME 0xFFFFFFFF |
Definition at line 53 of file dhcp_common.h.
◆ DHCP_MAGIC_COOKIE
#define DHCP_MAGIC_COOKIE 0x63825363 |
Definition at line 51 of file dhcp_common.h.
◆ DHCP_MAX_MSG_SIZE
#define DHCP_MAX_MSG_SIZE 548 |
Definition at line 46 of file dhcp_common.h.
◆ DHCP_MIN_MSG_SIZE
#define DHCP_MIN_MSG_SIZE 300 |
Definition at line 44 of file dhcp_common.h.
◆ DHCP_SERVER_PORT
#define DHCP_SERVER_PORT 67 |
Definition at line 40 of file dhcp_common.h.
Enumeration Type Documentation
◆ DhcpFlags
enum DhcpFlags |
DHCP flags.
Enumerator | |
---|---|
DHCP_FLAG_UNICAST | |
DHCP_FLAG_BROADCAST |
Definition at line 76 of file dhcp_common.h.
◆ DhcpMessageType
enum DhcpMessageType |
DHCP message types.
Enumerator | |
---|---|
DHCP_MSG_TYPE_DISCOVER | |
DHCP_MSG_TYPE_OFFER | |
DHCP_MSG_TYPE_REQUEST | |
DHCP_MSG_TYPE_DECLINE | |
DHCP_MSG_TYPE_ACK | |
DHCP_MSG_TYPE_NAK | |
DHCP_MSG_TYPE_RELEASE | |
DHCP_MSG_TYPE_INFORM |
Definition at line 87 of file dhcp_common.h.
◆ DhcpOpcode
enum DhcpOpcode |
DHCP opcodes.
Enumerator | |
---|---|
DHCP_OPCODE_BOOTREQUEST | |
DHCP_OPCODE_BOOTREPLY |
Definition at line 65 of file dhcp_common.h.
◆ DhcpOptionCode
enum DhcpOptionCode |
DHCP option codes.
Definition at line 104 of file dhcp_common.h.
Function Documentation
◆ dhcpAddOption()
error_t dhcpAddOption | ( | DhcpMessage * | message, |
size_t * | messageLen, | ||
uint8_t | optionCode, | ||
const void * | optionValue, | ||
size_t | optionLen | ||
) |
Append an option to a DHCP message.
- Parameters
-
[in] message Pointer to the DHCP message [in,out] messageLen Actual length of the DHCP message [in] optionCode Option code [in] optionValue Option value [in] optionLen Length of the option value
- Returns
- Error code
Definition at line 56 of file dhcp_common.c.
◆ dhcpGetOption()
DhcpOption* dhcpGetOption | ( | const DhcpMessage * | message, |
size_t | length, | ||
uint8_t | optionCode | ||
) |
Search a DHCP message for a given option.
- Parameters
-
[in] message Pointer to the DHCP message [in] length Length of the message [in] optionCode Code of the option to find
- Returns
- If the specified option is found, a pointer to the corresponding option is returned. Otherwise NULL pointer is returned
Definition at line 118 of file dhcp_common.c.
Variable Documentation
◆ __packed_struct
typedef __packed_struct |
◆ chaddr
MacAddr chaddr |
Definition at line 220 of file dhcp_common.h.
◆ ciaddr
Ipv4Addr ciaddr |
Definition at line 216 of file dhcp_common.h.
◆ DhcpMessage
DhcpMessage |
Definition at line 226 of file dhcp_common.h.
◆ DhcpOption
DhcpOption |
Definition at line 238 of file dhcp_common.h.
◆ file
uint8_t file[128] |
Definition at line 223 of file dhcp_common.h.
◆ flags
uint16_t flags |
Definition at line 215 of file dhcp_common.h.
◆ giaddr
Ipv4Addr giaddr |
Definition at line 219 of file dhcp_common.h.
◆ hlen
uint8_t hlen |
Definition at line 211 of file dhcp_common.h.
◆ hops
uint8_t hops |
Definition at line 212 of file dhcp_common.h.
◆ htype
uint8_t htype |
Definition at line 210 of file dhcp_common.h.
◆ length
uint8_t length |
Definition at line 236 of file dhcp_common.h.
◆ magicCookie
uint32_t magicCookie |
Definition at line 224 of file dhcp_common.h.
◆ options
uint8_t options[] |
Definition at line 225 of file dhcp_common.h.
◆ secs
uint16_t secs |
Definition at line 214 of file dhcp_common.h.
◆ siaddr
Ipv4Addr siaddr |
Definition at line 218 of file dhcp_common.h.
◆ sname
uint8_t sname[64] |
Definition at line 222 of file dhcp_common.h.
◆ unused
uint32_t unused |
Definition at line 221 of file dhcp_common.h.
◆ value
uint8_t value[] |
Definition at line 237 of file dhcp_common.h.
◆ xid
uint32_t xid |
Definition at line 213 of file dhcp_common.h.
◆ yiaddr
Ipv4Addr yiaddr |
Definition at line 217 of file dhcp_common.h.