1060ff233Sopenharmony_ci/* 2060ff233Sopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3060ff233Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4060ff233Sopenharmony_ci * you may not use this file except in compliance with the License. 5060ff233Sopenharmony_ci * You may obtain a copy of the License at 6060ff233Sopenharmony_ci * 7060ff233Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8060ff233Sopenharmony_ci * 9060ff233Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10060ff233Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11060ff233Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12060ff233Sopenharmony_ci * See the License for the specific language governing permissions and 13060ff233Sopenharmony_ci * limitations under the License. 14060ff233Sopenharmony_ci */ 15060ff233Sopenharmony_ci 16060ff233Sopenharmony_ci/** 17060ff233Sopenharmony_ci * @addtogroup SoftBus 18060ff233Sopenharmony_ci * @{ 19060ff233Sopenharmony_ci * 20060ff233Sopenharmony_ci * @brief Provides high-speed, secure communications between devices. 21060ff233Sopenharmony_ci * 22060ff233Sopenharmony_ci * This module implements unified distributed communication management of 23060ff233Sopenharmony_ci * nearby devices, and provides link-independent device discovery and transmission interfaces 24060ff233Sopenharmony_ci * to support service publishing and data transmission. 25060ff233Sopenharmony_ci * 26060ff233Sopenharmony_ci * @since 2.0 27060ff233Sopenharmony_ci * @version 2.0 28060ff233Sopenharmony_ci */ 29060ff233Sopenharmony_ci 30060ff233Sopenharmony_ci/** 31060ff233Sopenharmony_ci * @file socket.h 32060ff233Sopenharmony_ci * 33060ff233Sopenharmony_ci * @brief Declares unified data transmission interfaces. 34060ff233Sopenharmony_ci * 35060ff233Sopenharmony_ci * This file provides data transmission capabilities, including creating and removing a socket server, 36060ff233Sopenharmony_ci * opening and closing sockets, receiving data, and querying basic socket information. \n 37060ff233Sopenharmony_ci * You can use the interfaces to transmit data across the nearby devices that are discovered and networked. 38060ff233Sopenharmony_ci * \n 39060ff233Sopenharmony_ci * 40060ff233Sopenharmony_ci * @since 2.0 41060ff233Sopenharmony_ci * @version 2.0 42060ff233Sopenharmony_ci */ 43060ff233Sopenharmony_ci#ifndef SOCKET_H 44060ff233Sopenharmony_ci#define SOCKET_H 45060ff233Sopenharmony_ci 46060ff233Sopenharmony_ci#include <stdint.h> 47060ff233Sopenharmony_ci#include <stdbool.h> 48060ff233Sopenharmony_ci#include "trans_type.h" 49060ff233Sopenharmony_ci 50060ff233Sopenharmony_ci#ifdef __cplusplus 51060ff233Sopenharmony_ciextern "C" { 52060ff233Sopenharmony_ci#endif 53060ff233Sopenharmony_ci 54060ff233Sopenharmony_ci/** 55060ff233Sopenharmony_ci * @brief Enumerates the QoS feedback types. 56060ff233Sopenharmony_ci * 57060ff233Sopenharmony_ci * @since 2.0 58060ff233Sopenharmony_ci * @version 2.0 59060ff233Sopenharmony_ci */ 60060ff233Sopenharmony_citypedef enum { 61060ff233Sopenharmony_ci QOS_SATISFIED, /**< Feedback on satisfied quality */ 62060ff233Sopenharmony_ci QOS_NOT_SATISFIED, /**< Feedback on not satisfied quality */ 63060ff233Sopenharmony_ci} QoSEvent; 64060ff233Sopenharmony_ci 65060ff233Sopenharmony_ci/** 66060ff233Sopenharmony_ci * @brief Defines socket callbacks. 67060ff233Sopenharmony_ci * 68060ff233Sopenharmony_ci * When a socket is opened or closed, or there is data to process, the related callback is invoked. 69060ff233Sopenharmony_ci * 70060ff233Sopenharmony_ci * @since 2.0 71060ff233Sopenharmony_ci * @version 2.0 72060ff233Sopenharmony_ci */ 73060ff233Sopenharmony_citypedef struct { 74060ff233Sopenharmony_ci /** 75060ff233Sopenharmony_ci * @brief Called when a socket is bind. 76060ff233Sopenharmony_ci * 77060ff233Sopenharmony_ci * This callback is invoked to verify the socket or initialize resources related to the socket. 78060ff233Sopenharmony_ci * When the connection is successful, this callback be called on the server side. 79060ff233Sopenharmony_ci * The server side refers to the side that called {@Listen} function. 80060ff233Sopenharmony_ci * 81060ff233Sopenharmony_ci * When a socket is async bind, client side need implement this interface. 82060ff233Sopenharmony_ci * 83060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 84060ff233Sopenharmony_ci * @param info Indicates the information of peer socket. 85060ff233Sopenharmony_ci * @since 2.0 86060ff233Sopenharmony_ci * @version 2.0 87060ff233Sopenharmony_ci */ 88060ff233Sopenharmony_ci void (*OnBind)(int32_t socket, PeerSocketInfo info); 89060ff233Sopenharmony_ci 90060ff233Sopenharmony_ci /** 91060ff233Sopenharmony_ci * @brief Called when a socket is closed. 92060ff233Sopenharmony_ci * 93060ff233Sopenharmony_ci * This callback is invoked to release resources related to the socket. 94060ff233Sopenharmony_ci * 95060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 96060ff233Sopenharmony_ci * @param reason Indicates the reason for closing the socket. 97060ff233Sopenharmony_ci * @since 2.0 98060ff233Sopenharmony_ci * @version 2.0 99060ff233Sopenharmony_ci */ 100060ff233Sopenharmony_ci void (*OnShutdown)(int32_t socket, ShutdownReason reason); 101060ff233Sopenharmony_ci 102060ff233Sopenharmony_ci /** 103060ff233Sopenharmony_ci * @brief Called when bytes data is received. 104060ff233Sopenharmony_ci * 105060ff233Sopenharmony_ci * This callback is invoked to notify that data is received. 106060ff233Sopenharmony_ci * 107060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 108060ff233Sopenharmony_ci * @param data Indicates the pointer to the bytes data received. 109060ff233Sopenharmony_ci * @param dataLen Indicates the length of the bytes data received. 110060ff233Sopenharmony_ci * @since 2.0 111060ff233Sopenharmony_ci * @version 2.0 112060ff233Sopenharmony_ci */ 113060ff233Sopenharmony_ci void (*OnBytes)(int32_t socket, const void *data, uint32_t dataLen); 114060ff233Sopenharmony_ci 115060ff233Sopenharmony_ci /** 116060ff233Sopenharmony_ci * @brief Called when message data is received. 117060ff233Sopenharmony_ci * 118060ff233Sopenharmony_ci * This callback is invoked to notify that message data is received. 119060ff233Sopenharmony_ci * 120060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 121060ff233Sopenharmony_ci * @param data Indicates the pointer to the message data received. 122060ff233Sopenharmony_ci * @param dataLen Indicates the length of the message data received. 123060ff233Sopenharmony_ci * @since 2.0 124060ff233Sopenharmony_ci * @version 2.0 125060ff233Sopenharmony_ci */ 126060ff233Sopenharmony_ci void (*OnMessage)(int32_t socket, const void *data, uint32_t dataLen); 127060ff233Sopenharmony_ci 128060ff233Sopenharmony_ci /** 129060ff233Sopenharmony_ci * @brief Called when stream data is received. 130060ff233Sopenharmony_ci * 131060ff233Sopenharmony_ci * This callback is invoked to notify that stream data is received. 132060ff233Sopenharmony_ci * 133060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 134060ff233Sopenharmony_ci * @param data Indicates the pointer to the stream data received. 135060ff233Sopenharmony_ci * @param ext Indicates the pointer to the extended service data received. 136060ff233Sopenharmony_ci * @param param Indicates the pointer to the stream data frame information. 137060ff233Sopenharmony_ci * @since 2.0 138060ff233Sopenharmony_ci * @version 2.0 139060ff233Sopenharmony_ci */ 140060ff233Sopenharmony_ci void (*OnStream)(int32_t socket, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param); 141060ff233Sopenharmony_ci 142060ff233Sopenharmony_ci /** 143060ff233Sopenharmony_ci * @brief Called when file data is received. 144060ff233Sopenharmony_ci * 145060ff233Sopenharmony_ci * This callback is invoked to notify that file data is received. 146060ff233Sopenharmony_ci * 147060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 148060ff233Sopenharmony_ci * @param event Indicates the file event. 149060ff233Sopenharmony_ci * @param data Indicates the pointer to the file data received. 150060ff233Sopenharmony_ci * @since 2.0 151060ff233Sopenharmony_ci * @version 2.0 152060ff233Sopenharmony_ci */ 153060ff233Sopenharmony_ci void (*OnFile)(int32_t socket, FileEvent *event); 154060ff233Sopenharmony_ci 155060ff233Sopenharmony_ci /** 156060ff233Sopenharmony_ci * @brief Called when QoS state is changed. 157060ff233Sopenharmony_ci * 158060ff233Sopenharmony_ci * This callback is invoked to notify that QoS state is changed. 159060ff233Sopenharmony_ci * 160060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 161060ff233Sopenharmony_ci * @param event Indicates the type of QoS state change. 162060ff233Sopenharmony_ci * @param qos Indicates the QoS status that we can provide. 163060ff233Sopenharmony_ci * @param qosCount Indicates the number of the third parameter <b>qos</b>. 164060ff233Sopenharmony_ci * @since 2.0 165060ff233Sopenharmony_ci * @version 2.0 166060ff233Sopenharmony_ci */ 167060ff233Sopenharmony_ci void (*OnQos)(int32_t socket, QoSEvent eventId, const QosTV *qos, uint32_t qosCount); 168060ff233Sopenharmony_ci 169060ff233Sopenharmony_ci /** 170060ff233Sopenharmony_ci * @brief Called when an async bind socket is error. 171060ff233Sopenharmony_ci * 172060ff233Sopenharmony_ci * This callback is notice error for the socket. 173060ff233Sopenharmony_ci * 174060ff233Sopenharmony_ci * When a socket is async bind, client side need implement this interface. 175060ff233Sopenharmony_ci * 176060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 177060ff233Sopenharmony_ci * @param errCode Indicates the error for the async bind socket. 178060ff233Sopenharmony_ci * @since 2.0 179060ff233Sopenharmony_ci * @version 2.0 180060ff233Sopenharmony_ci */ 181060ff233Sopenharmony_ci void (*OnError)(int32_t socket, int32_t errCode); 182060ff233Sopenharmony_ci 183060ff233Sopenharmony_ci /** 184060ff233Sopenharmony_ci * @brief Called when a socket is negotiating. 185060ff233Sopenharmony_ci * 186060ff233Sopenharmony_ci * This callback is invoked to negotiating the socket, this callback be called on the server side. 187060ff233Sopenharmony_ci * The server can determine whether to bind the socket based on the negotiation result. 188060ff233Sopenharmony_ci * 189060ff233Sopenharmony_ci * 190060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 191060ff233Sopenharmony_ci * @param info Indicates the information of peer socket. 192060ff233Sopenharmony_ci * @return If true is returned, it indicates that the negotiation is successful. If this method is not implemented, 193060ff233Sopenharmony_ci * the negotiation is successful by default. if false is returned, the negotiation fails and the client is notified 194060ff233Sopenharmony_ci * that the connection is rejected. 195060ff233Sopenharmony_ci * @since 2.0 196060ff233Sopenharmony_ci * @version 2.0 197060ff233Sopenharmony_ci */ 198060ff233Sopenharmony_ci bool (*OnNegotiate)(int32_t socket, PeerSocketInfo info); 199060ff233Sopenharmony_ci} ISocketListener; 200060ff233Sopenharmony_ci 201060ff233Sopenharmony_ci/** 202060ff233Sopenharmony_ci * @brief Creates a socket. 203060ff233Sopenharmony_ci * 204060ff233Sopenharmony_ci * A maximum of 15 socket can be created. 205060ff233Sopenharmony_ci * 206060ff233Sopenharmony_ci * @param info Indicates the description of the socket structure. 207060ff233Sopenharmony_ci * It is the unique identifier of the upper-layer service. The value cannot be empty or exceed 64 characters. 208060ff233Sopenharmony_ci * 209060ff233Sopenharmony_ci * @return Returns <b>socket fd</b> if the socket creation is successful; 210060ff233Sopenharmony_ci * returns an error code less than zero otherwise. 211060ff233Sopenharmony_ci * @since 2.0 212060ff233Sopenharmony_ci * @version 2.0 213060ff233Sopenharmony_ci */ 214060ff233Sopenharmony_ciint32_t Socket(SocketInfo info); 215060ff233Sopenharmony_ci 216060ff233Sopenharmony_ci/** 217060ff233Sopenharmony_ci * @brief Listens a socket, which is called by server. 218060ff233Sopenharmony_ci * 219060ff233Sopenharmony_ci * @param socket Indicates the the unique socket fd. 220060ff233Sopenharmony_ci * @param qos Indicates the QoS requirements for socket. The value cannot be empty. 221060ff233Sopenharmony_ci * @param qosCount Indicates the number of the second parameter <b>qos</b>. 222060ff233Sopenharmony_ci * @param listener Indicates the pointer to the socket callback. 223060ff233Sopenharmony_ci * 224060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_OK</b> if the listen creation is successful; 225060ff233Sopenharmony_ci * returns an error code less than zero otherwise. 226060ff233Sopenharmony_ci * @since 2.0 227060ff233Sopenharmony_ci * @version 2.0 228060ff233Sopenharmony_ci */ 229060ff233Sopenharmony_ciint32_t Listen(int32_t socket, const QosTV qos[], uint32_t qosCount, const ISocketListener *listener); 230060ff233Sopenharmony_ci 231060ff233Sopenharmony_ci/** 232060ff233Sopenharmony_ci * @brief Binds a socket, which is called by client. 233060ff233Sopenharmony_ci * 234060ff233Sopenharmony_ci * When the connection is successful, this function return <b>SOFTBUS_OK</b> and 235060ff233Sopenharmony_ci * {@link OnBind} be called on the server side. 236060ff233Sopenharmony_ci * 237060ff233Sopenharmony_ci * @param socket Indicates the the unique socket fd. 238060ff233Sopenharmony_ci * @param qos Indicates the QoS requirements for socket. The value cannot be empty. 239060ff233Sopenharmony_ci * @param qosCount Indicates the number of the second parameter <b>qos</b>. 240060ff233Sopenharmony_ci * @param listener Indicates the pointer to the socket callback. 241060ff233Sopenharmony_ci * 242060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_INVALID_PARAM</b> if invalid parameters are detected. 243060ff233Sopenharmony_ci * @return Returns <b>INVALID_SOCKET</b> if the operation fails. 244060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_OK</b> if the socket is bind; 245060ff233Sopenharmony_ci * returns an error code otherwise. 246060ff233Sopenharmony_ci * @since 2.0 247060ff233Sopenharmony_ci * @version 2.0 248060ff233Sopenharmony_ci */ 249060ff233Sopenharmony_ciint32_t Bind(int32_t socket, const QosTV qos[], uint32_t qosCount, const ISocketListener *listener); 250060ff233Sopenharmony_ci 251060ff233Sopenharmony_ci/** 252060ff233Sopenharmony_ci * @brief Async bind a socket, which is called by client. 253060ff233Sopenharmony_ci * 254060ff233Sopenharmony_ci * {@link OnBind} is invoked to return whether the socket is successfully bind. 255060ff233Sopenharmony_ci * Data can be transmitted only after the socket is successfully bind. 256060ff233Sopenharmony_ci * 257060ff233Sopenharmony_ci * @param socket Indicates the the unique socket fd. 258060ff233Sopenharmony_ci * @param qos Indicates the QoS requirements for socket. The value cannot be empty. 259060ff233Sopenharmony_ci * @param listener Indicates the pointer to the socket callback. 260060ff233Sopenharmony_ci * 261060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_INVALID_PARAM</b> if invalid parameters are detected. 262060ff233Sopenharmony_ci * @return Returns <b>INVALID_SOCKET</b> if the operation fails. 263060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_OK</b>) if the socket is in binding status, 264060ff233Sopenharmony_ci * returns an error code otherwise. 265060ff233Sopenharmony_ci * @since 2.0 266060ff233Sopenharmony_ci * @version 2.0 267060ff233Sopenharmony_ci */ 268060ff233Sopenharmony_ciint32_t BindAsync(int32_t socket, const QosTV qos[], uint32_t qosCount, const ISocketListener *listener); 269060ff233Sopenharmony_ci 270060ff233Sopenharmony_ci/** 271060ff233Sopenharmony_ci * @example sendbytes_message_demo.c 272060ff233Sopenharmony_ci */ 273060ff233Sopenharmony_ci 274060ff233Sopenharmony_ci/** 275060ff233Sopenharmony_ci * @brief Sends bytes data. 276060ff233Sopenharmony_ci * 277060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 278060ff233Sopenharmony_ci * @param data Indicates the pointer to the bytes data to send, which cannot be <b>NULL</b>. 279060ff233Sopenharmony_ci * @param len Indicates the length of the bytes data to send. 280060ff233Sopenharmony_ci * 281060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected. 282060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_SEND_LEN_BEYOND_LIMIT</b> if the bytes data exceeds the maximum limit. 283060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_INVALID_SOCKET</b> if <b>socket</b> is invalid. 284060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_SOCKET_NO_ENABLE</b> if the socket is not bind. 285060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_OK</b> if the operation is successful; returns an error code otherwise. 286060ff233Sopenharmony_ci * @since 2.0 287060ff233Sopenharmony_ci * @version 2.0 288060ff233Sopenharmony_ci */ 289060ff233Sopenharmony_ciint32_t SendBytes(int32_t socket, const void *data, uint32_t len); 290060ff233Sopenharmony_ci 291060ff233Sopenharmony_ci/** 292060ff233Sopenharmony_ci * @brief Sends message data. 293060ff233Sopenharmony_ci * 294060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 295060ff233Sopenharmony_ci * @param data Indicates the pointer to the message data to send, which cannot be <b>NULL</b>. 296060ff233Sopenharmony_ci * @param len Indicates the length of the message data to send. 297060ff233Sopenharmony_ci * 298060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_INVALID_PARAM</b> if <b>data</b> is <b>NULL</b> or <b>len</b> is zero. 299060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_SEND_LEN_BEYOND_LIMIT</b> if the message data length exceeds the limit. 300060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_INVALID_SOCKET</b> if <b>socket</b> is invalid. 301060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_SOCKET_NO_ENABLE</b> if the socket is not bind. 302060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_OK</b> if the operation is successful; returns an error code otherwise. 303060ff233Sopenharmony_ci * @since 2.0 304060ff233Sopenharmony_ci * @version 2.0 305060ff233Sopenharmony_ci */ 306060ff233Sopenharmony_ciint32_t SendMessage(int32_t socket, const void *data, uint32_t len); 307060ff233Sopenharmony_ci 308060ff233Sopenharmony_ci/** 309060ff233Sopenharmony_ci * @example sendstream_demo.c 310060ff233Sopenharmony_ci */ 311060ff233Sopenharmony_ci 312060ff233Sopenharmony_ci/** 313060ff233Sopenharmony_ci * @brief Sends stream data. 314060ff233Sopenharmony_ci * 315060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 316060ff233Sopenharmony_ci * @param data Indicates the pointer to the stream data to send, which cannot be <b>NULL</b>. 317060ff233Sopenharmony_ci * @param ext Indicates the pointer to the extended stream data to send, which cannot be <b>NULL</b>. 318060ff233Sopenharmony_ci * @param param Indicates the pointer to the stream frame information, which cannot be <b>NULL</b>. 319060ff233Sopenharmony_ci * 320060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_INVALID_PARAM</b> if any of the input parameters is <b>NULL</b>. 321060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_INVALID_SOCKET</b> if <b>socket</b> is invalid. 322060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_SOCKET_NO_ENABLE</b> if the socket is not bind. 323060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_OK</b> if the operation is successful; returns an error code otherwise. 324060ff233Sopenharmony_ci * @since 2.0 325060ff233Sopenharmony_ci * @version 2.0 326060ff233Sopenharmony_ci */ 327060ff233Sopenharmony_ciint32_t SendStream(int32_t socket, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param); 328060ff233Sopenharmony_ci 329060ff233Sopenharmony_ci/** 330060ff233Sopenharmony_ci * @example sendfile_demo.c 331060ff233Sopenharmony_ci */ 332060ff233Sopenharmony_ci 333060ff233Sopenharmony_ci/** 334060ff233Sopenharmony_ci * @brief Sends files data. 335060ff233Sopenharmony_ci * 336060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 337060ff233Sopenharmony_ci * @param sFileList Indicates the pointer to the source files data to send, which cannot be <b>NULL</b>. 338060ff233Sopenharmony_ci * @param dFileList Indicates the pointer to the destination files data, which cannot be <b>NULL</b>. 339060ff233Sopenharmony_ci * @param fileCnt Indicates the number of files data to send, which cannot be <b>0</b>. 340060ff233Sopenharmony_ci * 341060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_INVALID_PARAM</b> if <b>sFileList</b> is <b>NULL</b> or <b>fileCnt</b> is <b>0</b>. 342060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_INVALID_SOCKET</b> if <b>socket</b> is invalid. 343060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_TRANS_SOCKET</b> if the socket is not bind. 344060ff233Sopenharmony_ci * @return Returns <b>SOFTBUS_OK</b> if the operation is successful; returns an error code otherwise. 345060ff233Sopenharmony_ci * @since 2.0 346060ff233Sopenharmony_ci * @version 2.0 347060ff233Sopenharmony_ci */ 348060ff233Sopenharmony_ciint32_t SendFile(int32_t socket, const char *sFileList[], const char *dFileList[], uint32_t fileCnt); 349060ff233Sopenharmony_ci 350060ff233Sopenharmony_ci/** 351060ff233Sopenharmony_ci * @brief Get socket based on a socket fd. 352060ff233Sopenharmony_ci * 353060ff233Sopenharmony_ci * @param socket Indicates the unique socket fd. 354060ff233Sopenharmony_ci * 355060ff233Sopenharmony_ci * @return Returns no value. 356060ff233Sopenharmony_ci * @since 2.0 357060ff233Sopenharmony_ci * @version 2.0 358060ff233Sopenharmony_ci */ 359060ff233Sopenharmony_civoid Shutdown(int32_t socket); 360060ff233Sopenharmony_ci 361060ff233Sopenharmony_ci/** 362060ff233Sopenharmony_ci * @brief Evaluate quality of service. 363060ff233Sopenharmony_ci * 364060ff233Sopenharmony_ci * @param peerNetworkId Indicates the pointer to the remote device ID. 365060ff233Sopenharmony_ci * @param dataType Indicates the type of data. 366060ff233Sopenharmony_ci * @param qos Indicates the expected quality of service. 367060ff233Sopenharmony_ci * @param qosCount Indicates the number of the fourth parameter <b>qos</b>. 368060ff233Sopenharmony_ci * 369060ff233Sopenharmony_ci * @return Returns no value. 370060ff233Sopenharmony_ci * @since 2.0 371060ff233Sopenharmony_ci * @version 2.0 372060ff233Sopenharmony_ci */ 373060ff233Sopenharmony_ciint32_t EvaluateQos(const char *peerNetworkId, TransDataType dataType, const QosTV *qos, uint32_t qosCount); 374060ff233Sopenharmony_ci#ifdef __cplusplus 375060ff233Sopenharmony_ci} 376060ff233Sopenharmony_ci#endif 377060ff233Sopenharmony_ci#endif // SOCKET_H 378