|
Open Model Railroad Network (OpenMRN)
|
Static Public Member Functions | |
| static int | socket (int domain, int type, int protocol) |
| Create an unbound socket in a communications domain. | |
| static int | bind (int socket, const struct sockaddr *address, socklen_t address_len) |
| Bind a name to a socket. | |
| static int | listen (int socket, int backlog) |
| Mark a connection-mode socket, specified by the socket argument, as accepting connections. | |
| static int | accept (int socket, struct sockaddr *address, socklen_t *address_len) |
| Accept a new connection on a socket. | |
| static int | connect (int socket, const struct sockaddr *address, socklen_t address_len) |
| Connect a socket. | |
| static ssize_t | recv (int socket, void *buffer, size_t length, int flags) |
| Receive a message from a connection-mode or connectionless-mode socket. | |
| static ssize_t | send (int socket, const void *buffer, size_t length, int flags) |
| Initiate transmission of a message from the specified socket. | |
| static int | setsockopt (int socket, int level, int option_name, const void *option_value, socklen_t option_len) |
| Set the socket options. | |
| static int | getsockopt (int socket, int level, int option_name, void *option_value, socklen_t *option_len) |
| Get the socket options. | |
Static Public Member Functions inherited from Device | |
| static int | open (struct _reent *reent, const char *path, int flags, int mode) |
| Open a file or device. | |
| static int | close (struct _reent *reent, int fd) |
| Close a file or device. | |
| static int | stat (struct _reent *reent, const char *path, struct stat *stat) |
| Get the status information of a file or device. | |
| static int | select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, long long timeout) |
| POSIX select(). | |
| static void | select_clear () |
| Clears the current thread's select bits. | |
Static Public Member Functions inherited from FileIO | |
| static ssize_t | read (struct _reent *reent, int fd, void *buf, size_t count) |
| Read from a file or device. | |
| static ssize_t | write (struct _reent *reent, int fd, const void *buf, size_t count) |
| Write to a file or device. | |
| static _off_t | lseek (struct _reent *reent, int fd, _off_t offset, int whence) |
| Change the offset index of a file or device. | |
| static int | fstat (struct _reent *reent, int fd, struct stat *stat) |
| Get the status information of a file or device. | |
| static int | ioctl (int fd, unsigned long int key, unsigned long data) |
| Request and ioctl transaction. | |
| static int | fcntl (int fd, int cmd, unsigned long data) |
| Manipulate a file descriptor. | |
| static bool | is_device (int fd) |
| Test if the file descriptor belongs to a device. | |
Private Member Functions | |
| int | close (File *file) override |
| Close method. | |
| bool | select (File *file, int mode) override |
| Device select method. | |
| int | fcntl (File *file, int cmd, unsigned long data) override |
| Manipulate a file descriptor. | |
| FreeRTOSTCPSocket () | |
| Constructor. | |
| ~FreeRTOSTCPSocket () | |
| Destructor. | |
| DISALLOW_COPY_AND_ASSIGN (FreeRTOSTCPSocket) | |
Static Private Member Functions | |
| static FreeRTOSTCPSocket * | get_sd_by_index (int inx) |
| Get the socket descriptor assoicated with socket index. | |
| static int | alloc_instance (Socket_t sd) |
| Allocate a new FreeRTOSTCPSocket and related structures. | |
| static FreeRTOSTCPSocket * | get_instance_from_sd (Socket_t sd) |
| Get the FreeRTOSTCP instance given a specific socket descriptor. | |
| static void | remove_instance_from_sd (Socket_t sd) |
| Remove the FreeRTOSTCP instance from the active FreeRTOSTCP list. | |
Private Attributes | |
| Socket_t | sd |
| FreeRTOS socket descriptor. | |
| bool | readActive |
| indicates our "best guess" at current socket's read active status | |
| bool | writeActive |
| indicates our "best guess" at current socket's write active status | |
| bool | listenActive |
| This is a listen socket. | |
Friends | |
| class | FreeRTOSTCP |
| allow access to private members from FreeRTOSTCP | |
Additional Inherited Members | |
Public Member Functions inherited from Device | |
| Device (const char *name) | |
| Constructor. | |
| virtual | ~Device () |
| Destructor. | |
Protected Member Functions inherited from Socket | |
| Socket (const char *name) | |
| Constructor. | |
| ~Socket () | |
| Destructor. | |
| int | ioctl (File *file, unsigned long int key, unsigned long data) override |
| Request an ioctl transaction. | |
| bool | select (File *file, int mode) override |
| Device select method. | |
Protected Member Functions inherited from Node | |
| Node (const char *name) | |
| Constructor. | |
| virtual | ~Node () |
| Destructor. | |
| int | open (File *, const char *, int, int) OVERRIDE |
| Open method. | |
| int | close (File *) OVERRIDE |
| Close method. | |
| virtual int | fstat (File *file, struct stat *stat) override |
| Get the status information of a file or device. | |
Protected Member Functions inherited from FileIO | |
| FileIO (const char *name) | |
| Constructor. | |
| virtual | ~FileIO () |
| Destructor. | |
Static Protected Member Functions inherited from Device | |
| static void | select_insert (SelectInfo *info) |
| Add client to list of clients needing woken. | |
| static void | select_wakeup (SelectInfo *info) |
| Wakeup the list of clients needing woken. | |
| static void | select_wakeup_from_isr (SelectInfo *info, int *woken) |
| Wakeup the list of clients needing woken. | |
Static Protected Member Functions inherited from FileIO | |
| static int | fd_alloc (void) |
| Allocate a free file descriptor. | |
| static void | fd_free (int fd) |
| Free up a file descriptor. | |
| static File * | file_lookup (int fd) |
| Looks up a reference to a File corresponding to a given file descriptor. | |
| static int | fd_lookup (File *file) |
| Looks up a file descriptor corresponding to a given File reference. | |
Protected Attributes inherited from Socket | |
| SelectInfo | selInfoRd |
| select wakeup metadata for read active | |
| SelectInfo | selInfoWr |
| select wakeup metadata for write active | |
Protected Attributes inherited from Node | |
| OSMutex | lock_ |
| protects internal structures. | |
| mode_t | mode_ |
| File open mode, such as O_NONBLOCK. | |
| unsigned int | references_ |
| number of open references | |
Protected Attributes inherited from FileIO | |
| const char * | name |
| device name | |
Static Protected Attributes inherited from FileIO | |
| static const unsigned int | numOpenFiles = 20 |
| static File | files [] |
| File descriptor pool. | |
| static OSMutex | mutex |
| mutual exclusion for fileio | |
Definition at line 47 of file FreeRTOSTCPSocket.hxx.
|
inlineprivate |
Constructor.
Definition at line 198 of file FreeRTOSTCPSocket.hxx.
|
inlineprivate |
Destructor.
Definition at line 209 of file FreeRTOSTCPSocket.hxx.
|
static |
Accept a new connection on a socket.
| socket | the socket file descriptor |
| address | either a null pointer, or a pointer to a sockaddr structure where the address of the connecting socket shall be returned |
| address_len | either a null pointer, if address is a null pointer, or a pointer to a socklen_t object which on input specifies the length of the supplied sockaddr structure, and on output specifies the length of the stored address |
Definition at line 250 of file FreeRTOSTCPSocket.cxx.
|
staticprivate |
Allocate a new FreeRTOSTCPSocket and related structures.
| sd | FreeRTOS socket descriptor |
Definition at line 727 of file FreeRTOSTCPSocket.cxx.
|
static |
Bind a name to a socket.
| socket | file descriptor of the socket to be bound |
| address | points to a sockaddr structure containing the address to be bound to the socket |
| address_len | specifies the length of the sockaddr structure pointed to by the address argument |
Definition at line 154 of file FreeRTOSTCPSocket.cxx.
|
overrideprivatevirtual |
Close method.
Returns negative errno on failure.
| file | reference to close |
Implements FileIO.
Definition at line 642 of file FreeRTOSTCPSocket.cxx.
|
static |
Connect a socket.
| socket | the socket file descriptor |
| address | points to a sockaddr structure containing the peer address |
| address_len | specifies the length of the sockaddr structure pointed to by the address argument |
Definition at line 325 of file FreeRTOSTCPSocket.cxx.
|
overrideprivatevirtual |
Manipulate a file descriptor.
| file | file reference for this device |
| cmd | operation to perform |
| data | parameter to the cmd operation |
Reimplemented from FileIO.
Definition at line 797 of file FreeRTOSTCPSocket.cxx.
|
staticprivate |
Get the FreeRTOSTCP instance given a specific socket descriptor.
Should only be called within a critical section.
| sd | socket descriptor we are looking for |
Definition at line 765 of file FreeRTOSTCPSocket.cxx.
|
staticprivate |
Get the socket descriptor assoicated with socket index.
| inx | the socket index |
Definition at line 715 of file FreeRTOSTCPSocket.cxx.
|
static |
Get the socket options.
| socket | the socket file descriptor |
| level | specifies the protocol level at which the option resides |
| option_name | specifies a single option to get |
| option_value | the metadata that belongs to the option_name |
| option_len | the length of the metadata that belongs to the option_name |
Definition at line 615 of file FreeRTOSTCPSocket.cxx.
|
static |
Mark a connection-mode socket, specified by the socket argument, as accepting connections.
| socket | the socket file descriptor |
| backlog | provides a hint to the implementation which the implementation shall use to limit the number of outstanding connections in the socket's listen queue |
Definition at line 210 of file FreeRTOSTCPSocket.cxx.
|
static |
Receive a message from a connection-mode or connectionless-mode socket.
| socket | the socket file descriptor |
| buffer | buffer where the message should be stored |
| length | length in bytes of the buffer pointed to by the buffer argument |
| flags | Specifies the type of message reception |
Definition at line 394 of file FreeRTOSTCPSocket.cxx.
|
staticprivate |
Remove the FreeRTOSTCP instance from the active FreeRTOSTCP list.
Should only be called within a critical section.
| sd | socket descriptor we are looking for |
Definition at line 781 of file FreeRTOSTCPSocket.cxx.
Device select method.
Default impementation returns true.
| file | reference to the file |
| mode | FREAD for read active, FWRITE for write active, 0 for exceptions |
Reimplemented from FileIO.
Definition at line 667 of file FreeRTOSTCPSocket.cxx.
|
static |
Initiate transmission of a message from the specified socket.
| socket | the socket file descriptor |
| buffer | buffer containing the message to send |
| length | length of the message in bytes |
| flags | the type of message transmission |
Definition at line 460 of file FreeRTOSTCPSocket.cxx.
|
static |
Set the socket options.
| socket | the socket file descriptor |
| level | specifies the protocol level at which the option resides |
| option_name | specifies a single option to set |
| option_value | the metadata that belongs to the option_name |
| option_len | the length of the metadata that belongs to the option_name |
Definition at line 519 of file FreeRTOSTCPSocket.cxx.
|
static |
Create an unbound socket in a communications domain.
| domain | specifies the communications domain in which a socket is to be created |
| type | specifies the type of socket to be created |
| protocol | specifies a particular protocol to be used with the socket, specifying a protocol of 0 causes socket() to use an unspecified default protocol appropriate for the requested socket type |
Definition at line 58 of file FreeRTOSTCPSocket.cxx.
|
friend |
allow access to private members from FreeRTOSTCP
Definition at line 247 of file FreeRTOSTCPSocket.hxx.
|
private |
This is a listen socket.
Definition at line 244 of file FreeRTOSTCPSocket.hxx.
|
private |
indicates our "best guess" at current socket's read active status
Definition at line 237 of file FreeRTOSTCPSocket.hxx.
|
private |
FreeRTOS socket descriptor.
Definition at line 233 of file FreeRTOSTCPSocket.hxx.
|
private |
indicates our "best guess" at current socket's write active status
Definition at line 241 of file FreeRTOSTCPSocket.hxx.