12 #ifndef DRV_IP_IPHELPER_HPP_ 13 #define DRV_IP_IPHELPER_HPP_ 17 #include <config/IpCfg.hpp> 81 const U32 send_timeout_seconds,
82 const U32 send_timeout_microseconds);
202 const U8*
const data,
static SocketIpStatus addressToIp4(const char *address, void *ip4)
converts a given address in dot form x.x.x.x to an ip address. ONLY works for IPv4.
Failed to send after configured retries.
virtual bool isValidPort(U16 port)
Check if the given port is valid for the socket.
Failed to read socket with disconnect.
Interrupted status for retries.
Failed to connect socket.
Failed to configure socket.
PlatformSizeType FwSizeType
SocketIpStatus recv(const SocketDescriptor &fd, U8 *const data, FwSizeType &size)
receive data from the IP socket from the given buffer
SocketIpStatus setupTimeouts(int socketFd)
setup the socket timeout properties of the opened outgoing socket
Automatic connections are disabled.
int fd
Used for all sockets to track the communication file descriptor.
PlatformSignedSizeType FwSignedSizeType
virtual SocketIpStatus send(const SocketDescriptor &socketDescriptor, const U8 *const data, const FwSizeType size)
send data out the IP socket from the given buffer
Another thread is opening.
virtual SocketIpStatus openProtocol(SocketDescriptor &fd)=0
Protocol specific open implementation, called from open.
void shutdown(const SocketDescriptor &socketDescriptor)
shutdown the socket
Failed to listen on socket.
virtual FwSignedSizeType sendProtocol(const SocketDescriptor &socketDescriptor, const U8 *const data, const FwSizeType size)=0
Protocol specific implementation of send. Called directly with retry from send.
U16 m_port
IP address port used.
Failed to accept connection.
Socket operation successful.
SocketIpStatus setupSocketOptions(int socketFd)
setup the socket options of the input socket as defined in IpCfg.hpp
Failed to read back port from connection.
uint8_t U8
8-bit unsigned integer
virtual SocketIpStatus configure(const char *hostname, const U16 port, const U32 send_timeout_seconds, const U32 send_timeout_microseconds)
configure the ip socket with host and transmission timeouts
virtual SocketIpStatus handleZeroReturn()
Handle zero return from recvProtocol.
void close(const SocketDescriptor &socketDescriptor)
closes the socket
char m_hostname[SOCKET_MAX_HOSTNAME_SIZE]
Hostname to supply.
virtual FwSignedSizeType recvProtocol(const SocketDescriptor &socketDescriptor, U8 *const data, const FwSizeType size)=0
Protocol specific implementation of recv. Called directly with error handling from recv...
SocketIpStatus open(SocketDescriptor &socketDescriptor)
open the IP socket for communications
SocketIpStatus
Status enumeration for socket return values.
Socket has not been started.
U32 m_timeoutMicroseconds
Helper base-class for setting up Berkeley sockets.
No data available or read operation would block.
Failed to bind to socket.
int serverFd
Used for server sockets to track the listening file descriptor.