00001 #ifndef URG_RING_BUFFER_H 00002 #define URG_RING_BUFFER_H 00003 00017 00018 typedef struct 00019 { 00020 char *buffer; 00021 int buffer_size; 00022 int first; 00023 int last; 00024 } ring_buffer_t; 00025 00026 00042 extern void ring_initialize(ring_buffer_t *ring, 00043 char *buffer, const int shift_length); 00044 00045 00057 extern void ring_clear(ring_buffer_t *ring); 00058 00059 00071 extern int ring_size(const ring_buffer_t *ring); 00072 00073 00085 extern int ring_capacity(const ring_buffer_t *ring); 00086 00087 00107 extern int ring_write(ring_buffer_t *ring, const char *data, int size); 00108 00109 00129 extern int ring_read(ring_buffer_t *ring, char *buffer, int size); 00130 00131 #endif /* ! RING_BUFFER_H */