wireshark/wiretap/buffer.h
Gilbert Ramirez fcb4c78a6a A lengthy patch to add the wiretap library. Wiretap is not used by default
because it is still in its infancy, but it can be compiled in optionally.
The library exists in its own subdirectory ethereal/wiretap. This patch also
edits all the packet-*.c files to remove the #include <pcap.h> line which is
unnecessary in these files. In the ethereal code, file.c is the most heavily
modified with #ifdef WITH_WIRETAP lines for the optional library.

svn path=/trunk/; revision=82
1998-11-12 00:06:47 +00:00

35 lines
998 B
C

/*
buffer.h
--------
*/
#define SOME_FUNCTIONS_ARE_DEFINES
typedef struct Buffer {
char *data;
unsigned int allocated;
unsigned int start;
unsigned int first_free;
} Buffer;
void buffer_init(Buffer* buffer, unsigned int space);
void buffer_free(Buffer* buffer);
void buffer_assure_space(Buffer* buffer, unsigned int space);
void buffer_append(Buffer* buffer, char *from, unsigned int bytes);
void buffer_remove_start(Buffer* buffer, unsigned int bytes);
#ifdef SOME_FUNCTIONS_ARE_DEFINES
#define buffer_increase_length(buffer,bytes) (buffer)->first_free += (bytes)
#define buffer_length(buffer) ((buffer)->first_free - (buffer)->start)
#define buffer_start_ptr(buffer) ((buffer)->data + (buffer)->start)
#define buffer_end_ptr(buffer) ((buffer)->data + (buffer)->first_free)
#else
void buffer_increase_length(Buffer* buffer, unsigned int bytes);
unsigned int buffer_length(Buffer* buffer);
char* buffer_start_ptr(Buffer* buffer);
char* buffer_end_ptr(Buffer* buffer);
#endif