1518678f8Sopenharmony_ci/*
2518678f8Sopenharmony_ci * Copyright (C) 2021 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_DEFINE_H
17518678f8Sopenharmony_ci#define OHOS_DHCP_DEFINE_H
18518678f8Sopenharmony_ci
19518678f8Sopenharmony_ci#define DHCP_LEASE_TIME 21600
20518678f8Sopenharmony_ci#define DHCP_RENEWAL_TIME 10800
21518678f8Sopenharmony_ci#define DHCP_REBINDING_TIME 17280
22518678f8Sopenharmony_ci#define DHCP_DEFAULT_TIMEOUT 30
23518678f8Sopenharmony_ci#define DHCP_ADDRESS_LENGTH 4
24518678f8Sopenharmony_ci#define DHCP_HWADDR_LENGTH 16
25518678f8Sopenharmony_ci#define DHCP_HOST_NAME_LENGTH 64
26518678f8Sopenharmony_ci#define DHCP_BOOT_FILE_LENGTH 128
27518678f8Sopenharmony_ci#define DHCP_LEASE_FILE_LENGTH 256
28518678f8Sopenharmony_ci#define DHCP_FILE_LINE_LENGTH 1024
29518678f8Sopenharmony_ci#define DHCP_REFRESH_LEASE_FILE_INTERVAL 120
30518678f8Sopenharmony_ci#define DHCP_MESSAGE_FLAG_LENGTH 16
31518678f8Sopenharmony_ci#define DHCP_MAX_PATH_LENGTH 256
32518678f8Sopenharmony_ci#define DHCP_ONE_BYTE_BITS 8
33518678f8Sopenharmony_ci
34518678f8Sopenharmony_ci#define DHCP_ROOT "/data/service/el1/public/dhcp/"
35518678f8Sopenharmony_ci
36518678f8Sopenharmony_ci#define DHCPD_CONFIG_FILE DHCP_ROOT"etc/dhcpd.conf"
37518678f8Sopenharmony_ci#define DHCPD_EXT_CONFIG_PATH DHCP_ROOT"etc/dhcpd.d"
38518678f8Sopenharmony_ci#define DHCPD_LEASE_FILE DHCP_ROOT"dhcpd_lease.lease"
39518678f8Sopenharmony_ci#define DHCPD_PID_FILE DHCP_ROOT"dhcpd.pid"
40518678f8Sopenharmony_ci
41518678f8Sopenharmony_ci#define DHCPD_VERSION "0.0.1"
42518678f8Sopenharmony_ci
43518678f8Sopenharmony_ci#define DHCP_SERVER_PORT 67
44518678f8Sopenharmony_ci#define DHCP_CLIENT_PORT 68
45518678f8Sopenharmony_ci
46518678f8Sopenharmony_ci#define DHCP_OPTIONS_SIZE   312
47518678f8Sopenharmony_ci#define IFACE_NAME_SIZE     50
48518678f8Sopenharmony_ci#define PID_MAX_LEN         16
49518678f8Sopenharmony_ci
50518678f8Sopenharmony_ci#define DHCP_RENEWAL_MULTIPLE 0.5
51518678f8Sopenharmony_ci#define DHCP_REBIND_MULTIPLE 0.875
52518678f8Sopenharmony_ci
53518678f8Sopenharmony_ci#define DHCP_TRUE 1
54518678f8Sopenharmony_ci#define DHCP_FALSE 0
55518678f8Sopenharmony_cienum DhcpNumber {
56518678f8Sopenharmony_ci    NUM_ZERO = 0,
57518678f8Sopenharmony_ci    NUM_ONE,
58518678f8Sopenharmony_ci    NUM_TWO,
59518678f8Sopenharmony_ci    NUM_THREE,
60518678f8Sopenharmony_ci    NUM_FOUR,
61518678f8Sopenharmony_ci    NUM_FIVE,
62518678f8Sopenharmony_ci    NUM_SIX,
63518678f8Sopenharmony_ci    NUM_SEVEN,
64518678f8Sopenharmony_ci    NUM_EIGHT,
65518678f8Sopenharmony_ci    NUM_NINE,
66518678f8Sopenharmony_ci    NUM_TEN,
67518678f8Sopenharmony_ci    NUM_ELEVEN,
68518678f8Sopenharmony_ci    NUM_TWELVE,
69518678f8Sopenharmony_ci    NUM_THIRTEEN,
70518678f8Sopenharmony_ci    NUM_FOURTEEN,
71518678f8Sopenharmony_ci};
72518678f8Sopenharmony_ci
73518678f8Sopenharmony_cienum DhcpReturnCode {
74518678f8Sopenharmony_ci    RET_SUCCESS = 0,
75518678f8Sopenharmony_ci    RET_FAILED,
76518678f8Sopenharmony_ci    RET_ERROR,
77518678f8Sopenharmony_ci    ERR_SELECT,
78518678f8Sopenharmony_ci    RET_BREAK,
79518678f8Sopenharmony_ci    RET_WAIT_SAVE,
80518678f8Sopenharmony_ci    RET_NO_SUPPORTED,
81518678f8Sopenharmony_ci    RET_SELECT_TIME_OUT
82518678f8Sopenharmony_ci};
83518678f8Sopenharmony_ci
84518678f8Sopenharmony_ci#endif