• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef OHOS_IP4_H
16 #define OHOS_IP4_H
17 
18 #include <stdint.h>
19 #include <sys/types.h>
20 
21 #include "dhcp_define.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 void SetSocketMode(uint32_t mode);
28 int SetIpv4State(int state);
29 int InitSignalHandle(void);
30 int ExecDhcpRelease(void);
31 int ExecDhcpRenew(void);
32 
33 int PublishDhcpResultEvent(const char *ifname, const int code, struct DhcpResult *result);
34 int GetPacketHeaderInfo(struct DhcpPacket *packet, uint8_t type);
35 int GetPacketCommonInfo(struct DhcpPacket *packet);
36 int DhcpDiscover(uint32_t transid, uint32_t requestip);
37 int DhcpRequest(uint32_t transid, uint32_t reqip, uint32_t servip);
38 int DhcpRenew(uint32_t transid, uint32_t clientip, uint32_t serverip);
39 int DhcpRelease(uint32_t clientip, uint32_t serverip);
40 int StartIpv4(void);
41 void SendReboot(struct DhcpPacket *p, time_t timestamp);
42 
43 int GetPacketReadSockFd(void);
44 int GetSigReadSockFd(void);
45 uint32_t GetDhcpTransID(void);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 #endif
51