F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TcpServerSocket.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TcpServerSocket.hpp
3 // \author mstarch
4 // \brief hpp file for TcpServerSocket 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_TCPSERVER_TCPHELPER_HPP_
13 #define DRV_TCPSERVER_TCPHELPER_HPP_
14 
15 #include <Drv/Ip/IpSocket.hpp>
16 #include <Fw/FPrimeBasicTypes.hpp>
17 #include <config/IpCfg.hpp>
18 
19 namespace Drv {
20 
27 class TcpServerSocket : public IpSocket {
28  public:
33 
43  SocketIpStatus startup(SocketDescriptor& socketDescriptor);
44 
53  void terminate(const SocketDescriptor& socketDescriptor);
54 
63  U16 getListenPort();
64 
65  protected:
71  SocketIpStatus openProtocol(SocketDescriptor& socketDescriptor) override;
79  FwSignedSizeType sendProtocol(const SocketDescriptor& socketDescriptor,
80  const U8* const data,
81  const FwSizeType size) override;
89  FwSignedSizeType recvProtocol(const SocketDescriptor& socketDescriptor,
90  U8* const data,
91  const FwSizeType size) override;
92 };
93 } // namespace Drv
94 
95 #endif /* DRV_TCPSERVER_TCPHELPER_HPP_ */
SocketIpStatus startup(SocketDescriptor &socketDescriptor)
Opens the server socket and listens, does not block.
PlatformSizeType FwSizeType
FwSignedSizeType sendProtocol(const SocketDescriptor &socketDescriptor, const U8 *const data, const FwSizeType size) override
Protocol specific implementation of send. Called directly with retry from send.
Helper for setting up Tcp using Berkeley sockets as a server.
PlatformSignedSizeType FwSignedSizeType
U16 getListenPort()
get the port being listened on
TcpServerSocket()
Constructor for client socket tcp implementation.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
SocketIpStatus
Status enumeration for socket return values.
Definition: IpSocket.hpp:29
void terminate(const SocketDescriptor &socketDescriptor)
close the server socket created by the startup call
Helper base-class for setting up Berkeley sockets.
Definition: IpSocket.hpp:57
SocketIpStatus openProtocol(SocketDescriptor &socketDescriptor) override
Tcp specific implementation for opening a client socket connected to this server. ...
FwSignedSizeType recvProtocol(const SocketDescriptor &socketDescriptor, U8 *const data, const FwSizeType size) override
Protocol specific implementation of recv. Called directly with error handling from recv...