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_FUNCTION_H
17518678f8Sopenharmony_ci#define OHOS_DHCP_FUNCTION_H
18518678f8Sopenharmony_ci
19518678f8Sopenharmony_ci#include <cstring>
20518678f8Sopenharmony_ci#include <stdlib.h>
21518678f8Sopenharmony_ci#include <stdint.h>
22518678f8Sopenharmony_ci#include <stdbool.h>
23518678f8Sopenharmony_ci#include <unistd.h>
24518678f8Sopenharmony_ci#include <string>
25518678f8Sopenharmony_ci
26518678f8Sopenharmony_cibool Ip4StrConToInt(const char *strIp, uint32_t *uIp, bool bHost);
27518678f8Sopenharmony_cistd::string Ip4IntConvertToStr(uint32_t ip, bool host);
28518678f8Sopenharmony_cibool Ip6StrConToChar(const char *strIp, uint8_t chIp[], size_t chlen);
29518678f8Sopenharmony_ciconst char *MacChConToMacStr(const unsigned char *pChMac, size_t chLen, char *pStrMac, size_t strLen);
30518678f8Sopenharmony_ciint GetLocalInterface(const char *ifname, int *ifindex, unsigned char *hwaddr, uint32_t *ifaddr4);
31518678f8Sopenharmony_ciint GetLocalIp(const char *ifname, uint32_t *ifaddr4);
32518678f8Sopenharmony_ciint SetLocalInterface(const char *ifname, uint32_t ipAddr, uint32_t netMask);
33518678f8Sopenharmony_ciint InitPidfile(const char *pidDir, const char *pidFile, pid_t pid);
34518678f8Sopenharmony_cipid_t GetPID(const char *pidFile);
35518678f8Sopenharmony_ciint CreateDirs(const char *dirs, int mode);
36518678f8Sopenharmony_ci
37518678f8Sopenharmony_ci#endif