http.h File Reference

#include "config.h"
#include "common.h"
#include "hashtable.h"
#include "trie.h"
#include "vector.h"
#include "socket.h"
#include "str.h"
#include <string.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  _cp_http_request
struct  _cp_http_response
struct  _cp_httpsocket
struct  _cp_http_service

Defines

#define DEFAULT_SERVER_NAME   "cprops-__CPROPSVERSION"
#define DEFAULT_KEEPALIVE   300
#define HTTP_KEEPALIVE   DEFAULT_KEEPALIVE
#define MAX_URL_LENGTH   0x400

Typedefs

typedef CPROPS_DLL enum { ... }  cp_http_version
typedef CPROPS_DLL enum { ... }  cp_http_status_code
typedef CPROPS_DLL enum { ... }  connection_policy
typedef CPROPS_DLL enum { ... }  cp_http_content_type
typedef CPROPS_DLL struct
_cp_http_request 
cp_http_request
typedef CPROPS_DLL struct
_cp_http_response 
cp_http_response
typedef int(*) cp_http_service_callback (cp_http_request *request, cp_http_response *response)
typedef CPROPS_DLL struct
_cp_httpsocket 
cp_httpsocket
typedef CPROPS_DLL struct
_cp_http_service 
cp_http_service

Enumerations

enum  {
  OPTIONS, GET, HEAD, POST,
  PUT, DELETE, TRACE, CONNECT
}
enum  { HTTP_1_0, HTTP_1_1 }
enum  {
  HTTP_NULL_STATUS = -1, HTTP_100_CONTINUE = 100, HTTP_101_SWITCHING_PROTOCOLS = 101, HTTP_200_OK = 200,
  HTTP_201_CREATED = 201, HTTP_202_ACCEPTED = 202, HTTP_203_NON_AUTHORITATIVE_INFORMATION = 203, HTTP_204_NO_CONTENT = 204,
  HTTP_205_RESET_CONTENT = 205, HTTP_206_PARTIAL_CONTENT = 206, HTTP_300_MULTIPLE_CHOICES = 300, HTTP_301_MOVED_PERMANENTLY = 301,
  HTTP_302_FOUND = 302, HTTP_303_SEE_OTHER = 303, HTTP_304_NOT_MODIFIED = 304, HTTP_305_USE_PROXY = 305,
  HTTP_307_TEMPORARY_REDIRECT = 307, HTTP_400_BAD_REQUEST = 400, HTTP_401_UNAUTHORIZED = 401, HTTP_402_PAYMENT_REQUIRED = 402,
  HTTP_403_FORBIDDEN = 403, HTTP_404_NOT_FOUND = 404, HTTP_405_METHOD_NOT_ALLOWED = 405, HTTP_406_NOT_ACCEPTABLE = 406,
  HTTP_407_PROXY_AUTHENTICATION_REQUIRED = 407, HTTP_408_REQUEST_TIME_OUT = 408, HTTP_409_CONFLICT = 409, HTTP_410_GONE = 410,
  HTTP_411_LENGTH_REQUIRED = 411, HTTP_412_PRECONDITION_FAILED = 412, HTTP_413_REQUEST_ENTITY_TOO_LARGE = 413, HTTP_414_REQUEST_URI_TOO_LARGE = 414,
  HTTP_415_UNSUPPORTED_MEDIA_TYPE = 415, HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE = 416, HTTP_417_EXPECTATION_FAILED = 417, HTTP_500_INTERNAL_SERVER_ERROR = 500,
  HTTP_501_NOT_IMPLEMENTED = 501, HTTP_502_BAD_GATEWAY = 502, HTTP_503_SERVICE_UNAVAILABLE = 503, HTTP_504_GATEWAY_TIME_OUT = 504,
  HTTP_505_HTTP_VERSION_NOT_SUPPORTED = 505
}
enum  { HTTP_CONNECTION_POLICY_DEFAULT, HTTP_CONNECTION_POLICY_CLOSE, HTTP_CONNECTION_POLICY_KEEP_ALIVE }
enum  { TEXT, HTML, JPEG }

Functions

char * get_http_request_type_lit (cp_http_request_type type)
int cp_http_init ()
void cp_http_shutdown ()
CPROPS_DLL cp_http_requestcp_http_request_parse (struct _cp_httpsocket *owner, char *request, int *err)
void cp_http_request_delete (cp_http_request *request)
char * cp_http_request_get_header (cp_http_request *req, char *header)
char ** cp_http_request_get_headers (cp_http_request *request)
char * cp_http_request_get_parameter (cp_http_request *request, char *name)
CPROPS_DLL cp_vector * cp_http_request_get_param_vector (cp_http_request *request, char *name)
CPROPS_DLL cp_vector * cp_http_request_get_params (cp_http_request *request)
void cp_http_request_dump (cp_http_request *req)
cp_http_responsecp_http_response_create (cp_http_request *req)
void cp_http_response_delete (cp_http_response *response)
void cp_http_response_destroy (cp_http_response *res)
int cp_http_response_write (cp_connection_descriptor *cdesc, cp_http_response *res)
void cp_http_response_set_status (cp_http_response *response, cp_http_status_code status)
cp_http_status_code cp_http_response_get_status (cp_http_response *response)
void cp_http_response_set_content_type (cp_http_response *response, cp_http_content_type type)
void cp_http_response_set_content_type_string (cp_http_response *response, char *content_type)
char * cp_http_response_get_content_type (cp_http_response *response)
void cp_http_response_set_header (cp_http_response *response, char *name, char *value)
char * cp_http_response_get_header (cp_http_response *response, char *name)
cp_vector * cp_http_response_get_header_names (cp_http_response *response)
void cp_http_response_set_body (cp_http_response *response, char *body)
void cp_http_response_set_content (cp_http_response *response, cp_string *content)
cp_stringcp_http_response_get_content (cp_http_response *response)
void cp_http_response_set_connection_policy (cp_http_response *response, connection_policy policy)
void cp_http_response_skip (cp_http_response *response)
void cp_http_response_report_error (cp_http_response *response, cp_http_status_code code, char *message)
void * cp_http_thread_fn (void *prm)
cp_httpsocketcp_httpsocket_create (int port, cp_http_service_callback service)
void cp_httpsocket_delete (cp_httpsocket *sock)
void cp_httpsocket_set_keepalive (cp_httpsocket *socket, int sec)
void cp_httpsocket_set_server_name (cp_httpsocket *socket, char *name)
void cp_httpsocket_set_backlog (cp_httpsocket *socket, int backlog)
void cp_httpsocket_set_delay (cp_httpsocket *socket, struct timeval delay)
void cp_httpsocket_set_delay_sec (cp_httpsocket *socket, long sec)
void cp_httpsocket_set_delay_usec (cp_httpsocket *socket, long usec)
void cp_httpsocket_set_poolsize_min (cp_httpsocket *socket, int min)
void cp_httpsocket_set_poolsize_max (cp_httpsocket *socket, int max)
void * cp_httpsocket_add_shutdown_callback (cp_httpsocket *socket, void(*cb)(void *), void *prm)
int cp_httpsocket_listen (cp_httpsocket *sock)
cp_http_servicecp_http_service_create (char *name, char *path, cp_http_service_callback callback)
void cp_http_service_delete (cp_http_service *service)
int cp_httpsocket_register_service (cp_httpsocket *server, cp_http_service *service)
void * cp_httpsocket_unregister_service (cp_httpsocket *server, cp_http_service *service)
void * cp_http_add_shutdown_callback (void(*cb)(void *), void *prm)

Variables

__BEGIN_DECLS typedef CPROPS_DLL
enum { ... }  
cp_http_request_type
CPROPS_DLL _cp_httpsocket


Detailed Description

basic http feature implementations. the intention is to offer a simple way of providing services to http based clients.

Definition in file http.h.


Generated on Mon Dec 5 23:00:22 2011 for cprops by  doxygen 1.4.7