libnexus-rv
Functions
msg-encoder.h File Reference
#include "msg-decoder.h"
Include dependency graph for msg-encoder.h:

Go to the source code of this file.

Functions

ssize_t nexusrv_msg_encode (const nexusrv_hw_cfg *hwcfg, uint8_t *buffer, size_t limit, const nexusrv_msg *msg)
 Encode the msg into buffer. More...
 
int nexusrv_read_msg (FILE *fp, nexusrv_msg *msg)
 Read the text (human readable) form of Message from fp into msg. More...
 

Function Documentation

◆ nexusrv_msg_encode()

ssize_t nexusrv_msg_encode ( const nexusrv_hw_cfg hwcfg,
uint8_t *  buffer,
size_t  limit,
const nexusrv_msg msg 
)

Encode the msg into buffer.

Parameters
[in]hwcfgSpecifies the desired HW implementation.
[in,out]bufferThe buffer that will hold the Message
[in]limitShould be set to the number of bytes in buffer
[in]msgThe Message to encode
Return values
>0The number of bytes produced on success
-nexus_stream_truncateif more bytes are required from buffer
-nexus_msg_unsupportedif the msg type is not supported

◆ nexusrv_read_msg()

int nexusrv_read_msg ( FILE *  fp,
nexusrv_msg msg 
)

Read the text (human readable) form of Message from fp into msg.

Parameters
[in]fpFILE pointer
[out]msgParsed Message
Return values
0Success
-nexus_msg_missing_fieldif Message has missing fields
-nexus_msg_unsupportedif Message type is not supported