![]() |
eRPC API Reference
Rev. 1.7.2
NXP Semiconductors
|
Interposer to share transport between client and server. More...
#include <erpc_transport_arbitrator.h>
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. | |
void | setSharedTransport (Transport *shared) |
This function set shared client/server transport. More... | |
void | setCodec (Codec *codec) |
This function set codec. More... | |
virtual erpc_status_t | receive (MessageBuffer *message) |
Receive method for the server. | |
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... | |
virtual erpc_status_t | send (MessageBuffer *message) |
Shared client/server send method. | |
virtual void | setCrc16 (Crc16 *crcImpl) |
This functions sets the CRC-16 implementation. More... | |
![]() | |
Transport (void) | |
Constructor. | |
virtual | ~Transport (void) |
Transport destructor. | |
virtual bool | hasMessage (void) |
Poll for an incoming message. More... | |
Protected Member Functions | |
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.
|
inline |
This function set shared client/server transport.
[in] | shared | Shared client/server transport. |
|
inline |
This function set codec.
[in] | codec | 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().
A token is returned to the client
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.
token | The token previously returned by prepareClientReceive(). |
|
virtual |
This functions sets the CRC-16 implementation.
[in] | crcImpl | Object containing crc-16 compute function. |
Reimplemented from erpc::Transport.
|
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. |