API参考
载入中...
搜索中...
未找到
Bsl_uio

uio module 更多...

Bsl_uio 的协作图:

struct  BSL_UIO_SctpAuthKey
 Sctp auth key, hitls Use the BSL_UIO_Method.ctrl method to transfer the BSL_UIO_SCTP_ADD_AUTH_SHARED_KEY instruction to notify the user that the auth key needs to be set. 更多...

类型定义

typedef struct UIO_ControlBlock BSL_UIO
 UIO module control structure
typedef void(* BSL_UIO_USERDATA_FREE_FUNC) (void *)
 userData release function

枚举

enum  BSL_UIO_TransportType {
  BSL_UIO_TCP , BSL_UIO_UDP , BSL_UIO_SCTP , BSL_UIO_MEM ,
  BSL_UIO_FILE , BSL_UIO_BUFFER , BSL_UIO_UNKNOWN , BSL_UIO_EXTEND = 10000
}
 Transmission protocol enumeration
enum  BSL_UIO_CtrlParameter {
  BSL_UIO_SET_PEER_IP_ADDR = 0x000 , BSL_UIO_GET_PEER_IP_ADDR , BSL_UIO_SET_FD , BSL_UIO_GET_FD ,
  BSL_UIO_PENDING , BSL_UIO_FLUSH , BSL_UIO_WPENDING , BSL_UIO_SEEK ,
  BSL_UIO_RESET , BSL_UIO_GET_INIT , BSL_UIO_GET_WRITE_NUM , BSL_UIO_GET_READ_NUM ,
  BSL_UIO_GET_PTO_LEN , BSL_UIO_INFO , BIO_UIO_SET_CALLBACK , BSL_UIO_SET_CONNECT ,
  BSL_UIO_GET_CONNECT , BSL_UIO_SET_NOBLOCK , BSL_UIO_DO_HANDSHAKE , BSL_UIO_SET_CTX ,
  BSL_UIO_GET_CTX , BSL_UIO_SET_SSL_RENEGOTIATE_TIMEOUT , BSL_UIO_SET_SSL_RENEGOTIATE_BYTES , BSL_UIO_UDP_SET_CONNECTED ,
  BSL_UIO_SET_BUFFER_SIZE , BSL_UIO_UDP_GET_MTU_OVERHEAD , BSL_UIO_UDP_QUERY_MTU , BSL_UIO_UDP_MTU_EXCEEDED ,
  BSL_UIO_CIPHER_IS_FINISHED , BSL_UIO_SET_CONNECT_MODE , BSL_UIO_SET_ACCEPT , BSL_UIO_GET_ACCEPT ,
  BSL_UIO_SET_BIND_MODE , BSL_UIO_GET_BIND_MODE , BSL_UIO_APPEND , BSL_UIO_SCTP_CHECK_PEER_AUTH = 0x300 ,
  BSL_UIO_SCTP_ADD_AUTH_SHARED_KEY , BSL_UIO_SCTP_ACTIVE_AUTH_SHARED_KEY , BSL_UIO_SCTP_DEL_PRE_AUTH_SHARED_KEY , BSL_UIO_SCTP_SND_BUFF_IS_EMPTY ,
  BSL_UIO_SCTP_RECV_BUFF_IS_EMPTY , BSL_UIO_SCTP_GET_SEND_STREAM_ID , BSL_UIO_SCTP_SET_APP_STREAM_ID , BSL_UIO_SCTP_MASK_APP_MESSAGE ,
  BSL_UIO_SCTP_SET_CALLBACK , BSL_UIO_MEM_NEW_BUF = 0x400 , BSL_UIO_MEM_GET_PTR , BSL_UIO_MEM_SET_EOF ,
  BSL_UIO_MEM_GET_EOF , BSL_UIO_MEM_GET_INFO , BSL_UIO_FILE_OPEN = 0x500 , BSL_UIO_FILE_PTR ,
  BSL_UIO_FILE_GET_EOF , BSL_UIO_FILE_SEEK , BSL_UIO_FILE_TELL , BSL_UIO_FILE_GET_PTR ,
  BSL_UIO_FD_GET_INFO = 0x600 , BSL_UIO_PAIR_MAKE = 0x700 , BSL_UIO_PAIR_SET_BUFFER_SIZE , BSL_UIO_PAIR_GET_BUFFER_SIZE ,
  BSL_UIO_TTO_SET_READ_CB = 0x800 , BSL_UIO_TTO_SET_WRITE_CB , BSL_UIO_TTO_SET_READ_APP_DATA , BSL_UIO_TTO_SET_WRITE_APP_DATA ,
  BSL_UIO_DTO_SET_KEY = 0x1001 , BSL_UIO_DTO_SET_EPOCH_SEQUENCE
}
 BSL_UIO_CtrlParameter controls the I/O callback function. Hitls notifies the user of the function to be implemented 更多...

函数

BSL_UIO_Method * BSL_UIO_NewMethod (void)
 Creating uio method structure
int32_t BSL_UIO_SetMethodType (BSL_UIO_Method *meth, BSL_UIO_TransportType type)
 set uio method type
int32_t BSL_UIO_SetMethod (BSL_UIO_Method *meth, int32_t type, void *func)
 set uio method callback
void BSL_UIO_FreeMethod (BSL_UIO_Method *meth)
 free uio Method
const BSL_UIO_Method * BSL_UIO_MemMethod (void)
 obtain the default MEM UIO
const BSL_UIO_Method * BSL_UIO_FileMethod (void)
 obtain the default FILE UIO method
const BSL_UIO_Method * BSL_UIO_SctpMethod (void)
 obtain the default SCTP UIO
const BSL_UIO_Method * BSL_UIO_TcpMethod (void)
 obtain the default TCP UIO method
const BSL_UIO_Method * BSL_UIO_UdpMethod (void)
 obtain the default UDP UIO method
const BSL_UIO_Method * BSL_UIO_BufferMethod (void)
 obtain the default buffer UIO
BSL_UIOBSL_UIO_New (const BSL_UIO_Method *method)
 Create a UIO object
void BSL_UIO_Free (BSL_UIO *uio)
 Release the UIO object.
int32_t BSL_UIO_Write (BSL_UIO *uio, const void *data, uint32_t len, uint32_t *writeLen)
 Write data to the UIO object
int32_t BSL_UIO_Read (BSL_UIO *uio, void *data, uint32_t len, uint32_t *readLen)
 Read data from the UIO object.
int32_t BSL_UIO_Ctrl (BSL_UIO *uio, int32_t cmd, int32_t larg, void *parg)
 Process specific UIO implementations by cmd
int32_t BSL_UIO_Puts (BSL_UIO *uio, const char *buf, uint32_t *writeLen)
 Write a string to the UIO object.
int32_t BSL_UIO_Gets (BSL_UIO *uio, char *buf, uint32_t *readLen)
 Reads a string from the UIO object
void BSL_UIO_SetInit (BSL_UIO *uio, bool init)
 Set the UIO init.
BSL_UIO_TransportType BSL_UIO_GetTransportType (const BSL_UIO *uio)
 Obtain the UIO transmission protocol type
bool BSL_UIO_GetUioChainTransportType (BSL_UIO *uio, const BSL_UIO_TransportType uioType)
 Obtain the UIO transmission protocol type
int32_t BSL_UIO_SetUserData (BSL_UIO *uio, void *data)
 Set the user data in the UIO object
int32_t BSL_UIO_SetUserDataFreeFunc (BSL_UIO *uio, BSL_UIO_USERDATA_FREE_FUNC userDataFreeFunc)
 Release the user data set in the UIO object.
void * BSL_UIO_GetUserData (const BSL_UIO *uio)
 Obtain the user data in the UIO object.
bool BSL_UIO_GetIsUnderlyingClosedByUio (const BSL_UIO *uio)
 Obtains whether resources associated with the UIO are closed by the UIO.
void BSL_UIO_SetIsUnderlyingClosedByUio (BSL_UIO *uio, bool close)
 Set whether resources associated with the UIO are closed by the UIO.
const BSL_UIO_Method * BSL_UIO_GetMethod (const BSL_UIO *uio)
 Method for obtaining the UIO
void * BSL_UIO_GetCtx (const BSL_UIO *uio)
 Obtain the implementation-related context.
void BSL_UIO_SetCtx (BSL_UIO *uio, void *ctx)
 Set the implementation-related context.
void BSL_UIO_SetFD (BSL_UIO *uio, int fd)
 Set the fd of the UIO object
int32_t BSL_UIO_SetFlags (BSL_UIO *uio, uint32_t flags)
 Set the UIO object flag.
int32_t BSL_UIO_ClearFlags (BSL_UIO *uio, uint32_t flags)
 Clear the UIO object flag
uint32_t BSL_UIO_TestFlags (const BSL_UIO *uio, uint32_t flags, uint32_t *out)
 Check the UIO object flag
int32_t BSL_UIO_UpRef (BSL_UIO *uio)
 Set the value of uio reference counting to 1
int32_t BSL_UIO_Append (BSL_UIO *uio, BSL_UIO *tail)
 Add a UIO object to the tail of the chain.
BSL_UIOBSL_UIO_PopCurrent (BSL_UIO *uio)
 Pop UIO object from the chain.
void BSL_UIO_FreeChain (BSL_UIO *uio)
 Release UIO object b and its subsequent chains.
BSL_UIOBSL_UIO_Next (BSL_UIO *uio)
 Obtain the next UIO object in the chain.

详细描述

uio module

枚举类型说明

◆ BSL_UIO_CtrlParameter

BSL_UIO_CtrlParameter controls the I/O callback function. Hitls notifies the user of the function to be implemented

枚举值
BSL_UIO_SCTP_CHECK_PEER_AUTH 

SCTP Check whether the peer supports authentication

BSL_UIO_SCTP_ADD_AUTH_SHARED_KEY 

Add a new sctp auth key. The sctp can use the new key to receive data

BSL_UIO_SCTP_ACTIVE_AUTH_SHARED_KEY 

activates the new sctp auth key. The sctp needs to use the new key to send data

BSL_UIO_SCTP_DEL_PRE_AUTH_SHARED_KEY 

SCTP Delete the previous shared key

BSL_UIO_SCTP_SND_BUFF_IS_EMPTY 

Whether the SCTP send queue is NULL. ctrl.param is the pointer of uint8_t *. If the value of ctrl.param is greater than 0, it indicates that the queue is NULL. Otherwise, it indicates that the queue is not NULL

BSL_UIO_SCTP_RECV_BUFF_IS_EMPTY 

check whether the SCTP receive queue is NULL. ctrl.param is the pointer of uint8_t *. If the value of ctrl.param is greater than 0, it indicates that the queue is NULL. Otherwise, it indicates that the queue is not NULL

函数说明

◆ BSL_UIO_Append()

int32_t BSL_UIO_Append ( BSL_UIO * uio,
BSL_UIO * tail )

Add a UIO object to the tail of the chain.

注意
The reference counting of the added UIO object will not increase by 1.
参数
uio[IN] uio object
tail[IN] UIO object added to the tail
返回值
BSL_SUCCESS,success.
Non-BSL_SUCCESS,failure.For details, see bsl_errno.h.

◆ BSL_UIO_BufferMethod()

const BSL_UIO_Method * BSL_UIO_BufferMethod ( void )

obtain the default buffer UIO

返回值
pointerto the Buffer UIO method

◆ BSL_UIO_ClearFlags()

int32_t BSL_UIO_ClearFlags ( BSL_UIO * uio,
uint32_t flags )

Clear the UIO object flag

参数
uio[IN] UIO object
flags[IN] flag
返回值
BSL_SUCCESS,succeeded.
Otherreference: bsl_errno.h.

◆ BSL_UIO_Ctrl()

int32_t BSL_UIO_Ctrl ( BSL_UIO * uio,
int32_t cmd,
int32_t larg,
void * parg )

Process specific UIO implementations by cmd

参数
uio[IN] UIO object
cmd[IN] Different cmd processes perform different operations on UIO objects.
larg[IN] Determined by cmd. For details, see the following
parg[IN/OUT] Determined by cmd. For details, see the following
返回值
BSL_SUCCESS
Non-BSL_SUCCESS,fordetails, see bsl_errno.h.

set the peer IP address in the UIO object

The address format is a binary address in network byte order, with a length of 4 or 16 bytes. A generated cookie will be provided for use by the HelloVerifyRequest for dtls.

参数
uio[IN] UIO object
cmd[IN] BSL_UIO_SET_PEER_IP_ADDR
larg[IN] Size of the peer address: The length must be 4 or 16
parg[IN] Peer address

Obtain the peer IP address from the UIO object

The obtained address is in the network byte order binary address format. The input length must be greater than the configured size. The purpose is to provide a generated cookie for use by the HelloVerifyRequest of the dtls.

参数
uio[IN] UIO object
cmd[IN] BSL_UIO_GET_PEER_IP_ADDR
larg[IN] 0
parg[IN] BSL_UIO_CtrlGetPeerIpAddrParam *, include: addr [IN/OUT] Peer address, size [IN/OUT] IN: size of the input buffer OUT: size of the output peer address

Obtain the stream ID sent by the SCTP from the UIO object.

This API needs to be called by users in BSL_UIO_Method.write and send SCTP messages based on the obtained stream ID

参数
uio[IN] UIO object
cmd[IN] BSL_UIO_SCTP_GET_SEND_STREAM_ID
larg[IN] 0
parg[IN/OUT] ID of the sent stream, uint16_t* Type

Set the stream ID of the app message sent by the SCTP in the UIO object.

If a service message needs to be processed by a specific stream ID, this interface can be called.

参数
uio[IN] UIO object
cmd[IN] BSL_UIO_SCTP_SET_APP_STREAM_ID
larg[IN] App stream ID. The value ranges from 0 to 65535
parg[IN] NULL

◆ BSL_UIO_FileMethod()

const BSL_UIO_Method * BSL_UIO_FileMethod ( void )

obtain the default FILE UIO method

返回
pointer to the FILE UIO method

◆ BSL_UIO_Free()

void BSL_UIO_Free ( BSL_UIO * uio)

Release the UIO object.

参数
uio[IN] UIO object.

◆ BSL_UIO_FreeChain()

void BSL_UIO_FreeChain ( BSL_UIO * uio)

Release UIO object b and its subsequent chains.

注意
: The release starts from b. If the reference counting of a UIO object in the chain is greater than or equal to 1, the release stops
参数
uio[IN] First UIO object in the UIO object chain to be released

◆ BSL_UIO_FreeMethod()

void BSL_UIO_FreeMethod ( BSL_UIO_Method * meth)

free uio Method

参数
meth[IN] uio method structure
返回值
void

◆ BSL_UIO_GetCtx()

void * BSL_UIO_GetCtx ( const BSL_UIO * uio)

Obtain the implementation-related context.

参数
uio[IN] UIO object
返回值
Implementation-relatedcontext pointer

◆ BSL_UIO_GetIsUnderlyingClosedByUio()

bool BSL_UIO_GetIsUnderlyingClosedByUio ( const BSL_UIO * uio)

Obtains whether resources associated with the UIO are closed by the UIO.

参数
uio[OUT] UIO object
返回值
tureThe resources associated with the UIO are closed by the UIO.
falseThe resources associated with the UIO are not closed by the UIO.

◆ BSL_UIO_GetMethod()

const BSL_UIO_Method * BSL_UIO_GetMethod ( const BSL_UIO * uio)

Method for obtaining the UIO

参数
uio[IN/OUT] UIO object
返回值
UIOmethod

◆ BSL_UIO_Gets()

int32_t BSL_UIO_Gets ( BSL_UIO * uio,
char * buf,
uint32_t * readLen )

Reads a string from the UIO object

参数
uio[IN] uio object.
buf[IN] Buffer that accepts a line of strings
readLen[IN/OUT] Length of the buffer for receiving data/Length of the data that is successfully read
返回值
BSL_SUCCESS(Determine the value based on the actual receive length. if the length is 0 means no data is read.)
BSL_INTERNAL_EXCEPTION,anunexpected internal error occurs.
BSL_UIO_FAIL,invalidparameter.
#BSL_UIO_IO_EXCEPTION,IOabnormal.

◆ BSL_UIO_GetTransportType()

BSL_UIO_TransportType BSL_UIO_GetTransportType ( const BSL_UIO * uio)

Obtain the UIO transmission protocol type

参数
uio[IN] UIO object.
返回值
protocoltype

◆ BSL_UIO_GetUioChainTransportType()

bool BSL_UIO_GetUioChainTransportType ( BSL_UIO * uio,
const BSL_UIO_TransportType uioType )

Obtain the UIO transmission protocol type

参数
uio[IN] UIO object.
uioType[IN] Type of the protocol to be obtained.
返回
TRUE, Succeeded in obtaining the UIO type.
FALSE, Failed to obtain the UIO type.

◆ BSL_UIO_GetUserData()

void * BSL_UIO_GetUserData ( const BSL_UIO * uio)

Obtain the user data in the UIO object.

The user data comes from users, and tls will not change any thing for user data, user can add some customize information.

参数
uio[IN] UIO object.
返回值
Succeededin obtaining the data structure pointer stored by the user.
NULL,theobtained data does not exist.

◆ BSL_UIO_MemMethod()

const BSL_UIO_Method * BSL_UIO_MemMethod ( void )

obtain the default MEM UIO

返回值
pointerto the MEM UIO method

◆ BSL_UIO_New()

BSL_UIO * BSL_UIO_New ( const BSL_UIO_Method * method)

Create a UIO object

参数
method[IN] UIO method structure
返回值
UIO,createdsuccessfully
NULLUIO, creation failure

◆ BSL_UIO_NewMethod()

BSL_UIO_Method * BSL_UIO_NewMethod ( void )

Creating uio method structure

返回值
uiomethod structure pointer

◆ BSL_UIO_Next()

BSL_UIO * BSL_UIO_Next ( BSL_UIO * uio)

Obtain the next UIO object in the chain.

参数
uio[IN] UIO object
返回值
NextUIO object in the chain.

◆ BSL_UIO_PopCurrent()

BSL_UIO * BSL_UIO_PopCurrent ( BSL_UIO * uio)

Pop UIO object from the chain.

注意
The reference counting of the added UIO object does not decrease by 1.
参数
uio[IN] UIO object of the pop-up link.
返回值
Thenext UIO object in the chain.

◆ BSL_UIO_Puts()

int32_t BSL_UIO_Puts ( BSL_UIO * uio,
const char * buf,
uint32_t * writeLen )

Write a string to the UIO object.

参数
uio[IN] uio object.
buf[IN] A null-terminated string to be written.
writeLen[OUT] Length of the data that is successfully written.
返回值
BSL_SUCCESS,Writingsucceeded.
BSL_INTERNAL_EXCEPTION,anunexpected internal error occurs.
#BSL_UIO_IO_BUSY,indicatingthat the underlying I/O is busy.
#BSL_UIO_IO_EXCEPTION,IOabnormal.
BSL_UIO_FAIL,invalidparameter.

◆ BSL_UIO_Read()

int32_t BSL_UIO_Read ( BSL_UIO * uio,
void * data,
uint32_t len,
uint32_t * readLen )

Read data from the UIO object.

参数
uio[IN] uio object.
data[IN] Buffer for receiving data
len[IN] Length of the received data buffer.
readLen[OUT] Length of the received data.
返回值
BSL_SUCCESS,Thedata is read successfully(Determined based on the actual receive length, if the length is 0 means no data is read.)
BSL_INTERNAL_EXCEPTION,anunexpected internal error occurs.
BSL_UIO_FAIL,invalidparameter.
#BSL_UIO_IO_EXCEPTION,IOis abnormal.

◆ BSL_UIO_SctpMethod()

const BSL_UIO_Method * BSL_UIO_SctpMethod ( void )

obtain the default SCTP UIO

返回值
pointerto the SCTP UIO method

◆ BSL_UIO_SetCtx()

void BSL_UIO_SetCtx ( BSL_UIO * uio,
void * ctx )

Set the implementation-related context.

参数
uio[IN] UIO object
ctx[IN] Implement the relevant context pointer.

◆ BSL_UIO_SetFD()

void BSL_UIO_SetFD ( BSL_UIO * uio,
int fd )

Set the fd of the UIO object

参数
uio[IN] UIO object
fd[IN] File Descriptor fd

◆ BSL_UIO_SetFlags()

int32_t BSL_UIO_SetFlags ( BSL_UIO * uio,
uint32_t flags )

Set the UIO object flag.

参数
uio[IN] UIO object
flags[IN] flag
返回值
BSL_SUCCESS,succeeded.
Otherreference: bsl_errno.h.

◆ BSL_UIO_SetInit()

void BSL_UIO_SetInit ( BSL_UIO * uio,
bool init )

Set the UIO init.

参数
uio[IN] UIO object
init[IN] init value

◆ BSL_UIO_SetIsUnderlyingClosedByUio()

void BSL_UIO_SetIsUnderlyingClosedByUio ( BSL_UIO * uio,
bool close )

Set whether resources associated with the UIO are closed by the UIO.

参数
uio[IN/OUT] UIO object
close[IN] true UIO-associated resources are closed by the UIO. false The resources associated with the UIO are not closed by the UIO.

◆ BSL_UIO_SetMethod()

int32_t BSL_UIO_SetMethod ( BSL_UIO_Method * meth,
int32_t type,
void * func )

set uio method callback

参数
meth[IN] uio method structure
type[IN] callback type
func[IN] callback pointer
返回值
BSL_SUCCESS
BSL_INVALID_ARG

◆ BSL_UIO_SetMethodType()

int32_t BSL_UIO_SetMethodType ( BSL_UIO_Method * meth,
BSL_UIO_TransportType type )

set uio method type

参数
meth[IN] uio method structure
type[IN] type
返回值
BSL_SUCCESS
BSL_NULL_INPUT

◆ BSL_UIO_SetUserData()

int32_t BSL_UIO_SetUserData ( BSL_UIO * uio,
void * data )

Set the user data in the UIO object

UIO will not modify the user data, user can add some information for the UIO, and get the information by use BSL_UIO_GetUserData function; After you set user data by calling BSL_UIO_SetUserData, you need to call BSL_UIO_SetUserData again before calling BSL_UIO_Free to set user data to null to ensure that all memory is released.

参数
uio[IN] UIO object.
data[IN] User data pointer
返回值
BSL_SUCCESS,success.
BSL_NULL_INPUT,invalidnull pointer.

◆ BSL_UIO_SetUserDataFreeFunc()

int32_t BSL_UIO_SetUserDataFreeFunc ( BSL_UIO * uio,
BSL_UIO_USERDATA_FREE_FUNC userDataFreeFunc )

Release the user data set in the UIO object.

Free uio->userData at BSL_UIO_Free.

参数
uio[IN] UIO object
data[IN] Pointer to the function for releasing user data
返回值
BSL_SUCCESS,success.
BSL_NULL_INPUT,invalidnull pointer.

◆ BSL_UIO_TcpMethod()

const BSL_UIO_Method * BSL_UIO_TcpMethod ( void )

obtain the default TCP UIO method

返回值
pointerto the TCP UIO method

◆ BSL_UIO_TestFlags()

uint32_t BSL_UIO_TestFlags ( const BSL_UIO * uio,
uint32_t flags,
uint32_t * out )

Check the UIO object flag

参数
uio[IN] UIO object
flags[IN] To-be-checked flag
out[OUT] Mark the detection result
返回值
BSL_SUCCESS,succeeded.
Otherreference: bsl_errno.h

◆ BSL_UIO_UdpMethod()

const BSL_UIO_Method * BSL_UIO_UdpMethod ( void )

obtain the default UDP UIO method

返回值
pointerto the UDP UIO method

◆ BSL_UIO_UpRef()

int32_t BSL_UIO_UpRef ( BSL_UIO * uio)

Set the value of uio reference counting to 1

注意
Call BSL_UIO_Free to decrease the value of reference counting by 1
参数
uio[IN] uio object
返回值
BSL_SUCCESS,thesetting is successful.
BSL_INTERNAL_EXCEPTION,anunexpected internal error occurs.
#BSL_UIO_REF_MAX,Thenumber of UIO objects has reached the maximum.

◆ BSL_UIO_Write()

int32_t BSL_UIO_Write ( BSL_UIO * uio,
const void * data,
uint32_t len,
uint32_t * writeLen )

Write data to the UIO object

参数
uio[IN] uio object.
data[IN] Data to be written.
len[IN] Data length.
writeLen[OUT] Length of the data that is successfully written.
返回值
BSL_SUCCESS,indicatingthat the data is successfully written.
BSL_INTERNAL_EXCEPTION,anunexpected internal error occurs.
#BSL_UIO_IO_BUSY,indicatingthat the underlying I/O is busy.
#BSL_UIO_IO_EXCEPTION,TheI/O is abnormal.
BSL_UIO_FAIL,invalidparameter.