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
TcpServerComponentImpl.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title TcpServerComponentImpl.hpp
3// \author mstarch
4// \brief hpp file for TcpServerComponentImpl component implementation class
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
13#ifndef TcpServerComponentImpl_HPP
14#define TcpServerComponentImpl_HPP
15
16#include <IpCfg.hpp>
17#include <Drv/Ip/IpSocket.hpp>
21
22namespace Drv {
23
25 public:
26 // ----------------------------------------------------------------------
27 // Construction, initialization, and destruction
28 // ----------------------------------------------------------------------
29
34 TcpServerComponentImpl(const char* const compName);
35
40
41 // ----------------------------------------------------------------------
42 // Helper methods to start and stop socket
43 // ----------------------------------------------------------------------
44
60 SocketIpStatus configure(const char* hostname,
61 const U16 port,
62 const U32 send_timeout_seconds = SOCKET_SEND_TIMEOUT_SECONDS,
63 const U32 send_timeout_microseconds = SOCKET_SEND_TIMEOUT_MICROSECONDS);
64
65 PROTECTED:
66 // ----------------------------------------------------------------------
67 // Implementations for socket read task virtual methods
68 // ----------------------------------------------------------------------
69
79
89
98 void sendBuffer(Fw::Buffer buffer, SocketIpStatus status);
99
103 void connected();
104
105
106 PRIVATE:
107
108 // ----------------------------------------------------------------------
109 // Handler implementations for user-defined typed input ports
110 // ----------------------------------------------------------------------
111
127 Drv::SendStatus send_handler(const NATIVE_INT_TYPE portNum, Fw::Buffer& fwBuffer);
128
129 Drv::TcpServerSocket m_socket;
130};
131
132} // end namespace Drv
133
134#endif // end TcpServerComponentImpl
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
@ SOCKET_SEND_TIMEOUT_SECONDS
Definition IpCfg.hpp:17
@ SOCKET_SEND_TIMEOUT_MICROSECONDS
Definition IpCfg.hpp:18
Helper base-class for setting up Berkeley sockets.
Definition IpSocket.hpp:46
Status returned by the send call.
supports a task to read a given socket adaptation
Auto-generated base for TcpServer component.
~TcpServerComponentImpl()
Destroy the component.
Fw::Buffer getBuffer()
returns a buffer to fill with data
void sendBuffer(Fw::Buffer buffer, SocketIpStatus status)
sends a buffer to be filled with data
TcpServerComponentImpl(const char *const compName)
construct the TcpClient component.
IpSocket & getSocketHandler()
returns a reference to the socket handler
SocketIpStatus configure(const char *hostname, const U16 port, const U32 send_timeout_seconds=SOCKET_SEND_TIMEOUT_SECONDS, const U32 send_timeout_microseconds=SOCKET_SEND_TIMEOUT_MICROSECONDS)
Configures the TcpClient settings but does not open the connection.
void connected()
called when the IPv4 system has been connected
Helper for setting up Tcp using Berkeley sockets as a server.
SocketIpStatus
Status enumeration for socket return values.
Definition IpSocket.hpp:23