F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UdpSocket.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title UdpSocket.hpp
3// \author mstarch
4// \brief hpp file for UdpSocket core implementation classes
5//
6// \copyright
7// Copyright 2009-2020, by the California Institute of Technology.
8// ALL RIGHTS RESERVED. United States Government Sponsorship
9// acknowledged.
10//
11// ======================================================================
12#ifndef DRV_IP_UDPSOCKET_HPP_
13#define DRV_IP_UDPSOCKET_HPP_
14
15#include <FpConfig.hpp>
16#include <Drv/Ip/IpSocket.hpp>
17#include <IpCfg.hpp>
18
19namespace Drv {
20
24struct SocketState;
25
32class UdpSocket : public IpSocket {
33 public:
37 UdpSocket();
41 virtual ~UdpSocket();
42
60 SocketIpStatus configureSend(const char* hostname, const U16 port, const U32 send_timeout_seconds,
61 const U32 send_timeout_microseconds);
62
76 SocketIpStatus configureRecv(const char* hostname, const U16 port);
77
78 PROTECTED:
79
98 I32 sendProtocol(const U8* const data, const U32 size);
105 I32 recvProtocol( U8* const data, const U32 size);
106 private:
107 SocketState* m_state;
108 U16 m_recv_port;
109 char m_recv_hostname[SOCKET_MAX_HOSTNAME_SIZE];
110};
111} // namespace Drv
112
113#endif /* DRV_IP_UDPSOCKET_HPP_ */
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:26
C++-compatible configuration header for fprime configuration.
@ SOCKET_MAX_HOSTNAME_SIZE
Definition IpCfg.hpp:23
Helper base-class for setting up Berkeley sockets.
Definition IpSocket.hpp:46
Helper for setting up Udp using Berkeley sockets as a client.
Definition UdpSocket.hpp:32
SocketIpStatus bind(NATIVE_INT_TYPE fd)
bind the UDP to a port such that it can receive packets at the previously configured port
Definition UdpSocket.cpp:74
I32 sendProtocol(const U8 *const data, const U32 size)
Protocol specific implementation of send. Called directly with retry from send.
UdpSocket()
Constructor for client socket udp implementation.
Definition UdpSocket.cpp:53
I32 recvProtocol(U8 *const data, const U32 size)
Protocol specific implementation of recv. Called directly with error handling from recv.
SocketIpStatus openProtocol(NATIVE_INT_TYPE &fd)
udp specific implementation for opening a socket.
SocketIpStatus configureRecv(const char *hostname, const U16 port)
configure the udp socket for incoming transmissions
Definition UdpSocket.cpp:67
SocketIpStatus configureSend(const char *hostname, const U16 port, const U32 send_timeout_seconds, const U32 send_timeout_microseconds)
configure the udp socket for outgoing transmissions
Definition UdpSocket.cpp:62
virtual ~UdpSocket()
to cleanup state created at instantiation
Definition UdpSocket.cpp:57
SocketIpStatus
Status enumeration for socket return values.
Definition IpSocket.hpp:23