eRPC API Reference
Rev. 1.12.0
NXP Semiconductors
|
Interposer to share transport between client and server. More...
#include <erpc_transport_arbitrator.hpp>
Classes | |
struct | PendingClientInfo |
Request info for a client trying to receive a response. More... | |
Public Types | |
typedef uintptr_t | client_token_t |
Represents a single client's receive request. | |
Public Member Functions | |
TransportArbitrator (void) | |
Constructor. | |
virtual | ~TransportArbitrator (void) |
Destructor. | |
virtual uint8_t | reserveHeaderSize (void) override |
Size of data placed in MessageBuffer before serializing eRPC data. More... | |
virtual erpc_status_t | receive (MessageBuffer *message) override |
Prototype for receiving message. More... | |
virtual erpc_status_t | send (MessageBuffer *message) override |
Prototype for send message. More... | |
virtual bool | hasMessage (void) override |
Check if the underlying shared transport has a message. More... | |
virtual void | setCrc16 (Crc16 *crcImpl) override |
This functions sets the CRC-16 implementation. More... | |
virtual Crc16 * | getCrc16 (void) override |
This functions gets the CRC-16 object. More... | |
void | setSharedTransport (Transport *shared) |
This function set shared client/server transport. More... | |
Transport * | getSharedTransport (void) |
This function returns shared client/server transport. More... | |
void | setCodec (Codec *codec) |
This function set codec. More... | |
Codec * | getCodec (void) |
This function get codec. More... | |
client_token_t | prepareClientReceive (RequestContext &request) |
Add a client request to the client list. More... | |
erpc_status_t | clientReceive (client_token_t token) |
Receive method for the client. More... | |
Public Member Functions inherited from erpc::Transport | |
Transport (void) | |
Constructor. | |
virtual | ~Transport (void) |
Transport destructor. | |
Protected Member Functions | |
PendingClientInfo * | createPendingClient (void) |
Create a Pending Client object. More... | |
PendingClientInfo * | addPendingClient (void) |
This function adds pending client. More... | |
void | removePendingClient (PendingClientInfo *info) |
This function removes pending client. More... | |
void | freeClientList (PendingClientInfo *list) |
This function removes pending client list. More... | |
Protected Attributes | |
Transport * | m_sharedTransport |
Transport being shared through this arbitrator. | |
Codec * | m_codec |
Codec used to read incoming message headers. | |
PendingClientInfo * | m_clientList |
Active client receive requests. | |
PendingClientInfo * | m_clientFreeList |
Unused client receive info structs. | |
Mutex | m_clientListMutex |
Mutex guarding the client active and free lists. | |
Interposer to share transport between client and server.
Allocates memory for client receive request info. This memory is never freed. It is put on a free list and is reused for future client receives. The class will allocate as many client receive info structs as the maximum number of simultaneous client receive requests from different threads.
|
overridevirtual |
Size of data placed in MessageBuffer before serializing eRPC data.
Reimplemented from erpc::Transport.
|
overridevirtual |
Prototype for receiving message.
Each transport layer need define this function.
[out] | message | Will return pointer to received message buffer. |
Implements erpc::Transport.
|
overridevirtual |
Prototype for send message.
Each transport layer need define this function.
[in] | message | Pass message buffer to send. |
Implements erpc::Transport.
|
overridevirtual |
Check if the underlying shared transport has a message.
The | underlying transport is expected to return true when a message is available to process and false otherwise. |
Reimplemented from erpc::Transport.
|
overridevirtual |
This functions sets the CRC-16 implementation.
[in] | crcImpl | Object containing crc-16 compute function. |
Reimplemented from erpc::Transport.
|
overridevirtual |
This functions gets the CRC-16 object.
Reimplemented from erpc::Transport.
void TransportArbitrator::setSharedTransport | ( | Transport * | shared | ) |
This function set shared client/server transport.
[in] | shared | Shared client/server transport. |
Transport * TransportArbitrator::getSharedTransport | ( | void | ) |
This function returns shared client/server transport.
void TransportArbitrator::setCodec | ( | Codec * | codec | ) |
This function set codec.
[in] | codec | Codec. |
Codec * TransportArbitrator::getCodec | ( | void | ) |
This function get codec.
TransportArbitrator::client_token_t TransportArbitrator::prepareClientReceive | ( | RequestContext & | request | ) |
Add a client request to the client list.
This call is made by the client thread prior to sending the invocation to the server. It ensures that the transport arbitrator has the client's response message buffer ready in case it sees the response before the client even has a chance to call clientReceive().
[in] | request | Reuquest context for receive action. |
erpc_status_t TransportArbitrator::clientReceive | ( | client_token_t | token | ) |
Receive method for the client.
Blocks until the a reply message is received with the expected sequence number that is associated with token. The client must have called prepareClientReceive() previously.
[in] | token | The token previously returned by prepareClientReceive(). |
|
protected |
Create a Pending Client object.
|
protected |
This function adds pending client.
|
protected |
This function removes pending client.
[in] | info | Pending client info to remove. |
|
protected |
This function removes pending client list.
[in] | list | Pending client list to remove. |