00001 /* 00002 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). 00003 * dbuf.h: A header for the dynamic buffers functions. 00004 * 00005 * Copyright (C) 2002 by the past and present ircd coders, and others. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 * USA 00021 * 00022 * $Id: dbuf.h 33 2005-10-02 20:50:00Z knight $ 00023 */ 00024 00025 #ifndef __DBUF_H_INCLUDED 00026 #define __DBUF_H_INCLUDED 00027 #include "tools.h" 00028 00029 #define DBUF_BLOCK_SIZE 1024 /* this is also our MTU used for sending */ 00030 00031 #define dbuf_length(x) ((x)->total_size) 00032 #define dbuf_clear(x) dbuf_delete(x, dbuf_length(x)) 00033 00034 struct dbuf_block 00035 { 00036 size_t size; 00037 char data[DBUF_BLOCK_SIZE]; 00038 }; 00039 00040 struct dbuf_queue 00041 { 00042 dlink_list blocks; 00043 size_t total_size; 00044 }; 00045 00046 extern void dbuf_init(void); 00047 extern void dbuf_put(struct dbuf_queue *, char *, size_t); 00048 extern void dbuf_delete(struct dbuf_queue *, size_t); 00049 #endif