1518678f8Sopenharmony_ci/* 2518678f8Sopenharmony_ci * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 3518678f8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4518678f8Sopenharmony_ci * you may not use this file except in compliance with the License. 5518678f8Sopenharmony_ci * You may obtain a copy of the License at 6518678f8Sopenharmony_ci * 7518678f8Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8518678f8Sopenharmony_ci * 9518678f8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10518678f8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11518678f8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12518678f8Sopenharmony_ci * See the License for the specific language governing permissions and 13518678f8Sopenharmony_ci * limitations under the License. 14518678f8Sopenharmony_ci */ 15518678f8Sopenharmony_ci 16518678f8Sopenharmony_ci#ifndef OHOS_DHCP_CONFIG_H 17518678f8Sopenharmony_ci#define OHOS_DHCP_CONFIG_H 18518678f8Sopenharmony_ci 19518678f8Sopenharmony_ci#include <stdint.h> 20518678f8Sopenharmony_ci#include "dhcp_address_pool.h" 21518678f8Sopenharmony_ci#include "dhcp_s_define.h" 22518678f8Sopenharmony_ci#include "dhcp_option.h" 23518678f8Sopenharmony_ci 24518678f8Sopenharmony_ci#ifdef __cplusplus 25518678f8Sopenharmony_ciextern "C" { 26518678f8Sopenharmony_ci#endif 27518678f8Sopenharmony_ci 28518678f8Sopenharmony_citypedef struct DhcpConfig DhcpConfig; 29518678f8Sopenharmony_cistruct DhcpConfig { 30518678f8Sopenharmony_ci char ifname[IFACE_NAME_SIZE]; /* Network interface name. */ 31518678f8Sopenharmony_ci uint32_t serverId; /* Server identifier. */ 32518678f8Sopenharmony_ci uint32_t netmask; /* Default subnet mask. */ 33518678f8Sopenharmony_ci uint32_t gateway; /* Default gateway. */ 34518678f8Sopenharmony_ci uint32_t leaseTime; /* Lease time value, default DHCP_LEASE_TIME. */ 35518678f8Sopenharmony_ci uint32_t renewalTime; /* Renewal time value. */ 36518678f8Sopenharmony_ci uint32_t rebindingTime; /* Rebinding time value. */ 37518678f8Sopenharmony_ci uint32_t distribution; /* Ip distribue mode [0|1]: 0-random, 1-sequence(default). */ 38518678f8Sopenharmony_ci uint32_t broadcast; /* Broadcast flags enable [0|1]: 0-no, 1-yes(default). */ 39518678f8Sopenharmony_ci IpAddressRange pool; /* Address Range. */ 40518678f8Sopenharmony_ci DhcpOptionList options; /* Append dhcp options. */ 41518678f8Sopenharmony_ci}; 42518678f8Sopenharmony_citypedef struct DhcpConfig *PDhcpConfig; 43518678f8Sopenharmony_ci 44518678f8Sopenharmony_citypedef struct DhcpConfigNode DhcpConfigNode; 45518678f8Sopenharmony_cistruct DhcpConfigNode { 46518678f8Sopenharmony_ci DhcpConfig config; 47518678f8Sopenharmony_ci DhcpConfigNode *next; 48518678f8Sopenharmony_ci}; 49518678f8Sopenharmony_citypedef struct DhcpConfigNode *PDhcpConfigNode; 50518678f8Sopenharmony_ci 51518678f8Sopenharmony_citypedef struct DhcpConfigList DhcpConfigList; 52518678f8Sopenharmony_cistruct DhcpConfigList { 53518678f8Sopenharmony_ci int size; 54518678f8Sopenharmony_ci DhcpConfigNode *first; 55518678f8Sopenharmony_ci}; 56518678f8Sopenharmony_citypedef struct DhcpConfigList *PDhcpConfigList; 57518678f8Sopenharmony_ci 58518678f8Sopenharmony_ciint LoadConfig(const char *configFile, const char *ifname, DhcpConfig *config); 59518678f8Sopenharmony_ci 60518678f8Sopenharmony_ci#ifdef __cplusplus 61518678f8Sopenharmony_ci} 62518678f8Sopenharmony_ci#endif 63518678f8Sopenharmony_ci#endif 64