Cleaned up the source so that the internal structure is no exposed by the
buffer.h header.
This commit is contained in:
1 parent
55185db499
commit
b7f7599d76
2 files changed
+104
-198
No files matched your search
+4
-41
@@ -1,4 +1,4 @@
|
||||
/* $Id: buffer.h,v 1.2 2000-03-31 20:09:19 rjkaes Exp $
|
||||
/* $Id: buffer.h,v 1.3 2000-09-11 23:41:32 rjkaes Exp $
|
||||
*
|
||||
* See 'buffer.c' for a detailed description.
|
||||
*
|
||||
@@ -15,50 +15,13 @@
|
||||
* General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __BUFFER_H_
|
||||
#define __BUFFER_H_ 1
|
||||
#ifndef _TINYPROXY_BUFFER_H_
|
||||
#define _TINYPROXY_BUFFER_H_
|
||||
|
||||
#define MAXBUFFSIZE 20480
|
||||
|
||||
struct bufline_s {
|
||||
unsigned char *string; /* the actual string of data */
|
||||
struct bufline_s *next; /* pointer to next in linked list */
|
||||
unsigned int length; /* length of the string of data */
|
||||
unsigned int pos; /* start sending from this offset */
|
||||
};
|
||||
|
||||
struct buffer_s {
|
||||
struct bufline_s *head; /* top of the buffer */
|
||||
struct bufline_s *tail; /* bottom of the buffer */
|
||||
unsigned long int size; /* total size of the buffer */
|
||||
|
||||
unsigned char *working_string; /* needed for building a new line incr. */
|
||||
unsigned int working_length; /* length of working line */
|
||||
};
|
||||
|
||||
#define buffer_head(x) (((struct buffer_s *)(x))->head)
|
||||
#define buffer_tail(x) (((struct buffer_s *)(x))->tail)
|
||||
#define buffer_size(x) (((struct buffer_s *)(x))->size)
|
||||
|
||||
/* Create and delete buffers */
|
||||
extern struct buffer_s *new_buffer(void);
|
||||
extern void delete_buffer(struct buffer_s *buffptr);
|
||||
extern unsigned int buffer_size(struct buffer_s *buffptr);
|
||||
|
||||
/* Operate on the end of the list */
|
||||
extern struct bufline_s *push_buffer(struct buffer_s *buffptr,
|
||||
unsigned char *data, unsigned int length);
|
||||
extern struct bufline_s *pop_buffer(struct buffer_s *buffptr);
|
||||
|
||||
/* Operate on the head of the list */
|
||||
extern struct bufline_s *unshift_buffer(struct buffer_s *buffptr,
|
||||
unsigned char *data,
|
||||
unsigned int length);
|
||||
extern struct bufline_s *shift_buffer(struct buffer_s *buffptr);
|
||||
|
||||
/* Free a buffer line */
|
||||
extern void free_line(struct bufline_s *line);
|
||||
|
||||
/* Read/Write the buffer to a socket */
|
||||
extern int readbuff(int fd, struct buffer_s *buffptr);
|
||||
extern int writebuff(int fd, struct buffer_s *buffptr);
|
||||
|
||||
|
||||
Reference in new issue
Block a user