trade_msg_la.h File Reference

Chunk Delivery API - Lower Abstraction. More...

Go to the source code of this file.

Functions

int encodeChunk (const struct chunk *c, uint8_t *buff, int buff_len)
 Encode a sequence of information, filling the buffer with the corresponding bit stream.
int decodeChunk (struct chunk *c, const uint8_t *buff, int buff_len)
 Decode the bit stream.

Detailed Description

Chunk Delivery API - Lower Abstraction.

The Chunk Delivery LA provides the primitives to encode the send operation of a Chunk to a target Peer and decode the Chunk reception from a Peer. The former returns a bit stream obteined by the encoding of the Chunk to send, it is the packet that will be sent. The latter decode a packet received, the bit stream, in the corresponding Chunk.


Function Documentation

int decodeChunk ( struct chunk c,
const uint8_t *  buff,
int  buff_len 
)

Decode the bit stream.

Decode the bit stream contained int the buffer, filling the other parameters. This is the dual of the encode function.

Parameters:
[in] c Chunks that has been transmitted
[in] buff Buffer which contain the bit stream to decode, filling the above parameters
[in] buff_len length of the buffer that contain the bit stream
Returns:
0 on success, <0 on error
int encodeChunk ( const struct chunk c,
uint8_t *  buff,
int  buff_len 
)

Encode a sequence of information, filling the buffer with the corresponding bit stream.

Encode a sequence of information given as parameters and fills a buffer (given as parameter) with the corresponding bit stream. The main reason to encode a return the bit stream is the possibility to either send directly a packet with the encoded bit stream, or add this bit stream in piggybacking

Parameters:
[in] c Chunk to send
[in] buff Buffer that will be filled with the bit stream obtained as a coding of the above parameters
[in] buff_len length of the buffer that will contain the bit stream
Returns:
the lenght of the encoded bitstream (in bytes) on success, <0 on error
Generated on Mon Jul 12 16:16:52 2010 for GRAPES by  doxygen 1.6.3