client.h 891 Bytes
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2 3 4 5 6 7 8
/* client.h
**
** client data structions and function definitions
**
*/
#ifndef __CLIENT_H__
#define __CLIENT_H__

Michael Smith's avatar
Michael Smith committed
9 10
#include "connection.h"

Jack Moffitt's avatar
Jack Moffitt committed
11 12
typedef struct _client_tag
{
13 14 15 16
    /* the clients connection */
    connection_t *con;
    /* the clients http headers */
    http_parser_t *parser;
Jack Moffitt's avatar
Jack Moffitt committed
17

18 19
    /* http response code for this client */
    int respcode;
Jack Moffitt's avatar
Jack Moffitt committed
20

21 22 23 24
    /* buffer queue */
    refbuf_queue_t *queue;
    /* position in first buffer */
    unsigned long pos;
25 26 27

    /* Format-handler-specific data for this client */
    void *format_data;
Jack Moffitt's avatar
Jack Moffitt committed
28 29 30 31
} client_t;

client_t *client_create(connection_t *con, http_parser_t *parser);
void client_destroy(client_t *client);
Michael Smith's avatar
Michael Smith committed
32
void client_send_504(client_t *client, char *message);
33
void client_send_404(client_t *client, char *message);
34
void client_send_401(client_t *client);
35
void client_send_400(client_t *client, char *message);
Jack Moffitt's avatar
Jack Moffitt committed
36 37

#endif  /* __CLIENT_H__ */