| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
erpc::TransportArbitrator Class Reference
Infrastructure » Transports

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

`#include <erpc_transport_arbitrator.h>`

Inheritance diagram for erpc::TransportArbitrator:
[legend]
Collaboration diagram for erpc::TransportArbitrator:
[legend]

## 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) override
| Prototype for receiving message. 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...
virtual erpc_status_t | send (MessageBuffer *message) override
| Prototype for send message. More...
virtual void | setCrc16 (Crc16 *crcImpl) override
| 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
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.

## 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] | shared | Shared client/server transport.

void erpc::TransportArbitrator::setCodec | ( | Codec * | codec | ) |
| inline

This function set codec.

Parameters

  [in] | codec | Codec.

erpc_status_t TransportArbitrator::receive | ( | MessageBuffer * | message | ) |
| override virtual

Prototype for receiving message.

Each transport layer need define this function.

Parameters

  [out] | message | Will return pointer to received message buffer.

Returns
  based on receive implementation.

Implements erpc::Transport.

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().

Parameters

  [in] | request | Reuquest context for receive action.

Returns
  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

  [in] | token | The token previously returned by prepareClientReceive().

Returns
  erpc_status_t Return erpc status of client receive function.

erpc_status_t TransportArbitrator::send | ( | MessageBuffer * | message | ) |
| override virtual

Prototype for send message.

Each transport layer need define this function.

Parameters

  [in] | message | Pass message buffer to send.

Returns
  based on send implementation.

Implements erpc::Transport.

void TransportArbitrator::setCrc16 | ( | Crc16 * | crcImpl | ) |
| override virtual

This functions sets the CRC-16 implementation.

Parameters

  [in] | crcImpl | Object 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] | info | Pending client info to remove.

void TransportArbitrator::freeClientList | ( | PendingClientInfo * | list | ) |
| protected

This function removes pending client list.

Parameters

  [in] | list | Pending client list to remove.

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

- erpc_transport_arbitrator.h
- erpc_transport_arbitrator.cpp