ringBuffer.h
Go to the documentation of this file.00001 #ifndef RING_BUFFER_H
00002 #define RING_BUFFER_H
00003
00017 typedef struct {
00018 unsigned char *buf;
00019 int shiftLength;
00020 int length;
00021 int first;
00022 int last;
00023 } ringBuffer_t;
00024
00025
00026 #include "cpp_extern_macro.h"
00027 BEGIN_C_DECLS;
00028
00029 extern void initRingBuffer(ringBuffer_t *ring,
00030 unsigned char *buf, int shiftLength);
00031 extern void clearRingBuffer(ringBuffer_t *ring);
00032 extern int getRingFreeSize(ringBuffer_t *ring);
00033 extern int getRingFillSize(ringBuffer_t *ring);
00034 extern int putRingBuffer(ringBuffer_t *ring, unsigned char ch);
00035 extern int getRingBuffer(ringBuffer_t *ring, unsigned char *ch);
00036 extern int putRingBufferStr(ringBuffer_t *ring,
00037 const unsigned char *str, int n);
00038 extern int getRingBufferStr(ringBuffer_t *ring,
00039 unsigned char *str, int n);
00040 extern int checksumRingBuffer(ringBuffer_t *ring, int num);
00041 extern void getRingBufferCopy(unsigned char *header,
00042 ringBuffer_t *ring, int num);
00043
00044 END_C_DECLS;
00045 #endif
00046