2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGBufferedDescriptor_H__
24 #define __NGBufferedDescriptor_H__
26 typedef struct _NGBufferedDescriptor {
29 void *readBufferPos; // current position (ptr) in buffer
30 int readBufferFillSize; // number of 'read' bytes in the buffer
31 int readBufferSize; // maximum capacity in bytes
33 int writeBufferFillSize;
36 } NGBufferedDescriptor;
38 NGBufferedDescriptor *
39 NGBufferedDescriptor_newWithOwnedDescriptorAndSize(int _fd, int _size);
40 NGBufferedDescriptor *
41 NGBufferedDescriptor_newWithDescriptorAndSize(int _fd, int _size);
42 NGBufferedDescriptor *
43 NGBufferedDescriptor_newWithDescriptor(int _fd);
45 void NGBufferedDescriptor_free(NGBufferedDescriptor *self);
49 int NGBufferedDescriptor_getReadBufferSize(NGBufferedDescriptor *self);
50 int NGBufferedDescriptor_getWriteBufferSize(NGBufferedDescriptor *self);
52 // primary read functions
54 int NGBufferedDescriptor_read(NGBufferedDescriptor *self,
55 void *_buffer, int _len);
56 int NGBufferedDescriptor_write(NGBufferedDescriptor *self,
57 const void *_buffer, int _len);
59 // following functions return 1 on success and 0 and error/close
61 char NGBufferedDescriptor_flush(NGBufferedDescriptor *self);
63 unsigned char NGBufferedDescriptor_safeRead(NGBufferedDescriptor *self,
64 void *_buffer, int _len);
65 char NGBufferedDescriptor_safeWrite(NGBufferedDescriptor *self,
66 const void *_buffer, int _len);
68 int NGBufferedDescriptor_readChar(NGBufferedDescriptor *self);
70 char NGBufferedDescriptor_writeHttpHeader(NGBufferedDescriptor *self,
71 const unsigned char *_key,
72 const unsigned char *_value);