Utilities

Functions

int lpPollMsg(PLPContext ctx, TrfMsg__MessageWrapper **msg, int timeoutMs)

Poll for a message, decoding it if the message has been received.

Parameters:
  • ctx – Context to use.

  • msg – Message pointer to be set when a message has been received.

  • timeoutMs – Optional timeout for the message in milliseconds.

Returns:

0 on success, negative error code on failure.

uint64_t lpParseMemString(char *data)

Parse bytes neede from string passed in to arguments.

Parameters:

data – String containing memory amount (e.g. 1048576 or 128m)

Returns:

size in bytes, -1 if invalid data

int64_t lpParsePollString(char *data)
bool lpShouldTruncate(PLPContext ctx)

Check if the SHM File needs to be truncated.

Parameters:

shmFile – Path to shm file

Returns:

true if shm file needs to be truncated, false if not

static inline void lpSetLPLogLevel()

Set Looking Glass Proxy logging level.

static inline void lpSetTRFLogLevel()

Set Libtrf logging level.

int lpSetDefaultOpts(PLPContext ctx)

Set Default Options.

Parameters:

ctx – Context to use

Returns:

0 on success, negative error code on failure

int lpCalcFrameSizeNeeded(PTRFDisplay display)

Calculate the size needed for shared memory file.

Parameters:

display – Display metadata from Libtrf

Returns:

size of the display needed

int lpSendDisconnect(PTRFContext ctx)

Send disconnect message to clients.

Parameters:

ctx – Context containing fabric info to send disconnect on

Returns:

0 on success, negative error code on failure

int lpSendVersion(PTRFContext ctx)

Send API version to peer.

Parameters:

ctx – Context to send connection on

Returns:

0 on success, negative error code on failure