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 SOFTBUS_APP_INFO_H 17 #define SOFTBUS_APP_INFO_H 18 19 #include "session.h" 20 #include "softbus_def.h" 21 #include "softbus_protocol_def.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif // __cplusplus 26 27 #define APP_INFO_FILE_FEATURES_SUPPORT 1 28 #define APP_INFO_FILE_FEATURES_NO_SUPPORT 0 29 30 #define APP_INFO_ALGORITHM_AES_GCM_256 0 31 #define APP_INFO_ALGORITHM_CHACHA 1 32 33 #define APP_INFO_UDP_FILE_PROTOCAL 0x5a 34 35 typedef enum { 36 API_UNKNOWN = 0, 37 API_V1 = 1, 38 API_V2 = 2, 39 } ApiVersion; 40 41 typedef enum { 42 APP_TYPE_NOT_CARE, 43 APP_TYPE_NORMAL, 44 APP_TYPE_AUTH, 45 APP_TYPE_INNER 46 } AppType; 47 48 typedef enum { 49 ROUTE_TYPE_ALL = 0, 50 WIFI_STA = 1, 51 WIFI_P2P = 2, 52 } RouteType; 53 54 typedef enum { 55 UDP_CONN_TYPE_INVALID = -1, 56 UDP_CONN_TYPE_WIFI = 0, 57 UDP_CONN_TYPE_P2P = 1, 58 } UdpConnType; 59 60 typedef enum { 61 TYPE_INVALID_CHANNEL = -1, 62 TYPE_UDP_CHANNEL_OPEN = 1, 63 TYPE_UDP_CHANNEL_CLOSE = 2, 64 } UdpChannelOptType; 65 66 typedef struct { 67 ApiVersion apiVersion; 68 char deviceId[DEVICE_ID_SIZE_MAX]; 69 char pkgName[PKG_NAME_SIZE_MAX]; 70 char sessionName[SESSION_NAME_SIZE_MAX]; 71 int uid; 72 int pid; 73 char authState[AUTH_STATE_SIZE_MAX]; 74 char addr[MAX_SOCKET_ADDR_LEN]; 75 int port; 76 int64_t channelId; 77 } AppInfoData; 78 79 typedef struct { 80 char groupId[GROUP_ID_SIZE_MAX]; 81 char sessionKey[SESSION_KEY_LENGTH]; 82 char reqId[REQ_ID_SIZE_MAX]; 83 char peerNetWorkId[DEVICE_ID_SIZE_MAX]; 84 RouteType routeType; 85 BusinessType businessType; 86 StreamType streamType; 87 UdpConnType udpConnType; 88 UdpChannelOptType udpChannelOptType; 89 int fd; 90 AppType appType; 91 AppInfoData myData; 92 AppInfoData peerData; 93 ProtocolType protocol; 94 int32_t encrypt; 95 int32_t algorithm; 96 int32_t crc; 97 int32_t fileProtocal; 98 } AppInfo; 99 100 #ifdef __cplusplus 101 } 102 #endif // __cplusplus 103 #endif // SOFTBUS_APP_INFO_H