|
mavtables
0.2.1
MAVLink router and firewall.
|
#include <UnixSyscalls.hpp>

Public Member Functions | |
| TEST_VIRTUAL | ~UnixSyscalls ()=default |
| TEST_VIRTUAL int | bind (int sockfd, const struct sockaddr *addr, socklen_t addrlen) |
| TEST_VIRTUAL int | close (int fd) |
| TEST_VIRTUAL int | ioctl (int fd, unsigned long request, void *argp) |
| TEST_VIRTUAL int | open (const char *pathname, int flags) |
| TEST_VIRTUAL int | poll (struct pollfd *fds, nfds_t nfds, int timeout) |
| TEST_VIRTUAL ssize_t | read (int fd, void *buf, size_t count) |
| TEST_VIRTUAL ssize_t | recvfrom (int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) |
| TEST_VIRTUAL ssize_t | sendto (int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) |
| TEST_VIRTUAL int | socket (int domain, int type, int protocol) |
| TEST_VIRTUAL int | tcgetattr (int fd, struct termios *termios_p) |
| TEST_VIRTUAL int | tcsetattr (int fd, int optional_actions, const struct termios *termios_p) |
| TEST_VIRTUAL ssize_t | write (int fd, const void *buf, size_t count) |
A thin wrapper around Unix system calls.
The purpose of this is to allow system calls to be mocked during testing.
See the following man pages for documentation:
Definition at line 54 of file UnixSyscalls.hpp.
|
default |
| int UnixSyscalls::bind | ( | int | sockfd, |
| const struct sockaddr * | addr, | ||
| socklen_t | addrlen | ||
| ) |
Bind a name to a socket.
See man 2 bind for documentation.
| sockfd | Socket file descriptor. |
| addr | Address to assign to socket. |
| addrlen | Size of address structure in bytes. |
Definition at line 40 of file UnixSyscalls.cpp.
| int UnixSyscalls::close | ( | int | fd | ) |
Close a file descriptor.
See man 2 close for documentation.
| fd | The file descriptor to close. |
Definition at line 54 of file UnixSyscalls.cpp.
| int UnixSyscalls::ioctl | ( | int | fd, |
| unsigned long | request, | ||
| void * | argp | ||
| ) |
Control device.
See man 2 ioctl for documentation.
| fd | The file descriptor to control. |
| request | Request code, defined in <sys/ioctl.h> |
| argp | Pointer to input/output, dependent on request code. |
Definition at line 69 of file UnixSyscalls.cpp.
| int UnixSyscalls::open | ( | const char * | pathname, |
| int | flags | ||
| ) |
Open and possibly create a file.
See man 2 open for documentation.
Definition at line 80 of file UnixSyscalls.cpp.
| int UnixSyscalls::poll | ( | struct pollfd * | fds, |
| nfds_t | nfds, | ||
| int | timeout | ||
| ) |
Wait for some event on a file descriptor.
See man 2 poll for documentation.
| fds | File descriptor event structures. |
| nfds | Number of file descriptor event structures. |
| timeout | The timeout in milliseconds. |
Definition at line 95 of file UnixSyscalls.cpp.
| ssize_t UnixSyscalls::read | ( | int | fd, |
| void * | buf, | ||
| size_t | count | ||
| ) |
Read from a file descriptor.
See man 2 read for documentation.
Definition at line 106 of file UnixSyscalls.cpp.
| ssize_t UnixSyscalls::recvfrom | ( | int | sockfd, |
| void * | buf, | ||
| size_t | len, | ||
| int | flags, | ||
| struct sockaddr * | src_addr, | ||
| socklen_t * | addrlen | ||
| ) |
Receive a message from a socket.
See man 2 recvfrom for documentation.
| sockfd | Socket file descriptor to receive data on. |
| buf | The buffer to write the data into. |
| len | The length of the buffer. |
| flags | Option flags. |
| src_addr | Source address buffer. |
| addrlen | Before call, length of source address buffer. After call, actual length of address data. |
or -1 if an error occurred. Definition at line 126 of file UnixSyscalls.cpp.
| ssize_t UnixSyscalls::sendto | ( | int | sockfd, |
| const void * | buf, | ||
| size_t | len, | ||
| int | flags, | ||
| const struct sockaddr * | dest_addr, | ||
| socklen_t | addrlen | ||
| ) |
Send a message on a socket.
See man 2 sendto for documentation.
Definition at line 139 of file UnixSyscalls.cpp.
| int UnixSyscalls::socket | ( | int | domain, |
| int | type, | ||
| int | protocol | ||
| ) |
Create an endpoint for communication.
See man 2 socket for documentation.
| domain | Protocol family to use for communication. |
| type | Socket type. |
| protocol | Protocol to use for socket. |
Definition at line 156 of file UnixSyscalls.cpp.
| int UnixSyscalls::tcgetattr | ( | int | fd, |
| struct termios * | termios_p | ||
| ) |
Get serial port parameters associated with the given file descriptor.
See man 2 termios for documentation.
Definition at line 167 of file UnixSyscalls.cpp.
| int UnixSyscalls::tcsetattr | ( | int | fd, |
| int | optional_actions, | ||
| const struct termios * | termios_p | ||
| ) |
Set serial port parameters for given file descriptor.
See man 2 termios for documentation.
Definition at line 178 of file UnixSyscalls.cpp.
| ssize_t UnixSyscalls::write | ( | int | fd, |
| const void * | buf, | ||
| size_t | count | ||
| ) |
Write to a file descriptor.
See man 2 write for documentation.
Definition at line 190 of file UnixSyscalls.cpp.
1.8.14