00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00034 #ifndef _AFLIBBUFFERUTILS_H
00035 #define _AFLIBBUFFERUTILS_H
00036
00037 #ifdef HAVE_CONFIG_H
00038 #include <config.h>
00039 #endif
00040
00041
00042 class aflibBufferUtils {
00043
00044 public:
00045
00046 aflibBufferUtils();
00047
00048 ~aflibBufferUtils();
00049
00050 bool
00051 init(
00052 int buf_size);
00053
00055 inline
00056 int
00057 getBufferSize() const {return(_buf_size);};
00058
00060 inline
00061 int
00062 bytes_available()
00063 {
00064 int bytes_avail;
00065
00066 if (_w_ptr >= _r_ptr)
00067 bytes_avail = _w_ptr - _r_ptr;
00068 else
00069 bytes_avail = _buf_size - (_r_ptr - _w_ptr);
00070
00071 return(bytes_avail);
00072 };
00073
00074 void
00075 write(
00076 unsigned char * buf,
00077 int num_bytes);
00078
00079 void
00080 read(
00081 unsigned char * buf,
00082 int num_bytes);
00083
00084 private:
00085
00086 unsigned char * _buf_ptr;
00087 unsigned char * _end_ptr;
00088 unsigned char * _w_ptr;
00089 unsigned char * _r_ptr;
00090 int _buf_size;
00091
00092
00093 };
00094
00095 #endif