ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/newio/include/dbuf.h
Revision: 2388
Committed: Tue Jul 9 11:22:52 2013 UTC (13 years, 3 months ago) by michael
Content type: text/x-chdr
File size: 2153 byte(s)
Log Message:
- Working towards implementing new ioengine

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 *
4 * Copyright (C) 1990 Markku Savela
5 * Copyright (C) 2013 by the Hybrid Development Team.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 */
22
23 /*! \file dbuf.h
24 * \brief Interfaces and declarations for dealing with data buffers.
25 * \version $Id$
26 */
27
28 #ifndef INCLUDED_dbuf_h
29 #define INCLUDED_dbuf_h
30 #ifndef INCLUDED_sys_types_h
31 #include <sys/types.h> /* size_t */
32 #define INCLUDED_sys_types_h
33 #endif
34
35 /*
36 * These two globals should be considered read only
37 */
38 extern int DBufAllocCount;
39 extern int DBufUsedCount;
40
41 struct DBufBuffer;
42
43 /** Queue of data chunks. */
44 struct DBuf
45 {
46 unsigned int length; /**< Current number of bytes stored */
47 struct DBufBuffer *head; /**< First data buffer, if length > 0 */
48 struct DBufBuffer *tail; /**< Last data buffer, if length > 0 */
49 };
50
51 /** Return number of bytes in a DBuf. */
52 #define DBufLength(dyn) ((dyn)->length)
53
54 /** Release the entire content of a DBuf. */
55 #define DBufClear(dyn) dbuf_delete((dyn), DBufLength(dyn))
56
57 /*
58 * Prototypes
59 */
60 extern void dbuf_delete(struct DBuf *, unsigned int);
61 extern int dbuf_put(struct DBuf *, const char *, unsigned int);
62 extern const char *dbuf_map(const struct DBuf *, unsigned int *);
63 extern unsigned int dbuf_get(struct DBuf *, char *, unsigned int);
64 extern unsigned int dbuf_getmsg(struct DBuf *, char *, unsigned int);
65 extern void dbuf_count_memory(size_t *, size_t *);
66 #endif /* INCLUDED_dbuf_h */

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision