eRPC API Reference  Rev. 1.7.2
NXP Semiconductors
erpc::TransportArbitrator Class Reference

Interposer to share transport between client and server. More...

#include <erpc_transport_arbitrator.h>

+ Inheritance diagram for erpc::TransportArbitrator:
+ Collaboration diagram for erpc::TransportArbitrator:

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...
 
- Public Member Functions inherited from erpc::Transport
 Transport (void)
 Constructor.
 
virtual ~Transport (void)
 Transport destructor.
 
virtual bool hasMessage (void)
 Poll for an incoming message. More...
 

Protected Member Functions

PendingClientInfoaddPendingClient (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

Transportm_sharedTransport
 Transport being shared through this arbitrator.
 
Codecm_codec
 Codec used to read incoming message headers.
 
PendingClientInfom_clientList
 Active client receive requests.
 
PendingClientInfom_clientFreeList
 Unused client receive info structs.
 
Mutex m_clientListMutex
 Mutex guarding the client active and free lists.
 

Detailed Description

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.

Member Function Documentation

void erpc::TransportArbitrator::setSharedTransport ( Transport shared)
inline

This function set shared client/server transport.

Parameters
[in]sharedShared client/server transport.
void erpc::TransportArbitrator::setCodec ( Codec codec)
inline

This function set codec.

Parameters
[in]codecCodec.
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.

Parameters
tokenThe token previously returned by prepareClientReceive().
void TransportArbitrator::setCrc16 ( Crc16 crcImpl)
virtual

This functions sets the CRC-16 implementation.

Parameters
[in]crcImplObject containing crc-16 compute function.

Reimplemented from erpc::Transport.

TransportArbitrator::PendingClientInfo * TransportArbitrator::addPendingClient ( void  )
protected

This function adds pending client.

Returns
Pending client information.
void TransportArbitrator::removePendingClient ( PendingClientInfo info)
protected

This function removes pending client.

Parameters
[in]infoPending client info to remove.
void TransportArbitrator::freeClientList ( PendingClientInfo list)
protected

This function removes pending client list.

Parameters
[in]listPending client list to remove.

The documentation for this class was generated from the following files: