00001 #ifndef URG_RING_BUFFER_H 00002 #define URG_RING_BUFFER_H 00003 00014 00015 typedef struct 00016 { 00017 char *buffer; 00018 int buffer_size; 00019 int first; 00020 int last; 00021 } ring_buffer_t; 00022 00023 00031 extern void ring_initialize(ring_buffer_t *ring, 00032 char *buffer, const int shift_length); 00033 00034 00040 extern void ring_clear(ring_buffer_t *ring); 00041 00042 00048 extern int ring_size(const ring_buffer_t *ring); 00049 00050 00056 extern int ring_capacity(const ring_buffer_t *ring); 00057 00058 00068 extern int ring_write(ring_buffer_t *ring, const char *data, int size); 00069 00070 00080 extern int ring_read(ring_buffer_t *ring, char *buffer, int size); 00081 00082 #endif /* ! RING_BUFFER_H */