added basic ssl support to ircu
[ircu2.10.12-pk.git] / include / dbuf.h
index 03b45d1e0efe0d574e4da70986869bac33bb003b..057ff2a6a691a6acb4560c5b66baa03f117dc04d 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+/** @file
+ * @brief Interfaces and declarations for dealing with data buffers.
+ * @version $Id$
+ */
 #ifndef INCLUDED_dbuf_h
 #define INCLUDED_dbuf_h
 #ifndef INCLUDED_sys_types_h
-#include <sys/types.h>         /* size_t */
+#include <sys/types.h>          /* size_t */
 #define INCLUDED_sys_types_h
 #endif
 
 /*
  * These two globals should be considered read only
  */
-extern int DBufAllocCount;     /* GLOBAL - count of dbufs allocated */
-extern int DBufUsedCount;      /* GLOBAL - count of dbufs in use */
+extern int DBufAllocCount;
+extern int DBufUsedCount;
 
 struct DBufBuffer;
 
+/** Queue of data chunks. */
 struct DBuf {
-  size_t length;               /* Current number of bytes stored */
-  struct DBufBuffer *head;     /* First data buffer, if length > 0 */
-  struct DBufBuffer *tail;     /* last data buffer, if length > 0 */
+  unsigned int length;          /**< Current number of bytes stored */
+  struct DBufBuffer *head;      /**< First data buffer, if length > 0 */
+  struct DBufBuffer *tail;      /**< Last data buffer, if length > 0 */
 };
 
-/*
- * DBufLength - Returns the current number of bytes stored into the buffer.
- */
+/** Return number of bytes in a DBuf. */
 #define DBufLength(dyn) ((dyn)->length)
 
-/*
- * DBufClear - Scratch the current content of the buffer.
- * Release all allocated buffers and make it empty.
- */
+/** Release the entire content of a DBuf. */
 #define DBufClear(dyn) dbuf_delete((dyn), DBufLength(dyn))
 
 /*
  * Prototypes
  */
-extern void dbuf_delete(struct DBuf *dyn, size_t length);
-extern int dbuf_put(struct DBuf *dyn, const char *buf, size_t length);
-extern const char *dbuf_map(const struct DBuf *dyn, size_t *length);
-extern size_t dbuf_get(struct DBuf *dyn, char *buf, size_t length);
-extern size_t dbuf_getmsg(struct DBuf *dyn, char *buf, size_t length);
+extern void dbuf_delete(struct DBuf *dyn, unsigned int length);
+extern int dbuf_put(struct DBuf *dyn, const char *buf, unsigned int length);
+extern const char *dbuf_map(const struct DBuf *dyn, unsigned int *length);
+extern unsigned int dbuf_get(struct DBuf *dyn, char *buf, unsigned int length);
+extern unsigned int dbuf_getmsg(struct DBuf *dyn, char *buf, unsigned int length);
 extern void dbuf_count_memory(size_t *allocated, size_t *used);