1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_DHCP_DEFINE_H 17 #define OHOS_DHCP_DEFINE_H 18 19 #define DHCP_LEASE_TIME 21600 20 #define DHCP_RENEWAL_TIME 10800 21 #define DHCP_REBINDING_TIME 17280 22 #define DHCP_DEFAULT_TIMEOUT 30 23 #define DHCP_ADDRESS_LENGTH 4 24 #define DHCP_HWADDR_LENGTH 16 25 #define DHCP_HOST_NAME_LENGTH 64 26 #define DHCP_BOOT_FILE_LENGTH 128 27 #define DHCP_LEASE_FILE_LENGTH 256 28 #define DHCP_FILE_LINE_LENGTH 1024 29 #define DHCP_REFRESH_LEASE_FILE_INTERVAL 120 30 #define DHCP_MESSAGE_FLAG_LENGTH 8 31 #define DHCP_MAX_PATH_LENGTH 256 32 #define DHCP_ONE_BYTE_BITS 8 33 34 #define DHCP_ROOT "/data/service/el1/public/dhcp/" 35 36 #define DHCPD_CONFIG_FILE DHCP_ROOT"etc/dhcpd.conf" 37 #define DHCPD_EXT_CONFIG_PATH DHCP_ROOT"etc/dhcpd.d" 38 #define DHCPD_LEASE_FILE DHCP_ROOT"dhcpd_lease.lease" 39 #define DHCPD_PID_FILE DHCP_ROOT"dhcpd.pid" 40 41 #define DHCPD_VERSION "0.0.1" 42 43 #define DHCP_SERVER_PORT 67 44 #define DHCP_CLIENT_PORT 68 45 46 #define DHCP_OPTIONS_SIZE 312 47 #define IFACE_NAME_SIZE 50 48 #define PID_MAX_LEN 16 49 50 #define DHCP_RENEWAL_MULTIPLE 0.5 51 #define DHCP_REBIND_MULTIPLE 0.875 52 53 #define DHCP_TRUE 1 54 #define DHCP_FALSE 0 55 enum DhcpNumber { 56 NUM_ZERO = 0, 57 NUM_ONE, 58 NUM_TWO, 59 NUM_THREE, 60 NUM_FOUR, 61 NUM_FIVE, 62 NUM_SIX, 63 NUM_SEVEN, 64 NUM_EIGHT, 65 NUM_NINE, 66 NUM_TEN, 67 NUM_ELEVEN, 68 NUM_TWELVE, 69 NUM_THIRTEEN, 70 NUM_FOURTEEN, 71 }; 72 73 enum DhcpReturnCode { 74 RET_SUCCESS = 0, 75 RET_FAILED, 76 RET_ERROR, 77 ERR_SELECT, 78 RET_BREAK, 79 RET_WAIT_SAVE, 80 RET_NO_SUPPORTED, 81 RET_SELECT_TIME_OUT 82 }; 83 84 #endif