RTnet:API
From Xenomai
[edit] Introduction
The RTnet API is fully described in the Xenomai API spec. This page is only a summery of that spec with RTnet specifics added to complete it.
[edit] API
TODO: Clean up, list only the supported service entry points, refer to RTDM API / POSIX for details
[edit] rt_dev_open
int rt_dev_open (const char *path, int oflag,...)
Open a device.
[edit] rt_dev_socket
int rt_dev_socket (int protocol_family, int socket_type, int protocol)
Create a socket.
[edit] rt_dev_close
int rt_dev_close (int fd)
Close a device or socket.
[edit] rt_dev_ioctl
int rt_dev_ioctl (int fd, int request,...)
Issue an IOCTL. This function call is used to configure some of the behaviours of the RTnet sockets such as the timeout of a receive and other such functions. It is the real-time equivalent of the standard ioctrl. The request parameters used in this function for RTnet can be found under IO Control Definitions at the bottom of this page. In addition to that the following parameters are also supported: SIOCGIFCONF, SIOCGIFFLAGS, SIOCGIFINDEX (see linux documentation for details: man netdevice).
[edit] rt_dev_read
ssize_t rt_dev_read (int fd, void *buf, size_t nbyte)
Read from device.
[edit] rt_dev_write
ssize_t rt_dev_write (int fd, const void *buf, size_t nbyte)
Write to device.
[edit] rt_dev_recvmsg
ssize_t rt_dev_recvmsg (int fd, struct msghdr *msg, int flags)
Receive message from socket.
[edit] rt_dev_recvfrom
ssize_t rt_dev_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
Receive message from socket.
[edit] rt_dev_recv
ssize_t rt_dev_recv (int fd, void *buf, size_t len, int flags)
Receive message from socket.
[edit] rt_dev_sendmsg
ssize_t rt_dev_sendmsg (int fd, const struct msghdr *msg, int flags)
Transmit message to socket.
[edit] rt_dev_sendto
ssize_t rt_dev_sendto (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
Transmit message to socket.
[edit] rt_dev_send
ssize_t rt_dev_send (int fd, const void *buf, size_t len, int flags)
Transmit message to socket.
[edit] rt_dev_bind
int rt_dev_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
Bind to local address.
[edit] rt_dev_connect
int rt_dev_connect (int fd, const struct sockaddr *serv_addr, socklen_t addrlen)
Connect to remote address.
[edit] rt_dev_listen
int rt_dev_listen (int fd, int backlog)
Listen for incomming connection requests.
[edit] rt_dev_accept
int rt_dev_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
Accept a connection requests.
[edit] rt_dev_shutdown
int rt_dev_shutdown (int fd, int how)
Shut down parts of a connection.
[edit] rt_dev_getsockopt
int rt_dev_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
Get socket option.
[edit] rt_dev_setsockopt
int rt_dev_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
Set socket option.
[edit] rt_dev_getsockname
int rt_dev_getsockname (int fd, struct sockaddr *name, socklen_t *namelen)
Get local socket address.
[edit] rt_dev_getpeername
int rt_dev_getpeername (int fd, struct sockaddr *name, socklen_t *namelen)
Get socket destination address.
[edit] IO Control Definitions
[edit] RTNET_RTIOC_XMITPARAMS
- Argument
- int *delta
[edit] RTNET_RTIOC_TIMEOUT
This socket control option is used to specify the time-out on the socket before it returns. It is used typically to wait for data on a Read. The time-out specifies the amount of time the function will wait for data before it returns.
- Argument
- *int64_t nanosecs
- Values
- 0 = (default). Blocking waits infinitely until data has been received.
- - 1 = Non-Blocking, returns immediately
- Positive Value = Any positive value indicates a time-out for the socket in nano seconds before it returns
Example: Setting the socket to non-blocking.
int64_t timeout = -1 rt_dev_ioctl(fd, RTNET_RTIOC_TIMEOUT, &timeout);
[edit] RTNET_RTIOC_CALLBACK
Sets the callback handler for kernel mode only.
- Arguments
- struct rtnet_callback *
[edit] RTNET_RTIOC_EXTPOOL
To Extend the buffer pool of sockets. To receive / transmit a message, all required buffers are taken from the pool of the destination / source socket. If the socket was created in real-time, these IOCTLs also require realtime context. If creation was performed in non-real-time, the IOCTLs must be called in non-real-time as well. See Documentation/README.pools for further details
- Argument
- int *delta
[edit] RTNET_RTIOC_SHRPOOL
To Shrink the buffer pool of sockets. To receive / transmit a message, all required buffers are taken from the pool of the destination / source socket. If the socket was created in real-time, these IOCTLs also require realtime context. If creation was performed in non-real-time, the IOCTLs must be called in non-real-time as well. See Documentation/README.pools for further details
- Argument
- int *delta
[edit] Utility functions
NOTE: These functions are kernel-only, see normal libc services for user space.
[edit] rt_inet_aton
This function is the realtime equivalent of the Linux function inet_aton. It converts a dots and numbers format string ("127.0.0.1") to a network address in struct in_addr.
[edit] rt_eth_aton
TBD.


