2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE 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 SOPE 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 SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGBufferedDescriptor_H__
23 #define __NGBufferedDescriptor_H__
25 typedef struct _NGBufferedDescriptor {
28 void *readBufferPos; // current position (ptr) in buffer
29 int readBufferFillSize; // number of 'read' bytes in the buffer
30 int readBufferSize; // maximum capacity in bytes
32 int writeBufferFillSize;
35 } NGBufferedDescriptor;
37 NGBufferedDescriptor *
38 NGBufferedDescriptor_newWithOwnedDescriptorAndSize(int _fd, int _size);
39 NGBufferedDescriptor *
40 NGBufferedDescriptor_newWithDescriptorAndSize(int _fd, int _size);
41 NGBufferedDescriptor *
42 NGBufferedDescriptor_newWithDescriptor(int _fd);
44 void NGBufferedDescriptor_free(NGBufferedDescriptor *self);
48 int NGBufferedDescriptor_getReadBufferSize(NGBufferedDescriptor *self);
49 int NGBufferedDescriptor_getWriteBufferSize(NGBufferedDescriptor *self);
51 // primary read functions
53 int NGBufferedDescriptor_read(NGBufferedDescriptor *self,
54 void *_buffer, int _len);
55 int NGBufferedDescriptor_write(NGBufferedDescriptor *self,
56 const void *_buffer, int _len);
58 // following functions return 1 on success and 0 and error/close
60 char NGBufferedDescriptor_flush(NGBufferedDescriptor *self);
62 unsigned char NGBufferedDescriptor_safeRead(NGBufferedDescriptor *self,
63 void *_buffer, int _len);
64 char NGBufferedDescriptor_safeWrite(NGBufferedDescriptor *self,
65 const void *_buffer, int _len);
67 int NGBufferedDescriptor_readChar(NGBufferedDescriptor *self);
69 char NGBufferedDescriptor_writeHttpHeader(NGBufferedDescriptor *self,
70 const unsigned char *_key,
71 const unsigned char *_value);