memory.h
More...
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) |
Detailed Description
ipc-pipe.h
Contains IPC related os apis
Enumeration Type Documentation
Value for argument how to OS_Shutdown()
- Enumerator:
OS_APIS_IPC_SENDTO_FLAGS_NONE |
No flags specified.
|
OS_APIS_IPC_SENDTO_FLAGS_OOB |
Send out of band message.
|
OS_APIS_IPC_SENDTO_FLAGS_DONT_ROUTE |
bypass routing, use direct interface
|
OS_APIS_IPC_SENDTO_FLAGS_NO_SIGNAL |
Don't send SIGPIPE when the other side of the connection is closed.
|
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.
|
Socket domain
- Enumerator:
OS_APIS_IPC_SOCKET_DOMAIN_INET |
Internet socket.
|
Socket domain
- Enumerator:
OS_APIS_IPC_SOCKET_PROTOCOL_DEFAULT |
Full-duplex byte stream.
|
Socket domain
- Enumerator:
OS_APIS_IPC_SOCKET_TYPE_STREAM |
Full-duplex byte stream.
|
Function Documentation
Accepts a new connection on a listening socket. See man page of accept(2) for more details.
- Parameters:
-
[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. |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
- Availability:
- O/S: Linux & macOS*
CPU: All
Bind this socket to a local address. See man page of bind(2) for more details.
- Parameters:
-
[in] | sockfd | The socket to bind. |
[in] | addr | The address to bind the socket to. |
[in] | addrlen | The size in bytes of addr. |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
- Availability:
- O/S: Linux & macOS*
CPU: All
Connect this socket to a remote socket. See man page of connet(2) for more details.
- Parameters:
-
[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. |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
- Availability:
- O/S: Linux & macOS*
CPU: All
Return the local address where the socket was bound. See man page of getsockname(2) for more details.
- Parameters:
-
[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. |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
- Availability:
- O/S: Linux & macOS*
CPU: All
Listen for incomming connection in a socket. See man page of listen(2) for more details.
- Parameters:
-
[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). |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_OPEN_FAILED | If the operation failed |
- Availability:
- O/S: Linux & macOS*
CPU: All
Creates an anonymous pipe, and returns handles to the read and write ends of the pipe.
- Parameters:
-
[in] | flags | Pipes creation flags |
[out] | readFd | File descriptor for the read side |
[out] | writeFd | File descriptor for the write side |
- Return values:
-
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 |
- Availability:
- O/S: All
CPU: All
Transmit a message to another socket.
- Parameters:
-
[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 |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_FILE_WRITE_FAILED | If the operation failed |
- Availability:
- O/S: Linux & macOS*
CPU: All
Causes all or part of a full-duplex connection on the socket associated with sockfd to be shut down.
- Parameters:
-
[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. |
- Return values:
-
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 |
- Availability:
- O/S: Linux & macOS*
CPU: All
Creates a socket. See man page of socket(2) for more details.
- Parameters:
-
[in] | domain | Socket domain |
[in] | type | Socket type |
[in] | protocol | Socket Protocol |
[out] | fd | Created file descriptor for the socket |
- Return values:
-
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 |
- Availability:
- O/S: Linux & macOS*
CPU: All