|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Vtable of low-level OS socket operations implemented by an OSAdapter. More...
#include <rte_osadapter_socket.h>
Data Fields | |
| rte_status_t(*) | open (rte_os_socket_type_t type, rte_os_socket_handle_t *out_handle) |
| Creates a raw socket of the specified type, non-blocking from creation (REQ-OAL-SOCKET-001, OSA rule R5). | |
| rte_status_t(*) | bind (rte_os_socket_handle_t handle, const char *host, uint16_t port) |
| Binds a socket to a local host and port. | |
| rte_status_t(*) | connect (rte_os_socket_handle_t handle, const char *host, uint16_t port) |
| Connects a socket to a remote host and port. | |
| rte_status_t(*) | send (rte_os_socket_handle_t handle, const void *buf, size_t len, size_t *out_sent) |
| Sends data on a connected socket. | |
| rte_status_t(*) | sendto (rte_os_socket_handle_t handle, const void *buf, size_t len, const char *host, uint16_t port, size_t *out_sent) |
| Sends a datagram to a specific remote host and port. | |
| rte_status_t(*) | recv (rte_os_socket_handle_t handle, void *buf, size_t len, size_t *out_recv) |
| Receives data from a connected socket. | |
| rte_status_t(*) | recvfrom (rte_os_socket_handle_t handle, void *buf, size_t len, char *out_host, size_t host_len, uint16_t *out_port, size_t *out_recv) |
| Receives a datagram and captures sender endpoint. | |
| rte_status_t(*) | poll (rte_os_socket_handle_t handle, uint32_t events, rte_duration_ms_t timeout_ms, uint32_t *out_revents) |
| Polls a socket for I/O readiness with timeout. | |
| rte_status_t(*) | set_nonblocking (rte_os_socket_handle_t handle, bool nonblocking) |
| Configures non-blocking mode on socket. | |
| rte_status_t(*) | close (rte_os_socket_handle_t handle) |
| Closes a socket handle. | |
Vtable of low-level OS socket operations implemented by an OSAdapter.
Definition at line 60 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::open(rte_os_socket_type_t type, rte_os_socket_handle_t *out_handle) |
Creates a raw socket of the specified type, non-blocking from creation (REQ-OAL-SOCKET-001, OSA rule R5).
Post-condition of RTE_STATUS_OK: *out_handle holds a non-blocking socket, so an I/O call that cannot complete at once returns instead of waiting; set_nonblocking(false) can still switch it to blocking. An OSAdapter that cannot make the socket non-blocking releases it and never hands out a blocking socket.
| type | RTE_OS_SOCKET_TYPE_UDP or RTE_OS_SOCKET_TYPE_TCP. |
| out_handle | Output socket handle. Must not be NULL. Written only on RTE_STATUS_OK. |
Definition at line 76 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::bind(rte_os_socket_handle_t handle, const char *host, uint16_t port) |
Binds a socket to a local host and port.
| handle | Valid socket handle. |
| host | Local IP address string (e.g. "127.0.0.1" or NULL for INADDR_ANY). |
| port | Local port in host byte order. |
Definition at line 84 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::connect(rte_os_socket_handle_t handle, const char *host, uint16_t port) |
Connects a socket to a remote host and port.
| handle | Valid socket handle. |
| host | Remote IP address string (e.g. "127.0.0.1"). Must not be NULL. |
| port | Remote port in host byte order. |
Definition at line 92 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::send(rte_os_socket_handle_t handle, const void *buf, size_t len, size_t *out_sent) |
Sends data on a connected socket.
| handle | Valid connected socket handle. |
| buf | Buffer containing data to send. Must not be NULL. |
| len | Number of bytes to send. |
| out_sent | Optional output parameter receiving bytes actually sent. |
Definition at line 101 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::sendto(rte_os_socket_handle_t handle, const void *buf, size_t len, const char *host, uint16_t port, size_t *out_sent) |
Sends a datagram to a specific remote host and port.
| handle | Valid socket handle. |
| buf | Buffer containing datagram to send. Must not be NULL. |
| len | Number of bytes to send. |
| host | Destination IP address string. Must not be NULL. |
| port | Destination port in host byte order. |
| out_sent | Optional output parameter receiving bytes actually sent. |
Definition at line 112 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::recv(rte_os_socket_handle_t handle, void *buf, size_t len, size_t *out_recv) |
Receives data from a connected socket.
| handle | Valid connected socket handle. |
| buf | Buffer receiving data. Must not be NULL. |
| len | Maximum bytes to receive. |
| out_recv | Output parameter receiving bytes actually received. Must not be NULL. |
Definition at line 122 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::recvfrom(rte_os_socket_handle_t handle, void *buf, size_t len, char *out_host, size_t host_len, uint16_t *out_port, size_t *out_recv) |
Receives a datagram and captures sender endpoint.
| handle | Valid socket handle. |
| buf | Buffer receiving datagram. Must not be NULL. |
| len | Maximum bytes to receive. |
| out_host | Buffer to store sender IP address string (may be NULL). |
| host_len | Capacity of out_host buffer. |
| out_port | Pointer to store sender port (may be NULL). |
| out_recv | Output parameter receiving bytes actually received. Must not be NULL. |
Definition at line 134 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::poll(rte_os_socket_handle_t handle, uint32_t events, rte_duration_ms_t timeout_ms, uint32_t *out_revents) |
Polls a socket for I/O readiness with timeout.
| handle | Valid socket handle. |
| events | Bitmask of RTE_OS_SOCKET_EVENT_* to monitor. |
| timeout_ms | Maximum time to wait in milliseconds. |
| out_revents | Output bitmask of events ready. Must not be NULL. |
Definition at line 144 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::set_nonblocking(rte_os_socket_handle_t handle, bool nonblocking) |
Configures non-blocking mode on socket.
open() already delivers a non-blocking socket (REQ-OAL-SOCKET-001); set_nonblocking(true) on a fresh socket confirms that mode, set_nonblocking(false) switches it to blocking.
| handle | Valid socket handle. |
| nonblocking | True for non-blocking, false for blocking. |
Definition at line 157 of file rte_osadapter_socket.h.
| rte_status_t(*) rte_os_socket_ops_t::close(rte_os_socket_handle_t handle) |
Closes a socket handle.
| handle | Valid socket handle. |
Definition at line 163 of file rte_osadapter_socket.h.