F´ Flight Software - C/C++ Documentation  NASA-v2.0.1
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 <Fw/Types/BasicTypes.hpp>
16 #include <Drv/Ip/IpSocket.hpp>
17 #include <IpCfg.hpp>
18 
19 namespace Drv {
20 
24 struct SocketState;
25 
32 class 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_ */
Drv::UdpSocket::sendProtocol
I32 sendProtocol(const U8 *const data, const U32 size)
Protocol specific implementation of send. Called directly with retry from send.
Definition: UdpSocket.cpp:153
Drv::UdpSocket::openProtocol
SocketIpStatus openProtocol(NATIVE_INT_TYPE &fd)
udp specific implementation for opening a socket.
Definition: UdpSocket.cpp:97
Drv::UdpSocket
Helper for setting up Udp using Berkley sockets as a client.
Definition: UdpSocket.hpp:32
Drv::UdpSocket::bind
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:71
U8
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.hpp:76
Drv::IpSocket
Helper base-class for setting up Berkley sockets.
Definition: IpSocket.hpp:45
Drv
Definition: BlockDriverImpl.cpp:5
IpCfg.hpp
Drv::SocketState
Definition: UdpSocket.cpp:42
Drv::UdpSocket::configureSend
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:59
Drv::UdpSocket::recvProtocol
I32 recvProtocol(U8 *const data, const U32 size)
Protocol specific implementation of recv. Called directly with error handling from recv.
Definition: UdpSocket.cpp:159
Drv::SocketIpStatus
SocketIpStatus
Status enumeration for socket return values.
Definition: IpSocket.hpp:23
IpSocket.hpp
BasicTypes.hpp
Declares ISF basic types.
Drv::UdpSocket::~UdpSocket
virtual ~UdpSocket()
to cleanup state created at instantiation
Definition: UdpSocket.cpp:54
SOCKET_MAX_HOSTNAME_SIZE
@ SOCKET_MAX_HOSTNAME_SIZE
Definition: IpCfg.hpp:23
Drv::UdpSocket::configureRecv
SocketIpStatus configureRecv(const char *hostname, const U16 port)
configure the udp socket for incoming transmissions
Definition: UdpSocket.cpp:64
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
Drv::UdpSocket::UdpSocket
UdpSocket()
Constructor for client socket udp implementation.
Definition: UdpSocket.cpp:52