Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.13.1.2
openapi_dhcp_client.h
Go to the documentation of this file.
1 
9 /*********************************************************************
10 *
11 * Copyright 2016-2021 Broadcom.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 **********************************************************************
26 *
27 * @filename openapi_dhcp_client.h
28 *
29 * @purpose DHCP Client configuration and Status
30 *
31 * @component OpEN
32 *
33 * @create 10/30/2015
34 *
35 * @end
36 *
37 **********************************************************************/
38 #ifndef OPENAPI_DHCP_CLIENT_H_INCLUDED
39 #define OPENAPI_DHCP_CLIENT_H_INCLUDED
40 
41 #include "openapi_common.h"
42 #include "openapi_dns.h"
43 #include "openapi_sntp.h"
44 
45 #define OPEN_DHCP_VENDOR_SPECIFIC_SUBOPTIONS_NUM 3
46 #define OPEN_DHCP_BOOTP_VEND_OPTIONS_LEN 64
47 #define OPEN_DHCP_OPT125_VENDOR_NUMBER_MAX 3
48 
49 #define OPEN_HOSTNAME_MAX_LEN 64
50 #define OPEN_BOOTP_FILE_LEN 128
51 #define OPEN_BOOTP_SNAME_LEN 64
52 #define OPEN_DNS_NAME_SERVER_ENTRIES 8
53 #define OPEN_NTP_MAX_SERVER_ENTRIES 12
54 #define OPENAPI_DNS_HOST_NAME_LEN_MAX 255
55 
56 typedef struct
57 {
58  unsigned char type;
59  unsigned char len;
60  unsigned char option[OPEN_DHCP_BOOTP_VEND_OPTIONS_LEN];
62 
63 typedef struct
64 {
65  unsigned char numSubOptions;
66  open_tlv_option_t subOptions[OPEN_DHCP_VENDOR_SPECIFIC_SUBOPTIONS_NUM];
68 
69 typedef struct
70 {
71  uint32_t vendorID;
72  unsigned char numSubOptions;
73  open_tlv_option_t subOptions[OPEN_DHCP_VENDOR_SPECIFIC_SUBOPTIONS_NUM];
75 
76 typedef struct
77 {
78  open_dhcp_vendor_sub_opt_t vendor[OPEN_DHCP_OPT125_VENDOR_NUMBER_MAX];
80 
81 typedef enum
82 {
83  OPEN_BOOTP_DHCP_IP_ADDR = 1,
84  OPEN_BOOTP_DHCP_NETMASK = 2,
85  OPEN_BOOTP_DHCP_GATEWAY = 4,
86  OPEN_BOOTP_DHCP_SIADDR = 8,
87  OPEN_BOOTP_DHCP_BOOTFILE = 16,
88  OPEN_BOOTP_DHCP_SNAME = 32,
89  OPEN_BOOTP_DHCP_OPTION_TFTP_SVR_ADDR = 64,
90  OPEN_BOOTP_DHCP_OPTION_DNS_SVR_ADDR = 128,
91  OPEN_BOOTP_DHCP_OPTION_BOOTFILE = 256,
92  OPEN_BOOTP_DHCP_OPTION_TFTP_SVR_NAME = 512,
93  OPEN_BOOTP_DHCP_OPTION_VENDOR_SPECIFIC = 1024,
94  OPEN_BOOTP_DHCP_OPTION_VENDOR_IDENT = 2048,
95  OPEN_BOOTP_DHCP_OPTION_HOSTNAME = 4096,
96  OPEN_BOOTP_DHCP_OPTION_DEF_DOMAIN_NAME = 8192,
97  OPEN_BOOTP_DHCP_OPTION_NTP_SVR_ADDR = 16384,
98  OPEN_BOOTP_DHCP_OPTION_SYSLOG_SVR_ADDR = 32768,
99  OPEN_BOOTP_DHCP_OPTION_MGMT_PORT_TYPE = 65536,
100  OPEN_BOOTP_DHCP_OPTION_INT_IF_NUM = 131072,
101  OPEN_BOOTP_DHCP_OPTION_CHANGE_TYPE = 262144
102 } open_bootp_dhcp_offered_options_e;
103 
105 typedef struct
106 {
107  uint32_t ip;
108  uint32_t netMask;
109  uint32_t gateway;
110  uint32_t siaddr;
111  uint32_t optTftpSvrIpAddr;
112  uint32_t optDnsServerIpAddr[OPEN_DNS_NAME_SERVER_ENTRIES];
113  unsigned char optDefDomainName[OPENAPI_DNS_HOST_NAME_LEN_MAX + 1];
114  unsigned char optHostName[OPEN_HOSTNAME_MAX_LEN + 1];
115  uint32_t optNtpServerIpAddr[OPEN_NTP_MAX_SERVER_ENTRIES];
116  unsigned char bootFile[OPEN_BOOTP_FILE_LEN + 1];
117  unsigned char optBootFile[OPEN_BOOTP_FILE_LEN + 1];
118  unsigned char sname[OPEN_BOOTP_SNAME_LEN + 1];
119  unsigned char optTftpSvrName[OPEN_BOOTP_SNAME_LEN + 1];
125  uint32_t mgmtPortType;
126  uint32_t intIfNum;
127  uint32_t changeType;
129 
130 /*****************************************************************/
147  uint32_t intIfNum,
148  open_inet_addr_t *clientAddr);
149 
150 /*****************************************************************/
167  uint32_t intIfNum,
168  open_inet_addr_t *netmask);
169 
170 /*****************************************************************/
187  uint32_t intIfNum,
188  open_inet_addr_t *serverAddr);
189 
190 /*****************************************************************/
209  open_bootp_dhcp_t *networkParams);
210 #endif /* OPENAPI_DHCP_CLIENT_H_INCLUDED */
211 
uint32_t ip
Host IP address.
open_dhcp_option125_t opt125
Opt 125.
uint32_t offeredOptionsMask
Mask holds offered options IDs.
open_error_t openapiDhcpClientIPAddrGet(openapiClientHandle_t *client_handle, uint32_t intIfNum, open_inet_addr_t *clientAddr)
Get the DHCP Client IP Address on an interface.
uint32_t gateway
Gateway.
uint32_t mgmtPortType
Management port type.
uint32_t netMask
Host netmask.
open_error_t openapiDhcpClientOptionsGet(openapiClientHandle_t *client_handle, open_bootp_dhcp_t *networkParams)
Get the DHCP Options returned by the DHCP Server.
open_error_t
OPEN uses these enumerators to indicate the error codes.
uint32_t intIfNum
Internal interface number if port type is not service or network.
uint32_t optTftpSvrIpAddr
IP addres of TFTP server, got from option 150 field.
#define OPENAPI_DNS_HOST_NAME_LEN_MAX
maximum value
OPEN_BOOL_t dhcpAddressFlushFlag
Flag indicating DHCP address removal in progress.
open_dhcp_vendor_specific_option_t * vendSpecificOptions
DHCP Option-43.
#define OPEN_DNS_NAME_SERVER_ENTRIES
maximum value
open_error_t openapiDhcpClientDhcpServerIPAddrGet(openapiClientHandle_t *client_handle, uint32_t intIfNum, open_inet_addr_t *serverAddr)
Get the DHCP Server IP Address on an interface.
uint32_t siaddr
Next server address.
OPEN_BOOL_t
OPEN uses these enumerators to indicate true or false for a given config or status parameter...
open_error_t openapiDhcpClientNetMaskGet(openapiClientHandle_t *client_handle, uint32_t intIfNum, open_inet_addr_t *netmask)
Get the DHCP Client subnet mask on an interface.
uint32_t changeType
Type of change to the DHCP info.