| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- File List
- File Members

erpc_tcp_transport.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016 NXP
4 * All rights reserved.
5 *
6 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 */
9 #ifndef _EMBEDDED_RPC__TCP_TRANSPORT_H_
10 #define _EMBEDDED_RPC__TCP_TRANSPORT_H_
11
12 #include "erpc_framed_transport.h"
13 #include "erpc_threading.h"
14
21 // Classes
24
25 namespace erpc {
31 class TCPTransport : public FramedTransport
32 {
33 public:
41 TCPTransport(bool isServer);
42
52 TCPTransport(const char *host, uint16_t port, bool isServer);
53
57 virtual ~TCPTransport(void);
58
65 void configure(const char *host, uint16_t port);
66
74 virtual erpc_status_t open(void);
75
82 virtual erpc_status_t close(bool stopServer = true);
83
84 protected:
85 bool m_isServer;
86 const char *m_host;
87 uint16_t m_port;
88 int m_socket;
89 Thread m_serverThread;
90 bool m_runServer;
98 virtual erpc_status_t connectClient(void);
99
110 virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size);
111
122 virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size);
123
127 void serverThread(void);
128
138 static void serverThreadStub(void *arg);
139 };
140
141 } // namespace erpc
142
145 #endif // _EMBEDDED_RPC__TCP_TRANSPORT_H_
erpc::TCPTransport::serverThreadStub
static void serverThreadStub(void *arg)
Thread entry point.
Definition: erpc_tcp_transport.cpp:391
erpc::TCPTransport::serverThread
void serverThread(void)
Server thread function.
Definition: erpc_tcp_transport.cpp:307
erpc::FramedTransport
Base class for framed transport layers.
Definition: erpc_framed_transport.h:56
erpc::TCPTransport::open
virtual erpc_status_t open(void)
This function will create host on server side, or connect client to the server.
Definition: erpc_tcp_transport.cpp:71
erpc_status_t
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:87
erpc_framed_transport.h
erpc::TCPTransport::m_isServer
bool m_isServer
Definition: erpc_tcp_transport.h:85
erpc::Thread
Simple thread class.
Definition: erpc_threading.h:66
erpc::TCPTransport::m_port
uint16_t m_port
Definition: erpc_tcp_transport.h:87
erpc::TCPTransport::m_socket
int m_socket
Definition: erpc_tcp_transport.h:88
erpc::TCPTransport::m_serverThread
Thread m_serverThread
Definition: erpc_tcp_transport.h:89
erpc::TCPTransport::~TCPTransport
virtual ~TCPTransport(void)
TCPTransport destructor.
Definition: erpc_tcp_transport.cpp:63
erpc
Definition: erpc_arbitrated_client_manager.h:25
erpc::TCPTransport::m_host
const char * m_host
Definition: erpc_tcp_transport.h:86
erpc::TCPTransport::underlyingSend
virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size)
This function writes data.
Definition: erpc_tcp_transport.cpp:266
erpc_threading.h
erpc::TCPTransport::m_runServer
bool m_runServer
Definition: erpc_tcp_transport.h:90
erpc::TCPTransport::TCPTransport
TCPTransport(bool isServer)
Constructor.
Definition: erpc_tcp_transport.cpp:43
erpc::TCPTransport::underlyingReceive
virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size)
This function read data.
Definition: erpc_tcp_transport.cpp:224
erpc::TCPTransport::close
virtual erpc_status_t close(bool stopServer=true)
This function disconnects client or stop server host.
Definition: erpc_tcp_transport.cpp:208
erpc::TCPTransport::connectClient
virtual erpc_status_t connectClient(void)
This function connect client to the server.
Definition: erpc_tcp_transport.cpp:89
erpc::TCPTransport::configure
void configure(const char *host, uint16_t port)
This function set host and port of this transport layer.
Definition: erpc_tcp_transport.cpp:65
erpc::TCPTransport
Client side of TCP/IP transport.
Definition: erpc_tcp_transport.h:31