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 22 #ifdef __cplusplus 23 extern "C" { 24 #endif // __cplusplus 25 26 typedef enum { 27 API_UNKNOWN = 0, 28 API_V1 = 1, 29 API_V2 = 2, 30 } ApiVersion; 31 32 typedef enum { 33 APP_TYPE_NOT_CARE, 34 APP_TYPE_NORMAL, 35 APP_TYPE_AUTH, 36 APP_TYPE_INNER 37 } AppType; 38 39 typedef enum { 40 ROUTE_TYPE_ALL = 0, 41 WIFI_STA = 1, 42 WIFI_P2P = 2, 43 } RouteType; 44 45 typedef enum { 46 UDP_CONN_TYPE_INVALID = -1, 47 UDP_CONN_TYPE_WIFI = 0, 48 UDP_CONN_TYPE_P2P = 1, 49 } UdpConnType; 50 51 typedef enum { 52 TYPE_INVALID_CHANNEL = -1, 53 TYPE_UDP_CHANNEL_OPEN = 1, 54 TYPE_UDP_CHANNEL_CLOSE = 2, 55 } UdpChannelOptType; 56 57 typedef struct { 58 ApiVersion apiVersion; 59 char deviceId[DEVICE_ID_SIZE_MAX]; 60 char pkgName[PKG_NAME_SIZE_MAX]; 61 char sessionName[SESSION_NAME_SIZE_MAX]; 62 int uid; 63 int pid; 64 char authState[AUTH_STATE_SIZE_MAX]; 65 char ip[IP_LEN]; 66 int port; 67 int64_t channelId; 68 } AppInfoData; 69 70 typedef struct { 71 char groupId[GROUP_ID_SIZE_MAX]; 72 char sessionKey[SESSION_KEY_LENGTH]; 73 char reqId[REQ_ID_SIZE_MAX]; 74 RouteType routeType; 75 BusinessType businessType; 76 StreamType streamType; 77 UdpConnType udpConnType; 78 UdpChannelOptType udpChannelOptType; 79 int fd; 80 AppType appType; 81 AppInfoData myData; 82 AppInfoData peerData; 83 } AppInfo; 84 85 #ifdef __cplusplus 86 } 87 #endif // __cplusplus 88 #endif // SOFTBUS_APP_INFO_H