PinCRT
|
Enumerations | |
enum | OS_APIS_IPC_SOCKET_DOMAIN { OS_APIS_IPC_SOCKET_DOMAIN_INET = 0, OS_APIS_IPC_SOCKET_DOMAIN_UNIX = 1 } |
enum | OS_APIS_IPC_SOCKET_TYPE { OS_APIS_IPC_SOCKET_TYPE_STREAM = 0 } |
enum | OS_APIS_IPC_SOCKET_PROTOCOL { OS_APIS_IPC_SOCKET_PROTOCOL_DEFAULT = 0 } |
enum | OS_APIS_IPC_SHUTDOWN { OS_APIS_IPC_SHUTDOWN_INVALID = 0, OS_APIS_IPC_SHUTDOWN_READ = (1<<0), OS_APIS_IPC_SHUTDOWN_WRITE = (1<<1) } |
enum | OS_APIS_IPC_SENDTO_FLAGS { OS_APIS_IPC_SENDTO_FLAGS_NONE = 0, OS_APIS_IPC_SENDTO_FLAGS_OOB = (1<<0), OS_APIS_IPC_SENDTO_FLAGS_DONT_ROUTE = (1<<1), OS_APIS_IPC_SENDTO_FLAGS_NO_SIGNAL = (1<<2) } |
Functions | |
OS_RETURN_CODE | OS_Pipe (OS_PIPE_CREATE_FLAGS flags, NATIVE_FD *readFd, NATIVE_FD *writeFd) |
OS_RETURN_CODE | OS_Socket (OS_APIS_IPC_SOCKET_DOMAIN domain, OS_APIS_IPC_SOCKET_TYPE type, OS_APIS_IPC_SOCKET_PROTOCOL protocol, NATIVE_FD *fd) |
OS_RETURN_CODE | OS_Accept (NATIVE_FD sockfd, struct sockaddr *addr, USIZE *addrlen, NATIVE_FD *newfd) |
OS_RETURN_CODE | OS_Listen (NATIVE_FD sockfd, INT backlog) |
OS_RETURN_CODE | OS_Connect (NATIVE_FD sockfd, const struct sockaddr *addr, USIZE addrlen) |
OS_RETURN_CODE | OS_Bind (NATIVE_FD sockfd, const struct sockaddr *addr, USIZE addrlen) |
OS_RETURN_CODE | OS_GetSockName (NATIVE_FD sockfd, const struct sockaddr *addr, USIZE *addrlen) |
OS_RETURN_CODE | OS_Shutdown (NATIVE_FD sockfd, OS_APIS_IPC_SHUTDOWN how) |
OS_RETURN_CODE | OS_SendTo (NATIVE_FD sockfd, const void *buffer, OS_APIS_IPC_SENDTO_FLAGS flags, const struct sockaddr *dest_addr, USIZE dest_len, USIZE *buf_length) |
Value for argument how to OS_Shutdown()
enum OS_APIS_IPC_SHUTDOWN |
Value for argument how to OS_Shutdown()
Enumerator | |
---|---|
OS_APIS_IPC_SHUTDOWN_INVALID | Invalid value for socket shutdown. |
OS_APIS_IPC_SHUTDOWN_READ | Shutdown socket's read side. |
OS_APIS_IPC_SHUTDOWN_WRITE | Shutdown socket's write side. |
OS_RETURN_CODE OS_Accept | ( | NATIVE_FD | sockfd, |
struct sockaddr * | addr, | ||
USIZE * | addrlen, | ||
NATIVE_FD * | newfd | ||
) |
Accepts a new connection on a listening socket. See man page of accept(2) for more details.
[in] | sockfd | The listening socket |
[out] | addr | The address of the remote connection that was accepted. |
[in,out] | addrlen | The size in bytes of addr, returns the number of bytes writen to addr. |
[out] | newfd | The file descriptor of the socket created for this session. |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
OS_RETURN_CODE OS_Bind | ( | NATIVE_FD | sockfd, |
const struct sockaddr * | addr, | ||
USIZE | addrlen | ||
) |
Bind this socket to a local address. See man page of bind(2) for more details.
[in] | sockfd | The socket to bind. |
[in] | addr | The address to bind the socket to. |
[in] | addrlen | The size in bytes of addr. |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
OS_RETURN_CODE OS_Connect | ( | NATIVE_FD | sockfd, |
const struct sockaddr * | addr, | ||
USIZE | addrlen | ||
) |
Connect this socket to a remote socket. See man page of connet(2) for more details.
[in] | sockfd | The socket to initiate the connect from. |
[in] | addr | The address of the remote socket to connect to. |
[in] | addrlen | The size in bytes of addr. |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
OS_RETURN_CODE OS_GetSockName | ( | NATIVE_FD | sockfd, |
const struct sockaddr * | addr, | ||
USIZE * | addrlen | ||
) |
Return the local address where the socket was bound. See man page of getsockname(2) for more details.
[in] | sockfd | The socket to initiate the connect from. |
[out] | addr | The address where the socket was bound. |
[in,out] | addrlen | The size in bytes of addr, returns the number of bytes writen to addr. |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
OS_RETURN_CODE OS_Listen | ( | NATIVE_FD | sockfd, |
INT | backlog | ||
) |
Listen for incomming connection in a socket. See man page of listen(2) for more details.
[in] | sockfd | The socket to listen on. |
[in] | backlog | Number of connections to backlog (the meanning of it depends on the OS and kernel version). |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
OS_RETURN_CODE OS_Pipe | ( | OS_PIPE_CREATE_FLAGS | flags, |
NATIVE_FD * | readFd, | ||
NATIVE_FD * | writeFd | ||
) |
Creates an anonymous pipe, and returns handles to the read and write ends of the pipe.
[in] | flags | Pipes creation flags |
[out] | readFd | File descriptor for the read side |
[out] | writeFd | File descriptor for the write side |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_INVALID_ARGS | One of the input arguments is invalid. |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
OS_RETURN_CODE OS_SendTo | ( | NATIVE_FD | sockfd, |
const void * | buffer, | ||
OS_APIS_IPC_SENDTO_FLAGS | flags, | ||
const struct sockaddr * | dest_addr, | ||
USIZE | dest_len, | ||
USIZE * | buf_length | ||
) |
Transmit a message to another socket.
[in] | sockfd | The socket to send data to. |
[in] | buffer | Data buffer |
[in] | flags | Message flags |
[in] | dest_addr | Socket destination address |
[in] | dest_len | Size of dest_addr |
[in,out] | buf_length | Length of the bytes in buffer / bytes sent |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_WRITE_FAILED | If the operation failed |
OS_RETURN_CODE OS_Shutdown | ( | NATIVE_FD | sockfd, |
OS_APIS_IPC_SHUTDOWN | how | ||
) |
Causes all or part of a full-duplex connection on the socket associated with sockfd to be shut down.
[in] | sockfd | The file descriptor of the socket to shut down. |
[in] | how | Bitwise OR of the value in OS_APIS_IPC_SHUTDOWN. If OS_APIS_IPC_SHUTDOWN_READ is specified, further receptions will be disallowed. If OS_APIS_IPC_SHUTDOWN_WRITE is specified,further transmissions will be disallowed. |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_INVALID_ARGS | If the value of how is invalid. |
OS_RETURN_CODE_FILE_CLOSE_FAILED | If the operation failed |
OS_RETURN_CODE OS_Socket | ( | OS_APIS_IPC_SOCKET_DOMAIN | domain, |
OS_APIS_IPC_SOCKET_TYPE | type, | ||
OS_APIS_IPC_SOCKET_PROTOCOL | protocol, | ||
NATIVE_FD * | fd | ||
) |
Creates a socket. See man page of socket(2) for more details.
[in] | domain | Socket domain |
[in] | type | Socket type |
[in] | protocol | Socket Protocol |
[out] | fd | Created file descriptor for the socket |
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_INVALID_ARGS | One of the input arguments is invalid. |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |