summaryrefslogtreecommitdiffstats
path: root/src/sliding_buffer.h
blob: 838e386bacbba383db817b567a2438381b04e460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef _SLIDING_BUF_H
#define _SLIDING_BUF_H	1


/* sliding buffer structure */
typedef struct {
	int		fh;			/* the input filehandle for the buffer */
	unsigned char	*buf;			/* pointer to the buffer  */
	unsigned char	*ptr;			/* start positon (used internally) */
	unsigned char	*segment;		/* the start position of this segment */ 
	int		len;			/* length of this segment */
	int		maxsize;		/* max size of buffer */
	int		bufsize;		/* current size of buffer */
	int		eof; 			/* true if there is no more to read */
	} sliding_buffer_t;



/* sliding_buffer.c */
int s_buffer_init(sliding_buffer_t *sbuf, int size);
void s_buffer_destroy(sliding_buffer_t *sbuf);
int s_buffer_read(sliding_buffer_t *sbuf, char *matchstr);


#endif /* !_SLIDING_BUF_H */