PinCRT
Enumerations | Functions
IPC

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

◆ OS_APIS_IPC_SENDTO_FLAGS

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.

◆ 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_APIS_IPC_SOCKET_DOMAIN

Socket domain

Enumerator
OS_APIS_IPC_SOCKET_DOMAIN_INET 

Internet socket.

◆ OS_APIS_IPC_SOCKET_PROTOCOL

Socket domain

Enumerator
OS_APIS_IPC_SOCKET_PROTOCOL_DEFAULT 

Full-duplex byte stream.

◆ OS_APIS_IPC_SOCKET_TYPE

Socket domain

Enumerator
OS_APIS_IPC_SOCKET_TYPE_STREAM 

Full-duplex byte stream.

Function Documentation

◆ OS_Accept()

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.

Parameters
[in]sockfdThe listening socket
[out]addrThe address of the remote connection that was accepted.
[in,out]addrlenThe size in bytes of addr, returns the number of bytes writen to addr.
[out]newfdThe file descriptor of the socket created for this session.
Return values
OS_RETURN_CODE_NO_ERRORIf the operation succeeded
OS_RETURN_CODE_FILE_OPEN_FAILEDIf the operation failed
Availability:
O/S: Linux & macOS*
CPU: All

◆ OS_Bind()

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.

Parameters
[in]sockfdThe socket to bind.
[in]addrThe address to bind the socket to.
[in]addrlenThe size in bytes of addr.
Return values
OS_RETURN_CODE_NO_ERRORIf the operation succeeded
OS_RETURN_CODE_FILE_OPEN_FAILEDIf the operation failed
Availability:
O/S: Linux & macOS*
CPU: All

◆ OS_Connect()

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.

Parameters
[in]sockfdThe socket to initiate the connect from.
[in]addrThe address of the remote socket to connect to.
[in]addrlenThe size in bytes of addr.
Return values
OS_RETURN_CODE_NO_ERRORIf the operation succeeded
OS_RETURN_CODE_FILE_OPEN_FAILEDIf the operation failed
Availability:
O/S: Linux & macOS*
CPU: All

◆ OS_GetSockName()

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.

Parameters
[in]sockfdThe socket to initiate the connect from.
[out]addrThe address where the socket was bound.
[in,out]addrlenThe size in bytes of addr, returns the number of bytes writen to addr.
Return values
OS_RETURN_CODE_NO_ERRORIf the operation succeeded
OS_RETURN_CODE_FILE_OPEN_FAILEDIf the operation failed
Availability:
O/S: Linux & macOS*
CPU: All

◆ OS_Listen()

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.

Parameters
[in]sockfdThe socket to listen on.
[in]backlogNumber of connections to backlog (the meanning of it depends on the OS and kernel version).
Return values
OS_RETURN_CODE_NO_ERRORIf the operation succeeded
OS_RETURN_CODE_FILE_OPEN_FAILEDIf the operation failed
Availability:
O/S: Linux & macOS*
CPU: All

◆ OS_Pipe()

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.

Parameters
[in]flagsPipes creation flags
[out]readFdFile descriptor for the read side
[out]writeFdFile descriptor for the write side
Return values
OS_RETURN_CODE_NO_ERRORIf the operation succeeded
OS_RETURN_CODE_INVALID_ARGSOne of the input arguments is invalid.
OS_RETURN_CODE_FILE_OPEN_FAILEDIf the operation failed
Availability:
O/S: All
CPU: All

◆ OS_SendTo()

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.

Parameters
[in]sockfdThe socket to send data to.
[in]bufferData buffer
[in]flagsMessage flags
[in]dest_addrSocket destination address
[in]dest_lenSize of dest_addr
[in,out]buf_lengthLength of the bytes in buffer / bytes sent
Return values
OS_RETURN_CODE_NO_ERRORIf the operation succeeded
OS_RETURN_CODE_FILE_WRITE_FAILEDIf the operation failed
Availability:
O/S: Linux & macOS*
CPU: All

◆ OS_Shutdown()

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.

Parameters
[in]sockfdThe file descriptor of the socket to shut down.
[in]howBitwise 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_ERRORIf the operation succeeded
OS_RETURN_CODE_INVALID_ARGSIf the value of how is invalid.
OS_RETURN_CODE_FILE_CLOSE_FAILEDIf the operation failed
Availability:
O/S: Linux & macOS*
CPU: All

◆ OS_Socket()

Creates a socket. See man page of socket(2) for more details.

Parameters
[in]domainSocket domain
[in]typeSocket type
[in]protocolSocket Protocol
[out]fdCreated file descriptor for the socket
Return values
OS_RETURN_CODE_NO_ERRORIf the operation succeeded
OS_RETURN_CODE_INVALID_ARGSOne of the input arguments is invalid.
OS_RETURN_CODE_FILE_OPEN_FAILEDIf the operation failed
Availability:
O/S: Linux & macOS*
CPU: All