| 1 | /* $Id: buffer.h,v 1.9 2011/06/28 00:13:48 sbajic Exp $ */ |
|---|
| 2 | |
|---|
| 3 | /* |
|---|
| 4 | DSPAM |
|---|
| 5 | COPYRIGHT (C) 2002-2012 DSPAM PROJECT |
|---|
| 6 | |
|---|
| 7 | This program is free software: you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU Affero General Public License as |
|---|
| 9 | published by the Free Software Foundation, either version 3 of the |
|---|
| 10 | License, or (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 Affero General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU Affero General Public License |
|---|
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 19 | |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef _BUFFER_H |
|---|
| 23 | #define _BUFFER_H |
|---|
| 24 | |
|---|
| 25 | typedef struct |
|---|
| 26 | { |
|---|
| 27 | long size; |
|---|
| 28 | long used; |
|---|
| 29 | char *data; |
|---|
| 30 | } buffer; |
|---|
| 31 | |
|---|
| 32 | buffer *buffer_create (const char *); |
|---|
| 33 | buffer *buffer_ncreate (const char *, long plen); |
|---|
| 34 | void buffer_destroy (buffer *); |
|---|
| 35 | |
|---|
| 36 | int buffer_copy (buffer *, const char *); |
|---|
| 37 | int buffer_ncopy (buffer *, const char *, long plen); |
|---|
| 38 | int buffer_cat (buffer *, const char *); |
|---|
| 39 | int buffer_ncat (buffer *, const char *, long plen); |
|---|
| 40 | int buffer_clear (buffer *); |
|---|
| 41 | |
|---|
| 42 | #endif /* _BUFFER_H */ |
|---|