| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- File List
- File Members

erpc_framed_transport.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2020 NXP
4 * Copyright 2021 ACRIOS Systems s.r.o.
5 * All rights reserved.
6 *
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10
11 #ifndef _EMBEDDED_RPC__FRAMED_TRANSPORT_H_
12 #define _EMBEDDED_RPC__FRAMED_TRANSPORT_H_
13
14 #include "erpc_config_internal.h"
15 #include "erpc_message_buffer.h"
16 #include "erpc_transport.h"
17
18 #include <cstring>
19
20 #if !ERPC_THREADS_IS(NONE)
21 #include "erpc_threading.h"
22 #endif
23
30 // Classes
33
34 namespace erpc {
35
56 class FramedTransport : public Transport
57 {
58 public:
62 FramedTransport(void);
63
67 virtual ~FramedTransport(void);
68
86 virtual erpc_status_t receive(MessageBuffer *message) override;
87
96 virtual erpc_status_t send(MessageBuffer *message) override;
97
99 struct Header
100 {
101 uint16_t m_messageSize;
102 uint16_t m_crc;
103 };
104
110 virtual void setCrc16(Crc16 *crcImpl) override;
111
112 protected:
113 Crc16 *m_crcImpl;
115 #if !ERPC_THREADS_IS(NONE)
116 Mutex m_sendLock;
117 Mutex m_receiveLock;
118 #endif
119
129 virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size) = 0;
130
140 virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size) = 0;
141 };
142
143 } // namespace erpc
144
147 #endif // _EMBEDDED_RPC__FRAMED_TRANSPORT_H_
erpc::Transport
Abstract interface for transport layer.
Definition: erpc_transport.h:36
erpc::FramedTransport::Header::m_messageSize
uint16_t m_messageSize
Size in bytes of the message, excluding the header.
Definition: erpc_framed_transport.h:101
erpc::FramedTransport
Base class for framed transport layers.
Definition: erpc_framed_transport.h:56
erpc_status_t
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:87
erpc::FramedTransport::Header
Contents of the header that prefixes each message.
Definition: erpc_framed_transport.h:99
erpc::FramedTransport::Header::m_crc
uint16_t m_crc
CRC-16 over the message data.
Definition: erpc_framed_transport.h:102
erpc::FramedTransport::~FramedTransport
virtual ~FramedTransport(void)
Codec destructor.
Definition: erpc_framed_transport.cpp:34
erpc::FramedTransport::send
virtual erpc_status_t send(MessageBuffer *message) override
Function to send prepared message.
Definition: erpc_framed_transport.cpp:100
erpc_transport.h
erpc::MessageBuffer
Represents a memory buffer containing a message.
Definition: erpc_message_buffer.h:37
erpc::FramedTransport::underlyingReceive
virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size)=0
Subclasses must implement this function to receive data.
erpc::FramedTransport::m_sendLock
Mutex m_sendLock
Mutex protecting send.
Definition: erpc_framed_transport.h:116
erpc
Definition: erpc_arbitrated_client_manager.h:25
erpc::FramedTransport::FramedTransport
FramedTransport(void)
Constructor.
Definition: erpc_framed_transport.cpp:24
erpc::FramedTransport::underlyingSend
virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size)=0
Subclasses must implement this function to send data.
erpc_threading.h
erpc::Crc16
Class for compute crc16.
Definition: erpc_crc16.h:29
erpc_message_buffer.h
erpc::FramedTransport::m_crcImpl
Crc16 * m_crcImpl
Definition: erpc_framed_transport.h:113
erpc::FramedTransport::setCrc16
virtual void setCrc16(Crc16 *crcImpl) override
This functions sets the CRC-16 implementation.
Definition: erpc_framed_transport.cpp:36
erpc::FramedTransport::m_receiveLock
Mutex m_receiveLock
Mutex protecting receive.
Definition: erpc_framed_transport.h:117
erpc::FramedTransport::receive
virtual erpc_status_t receive(MessageBuffer *message) override
Receives an entire message.
Definition: erpc_framed_transport.cpp:42
erpc::Mutex
Mutex.
Definition: erpc_threading.h:307