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 P2PLINK_COMMON_H 17 #define P2PLINK_COMMON_H 18 19 #include <stdbool.h> 20 #include "p2plink_type.h" 21 22 #ifdef __cplusplus 23 #if __cplusplus 24 extern "C" { 25 #endif 26 #endif 27 28 P2pLinkRole P2pLinkGetRole(void); 29 void P2pLinkSetRole(P2pLinkRole role); 30 31 void P2pLinkCommonInit(void); 32 void P2pLinkCommonClean(void); 33 34 void P2pLinkSetMyMacExpired(bool isExpired); 35 void P2pLinkSetMyIp(const char *ip); 36 char* P2pLinkGetMyIp(void); 37 char* P2pLinkGetMyMac(void); 38 39 void P2pLinkSetGoIp(const char *ip); 40 void P2pLinkSetGoMac(const char *mac); 41 void P2pLinkSetGoPort(int32_t port); 42 char* P2pLinkGetGoIp(void); 43 char* P2pLinkGetGoMac(void); 44 int32_t P2pLinkGetGoPort(void); 45 void P2pLinkSetGcPort(int32_t port); 46 int32_t P2pLinkGetGcPort(void); 47 48 void P2pLinkSetState(bool state); 49 bool P2pLinkIsEnable(void); 50 51 void P2pLinkSetDhcpState(bool isNeedDhcp); 52 bool P2pLinkGetDhcpState(void); 53 54 bool P2pLinkIsDisconnectState(void); 55 void P2pLinkSetDisconnectState(bool state); 56 57 #ifdef __cplusplus 58 #if __cplusplus 59 } 60 #endif /* __cplusplus */ 61 #endif /* __cplusplus */ 62 63 #endif 64