"Fossies" - the Fresh Open Source Software Archive

Member "libgcgi.a-0.9.5/src/crlfstringbuf.h" (22 Jun 2002, 2779 Bytes) of package /linux/www/old/gcgi-0.9.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "crlfstringbuf.h" see the Fossies "Dox" file reference documentation.

    1 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
    2 /*
    3  * GCGI Library, implementing NCSA'a Common Gateway Interface and RFC2338.
    4  * Copyright (C) 2001-2002 Julian Catchen, julian@catchen.org
    5  *
    6  * This library is free software; you can redistribute it and/or
    7  * modify it under the terms of the GNU Lesser General Public
    8  * License as published by the Free Software Foundation; either
    9  * version 2.1 of the License, or (at your option) any later version.
   10  *
   11  * This library is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14  * Lesser General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU Lesser General Public
   17  * License along with this library; if not, write to the Free Software
   18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   19  */
   20 
   21 #ifndef __CRLFSTRINGBUF_H__
   22 #define __CRLFSTRINGBUF_H__
   23 
   24 #include "common.h"
   25 
   26 /* 
   27  * The CRLF string buffer is a structure used to buffer 
   28  * CRLF terminated strings.  Useful for reading incoming
   29  * streams containing MIME documents, or HTTP data. The 
   30  * stream buffer allows the user to peek ahead at the data
   31  * to look for MIME boundaries or the end of e-mail headers.
   32  */
   33 
   34 typedef struct crlfstringbuf 
   35 {
   36     int       numb;         /* Number of line buffers           */
   37     size_t    index;        /* Current Buffer                   */
   38     int       bufsfull;     /* Number of buffers full           */
   39     size_t    bytesread;    /* Number of bytes read from stream */
   40     char    **buf;          /* Array of Line Buffers            */
   41     size_t   *size;         /* Array of Buffer Sizes            */
   42     size_t   *length;       /* Array of how full each buffer is */
   43     FILE     *stream;       /* Stread to read from              */
   44     size_t    lineLimit;    /* Single line limit                */
   45     size_t    bufLimit;     /* Buffer upper-bound limit         */
   46     int       endofstream;  /* End of Stream Flag               */
   47     int       truncated;    /* Line Truncated Flag              */
   48 } CRLFStringBuf;
   49 
   50 
   51 CRLFStringBuf  *crlfsbuf_new(int bufferSize, FILE *stream, size_t lineLimit, size_t bufferLimit);
   52 char           *crlfsbuf_read(CRLFStringBuf *sb);
   53 size_t          crlfsbuf_readdata(CRLFStringBuf *sb, char **buffer, size_t *size, size_t *length);
   54 char           *crlfsbuf_peek(CRLFStringBuf *sb);
   55 size_t          crlfsbuf_linesread(CRLFStringBuf *sb);
   56 size_t          crlfsbuf_bytesread(CRLFStringBuf *sb);
   57 int             crlfsbuf_truncated(CRLFStringBuf *sb);
   58 void            crlfsbuf_dump(CRLFStringBuf *sb, FILE *stream);
   59 void            crlfsbuf_free(CRLFStringBuf *sb);
   60 
   61 #endif /* __CRLFSTRINGBUF_H__ */