EVE 1.0
rbuf.h File Reference

Header file for ring buffer primitive library. More...

#include <stdint.h>
#include <stdbool.h>
Include dependency graph for rbuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rbuf_t
 Structure that holds the state of a ring buffer. More...
 

Functions

void rbuf_init (struct rbuf_t *r, uint8_t *a, uint32_t size)
 Initialize a ring buffer. More...
 
uint32_t rbuf_size (struct rbuf_t *r)
 Get the size of a ring buffer. More...
 
uint32_t rbuf_used (struct rbuf_t *r)
 Get the number of bytes currently used in the ring buffer. More...
 
uint32_t rbuf_contused (struct rbuf_t *r, uint8_t **ptr)
 Get the length of a continuous used part of the buffer and a pointer to its beginning. More...
 
void rbuf_commitread (struct rbuf_t *r, uint32_t l)
 Advance the read pointer of the buffer after direct read. Note that length cannot be larger than the value returned by rbuf_contused() More...
 
uint32_t rbuf_free (struct rbuf_t *r)
 Get the number of free bytes currently in the ring buffer. More...
 
uint32_t rbuf_contfree (struct rbuf_t *r, uint8_t **ptr)
 Get the length of a continuous free part of the buffer and a pointer to its beginning. More...
 
void rbuf_commitwrite (struct rbuf_t *r, uint32_t l)
 Advance the write pointer of the buffer after direct write. Note that length cannot be larger than the value returned by rbuf_contfree() More...
 
bool rbuf_push (struct rbuf_t *r, const uint8_t *a, uint32_t l)
 Put an array of bytes to the ring buffer. More...
 
bool rbuf_pull (struct rbuf_t *r, uint8_t *a, uint32_t l)
 Get an array of bytes from the ring buffer. More...
 

Detailed Description

Header file for ring buffer primitive library.

Author
Adam Dunkels adam@.nosp@m.sics.nosp@m..se
SB, Jetro AS

Definition in file rbuf.h.