1 /* 2 * Copyright (c) 2025 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 SOCKET_TYPE_H 17 #define SOCKET_TYPE_H 18 #include <stdint.h> 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #define MAX_MAC_LEN 18 25 #define MAX_IP_LEN 46 26 #define MAX_PATH_LEN 4096 27 #define DEVICE_ID_LEN_MAX 65 28 #define ACCOUNT_UID_LEN_MAX 65 29 #define EXTRA_ACCESS_INFO_LEN_MAX 256 30 31 typedef enum { 32 DATA_TYPE_BYTES, /**< Bytes */ 33 DATA_TYPE_BUTT, 34 } TransDataType; 35 36 typedef struct { 37 char *name; /**< My socket name, maximum length 255 bytes */ 38 char *peerName; /**< Peer socket name, maximum length 255 bytes */ 39 char *peerNetworkId; /**< Peer network ID, maximum length 64 bytes */ 40 char *pkgName; /**< Package name, maximum length 64 bytes */ 41 TransDataType dataType; /**< Data type */ 42 } SocketInfo; 43 44 typedef struct { 45 char *name; /**< Peer socket name, maximum length 255 bytes */ 46 char *networkId; /**< Peer network ID, maximum length 64 bytes */ 47 char *pkgName; /**< Peer package name, maximum length 64 bytes */ 48 TransDataType dataType; /**< Data type of peer socket*/ 49 } PeerSocketInfo; 50 51 typedef enum { 52 SHUTDOWN_REASON_LOCAL, /**< Shutdown by local process */ 53 } ShutdownReason; 54 55 typedef enum { 56 QOS_TYPE_MIN_BW, /**< Minimum bandwidth. */ 57 QOS_TYPE_MAX_LATENCY = 1, /**< Maximum latency. */ 58 QOS_TYPE_MIN_LATENCY, /**< Minimum latency. */ 59 QOS_TYPE_MAX_IDLE_TIMEOUT, /**< Maximum idle time. */ 60 QOS_TYPE_BUTT, 61 } QosType; 62 63 typedef struct { 64 QosType qos; /**< Qos type {@link QosType} */ 65 int32_t value; /**< Value of Qos types */ 66 } QosTV; 67 68 #ifdef __cplusplus 69 } 70 #endif 71 #endif // SOCKET_TYPE_H