|
Open Model Railroad Network (OpenMRN)
|
#include <fcntl.h>#include <unistd.h>#include <sys/socket.h>#include <netinet/in.h>#include <netinet/tcp.h>#include <stdio.h>#include "FreeRTOS.h"#include "task.h"#include "FreeRTOS_IP.h"#include "FreeRTOS_Sockets.h"#include "FreeRTOSTCPSocket.hxx"#include "FreeRTOSTCP.hxx"Go to the source code of this file.
Functions | |
| int | socket (int domain, int type, int protocol) |
| Create an unbound socket in a communications domain. | |
| int | bind (int socket, const struct sockaddr *address, socklen_t address_len) |
| Bind a name to a socket. | |
| int | listen (int socket, int backlog) |
| Mark a connection-mode socket, specified by the socket argument, as accepting connections. | |
| int | accept (int socket, struct sockaddr *address, socklen_t *address_len) |
| Accept a new connection on a socket. | |
| int | connect (int socket, const struct sockaddr *address, socklen_t address_len) |
| Connect a socket. | |
| ssize_t | recv (int socket, void *buffer, size_t length, int flags) |
| Receive a message from a connection-mode or connectionless-mode socket. | |
| ssize_t | send (int socket, const void *buffer, size_t length, int flags) |
| Initiate transmission of a message from the specified socket. | |
| int | setsockopt (int socket, int level, int option_name, const void *option_value, socklen_t option_len) |
| Set the socket options. | |
| int | getsockopt (int socket, int level, int option_name, void *option_value, socklen_t *option_len) |
| Get the socket options. | |
| int | getsockname (int socket, struct sockaddr &addr, socklen_t &namelen) |
| Get the socket name. | |
| const char * | inet_ntoa (struct in_addr addr) |
| Converts internet address into a dotted decimal string. | |
| uint32_t | inet_addr (const char *name) |
| Converts the dotted decmail internet address string into a binary representation. | |
Variables | |
| static FreeRTOSTCPSocket * | FreeRTOSTCPSockets [MAX_SOCKETS] |
| static char | str [32] |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This file provides the sockets interface to the FreeRTOSPlus TCP stack. Based on work by Stuart W. Baker
Definition in file FreeRTOSTCPSocket.cxx.
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 888 of file FreeRTOSTCPSocket.cxx.
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 855 of file FreeRTOSTCPSocket.cxx.
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 901 of file FreeRTOSTCPSocket.cxx.
Get the socket name.
| socket | the socket file descriptor |
| addr | points to a sockaddr structure to receive ane name |
| namelen | points to a socklen_t to receive the lenght of the name |
Definition at line 976 of file FreeRTOSTCPSocket.cxx.
| int getsockopt | ( | int | socket, |
| int | level, | ||
| int | option_name, | ||
| void * | option_value, | ||
| socklen_t * | option_len | ||
| ) |
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 962 of file FreeRTOSTCPSocket.cxx.
| uint32_t inet_addr | ( | const char * | name | ) |
Converts the dotted decmail internet address string into a binary representation.
Converts a number-and-dot notation internet address to network byte order form.
| name | string containing dotted decimal representation |
Definition at line 999 of file FreeRTOSTCPSocket.cxx.
| const char * inet_ntoa | ( | struct in_addr | addr | ) |
Converts internet address into a dotted decimal string.
Converts an address to textual representation.
| addr | an in_addr structure containing the IP address |
Definition at line 987 of file FreeRTOSTCPSocket.cxx.
| int listen | ( | int | socket, |
| int | backlog | ||
| ) |
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 869 of file FreeRTOSTCPSocket.cxx.
| ssize_t recv | ( | int | socket, |
| void * | buffer, | ||
| size_t | length, | ||
| int | flags | ||
| ) |
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 917 of file FreeRTOSTCPSocket.cxx.
| ssize_t send | ( | int | socket, |
| const void * | buffer, | ||
| size_t | length, | ||
| int | flags | ||
| ) |
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 930 of file FreeRTOSTCPSocket.cxx.
| int setsockopt | ( | int | socket, |
| int | level, | ||
| int | option_name, | ||
| const void * | option_value, | ||
| socklen_t | option_len | ||
| ) |
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 945 of file FreeRTOSTCPSocket.cxx.
| int socket | ( | int | domain, |
| int | type, | ||
| int | protocol | ||
| ) |
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 841 of file FreeRTOSTCPSocket.cxx.
|
static |
Definition at line 53 of file FreeRTOSTCPSocket.cxx.
|
static |
Definition at line 981 of file FreeRTOSTCPSocket.cxx.