aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/buffer.h
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1998-11-12 00:06:47 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1998-11-12 00:06:47 +0000
commitfcb4c78a6a01d22f0db9d6de870342511030cb01 (patch)
treed32b2d7467b0266e722aa763c9b48cf0df2c802c /wiretap/buffer.h
parentc2eeef9467d44eb4ea2cd6bd08f62f5c9c293810 (diff)
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
Diffstat (limited to 'wiretap/buffer.h')
-rw-r--r--wiretap/buffer.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/wiretap/buffer.h b/wiretap/buffer.h
new file mode 100644
index 0000000000..1354b910de
--- /dev/null
+++ b/wiretap/buffer.h
@@ -0,0 +1,34 @@
+/*
+ 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