client.h 935 Bytes
#ifndef __CLIENT_H__
#define __CLIENT_H__

#include <stdio.h> /* for FILE */

#include <expat.h>

#include "httpRequest.h"

#define READBUFSIZE    2048  /* Size of receive readBuffer */
#define CLIENTMULTMAX  512U   /* 1MB maximum size the readbuffer may grow */

#define READ_ERR_LONGLINE   -2
#define READ_ERR_MEMORY     -3

extern int verbose;

typedef struct {
    int          socket;
    char *       readBuffer;
    char *       writeBuffer;
    unsigned int readPos;
    unsigned int writePos;
    unsigned int readBufMult;
    char         remoteAddr[16];

    tHttpHeader  httpHeader;
    unsigned int bodyLenRemaining;

    XML_Parser   parser;
} tClient;


void   clientClose(tClient * client);
int    clientRead(tClient * client);
int    clientWrite(tClient * client);
char * clientGetLine(tClient *, const char *, unsigned int *);
char * clientRemoveLine(tClient *, const char *, unsigned int *);

#endif // __CLIENT_H__