• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

spl/net/http_lib.h

00001 #error "Plain Old C no longer supported"
00002 
00003 //~ #ifndef _http_lib_h
00004 //~ #define _http_lib_h
00005 
00006 //~ #ifdef _WIN32
00007 //~ #include <spl/configwin32.h>
00008 //~ #endif
00009 
00010 //~ #include <spl/debug.h>
00011 //~ #include <spl/cstring.h>
00012 //~ #include <spl/net/csocket.h>
00013 //~ #include <spl/collection/cvector.h>
00014 
00015 //~ #ifdef __cplusplus
00016 //~ extern "C" {
00017 //~ #endif
00018 
00019 //~ /* return type */
00020 //~ typedef enum {
00021 
00022   //~ /* Client side errors */
00023   //~ ERRHOST=-1, /* No such host */
00024   //~ ERRSOCK=-2, /* Can't create socket */
00025   //~ ERRCONN=-3, /* Can't connect to host */
00026   //~ ERRWRHD=-4, /* Write error on socket while writing header */
00027   //~ ERRWRDT=-5, /* Write error on socket while writing data */
00028   //~ ERRRDHD=-6, /* Read error on socket while reading result */
00029   //~ ERRPAHD=-7, /* Invalid answer from data server */
00030   //~ ERRNULL=-8, /* Null data pointer */
00031   //~ ERRNOLG=-9, /* No/Bad length in header */
00032   //~ ERRMEM=-10, /* Can't allocate memory */
00033   //~ ERRRDDT=-11,/* Read error while reading data */
00034   //~ ERRURLH=-12,/* Invalid url - must start with 'http://' */
00035   //~ ERRURLP=-13,/* Invalid port in url */
00036   
00037   //~ /* Return code by the server */
00038   //~ ERR400=400, /* Invalid query */
00039   //~ ERR403=403, /* Forbidden */
00040   //~ ERR408=408, /* Request timeout */
00041   //~ ERR500=500, /* Server error */
00042   //~ ERR501=501, /* Not implemented */
00043   //~ ERR503=503, /* Service overloaded */
00044 
00045   //~ /* Succesful results */
00046   //~ OK0 = 0,   /* successfull parse */
00047   //~ OK201=201, /* Ressource succesfully created */
00048   //~ OK200=200  /* Ressource succesfully read */
00049 
00050 //~ } http_retcode;
00051 
00052 //~ /* user agents */
00053 //~ enum useragent
00054 //~ {
00055         //~ UA_GENERIC = 0
00056 //~ };
00057 
00058 //~ //
00059 //~ //typedef struct 
00060 //~ //{
00061 //~ //  string *key;
00062 //~ //  string *val;
00063 //~ //} kvpair;
00064 //~ //
00065 //~ //typedef struct
00066 //~ //{
00067 //~ //  string *protocol;
00068 //~ //  string *server;
00069 //~ //  int port;
00070 //~ //  string *path;
00071 //~ //  vector *args;
00072 //~ //} uriparsed;
00073 //~ //
00074 //~ //uriparsed *uriParse( const char *path );
00075 //~ //void uriDestruct( uriparsed *uri );
00076 //~ //
00077 //~ //typedef struct
00078 //~ //{
00079 //~ //  uriparsed *requri;
00080 //~ //  string *proxy_server;
00081 //~ //  int     proxy_port;
00082 //~ //  enum useragent user_agent;
00083 //~ //  vector *headers;
00084 //~ //} httprequest;
00085 //~ //
00086 //~ //httprequest *httprequestConstruct( const char *url, const char *proxy, const int proxyport, const enum useragent agent );
00087 //~ //void httprequestDestruct( httprequest *hreq );
00088 //~ //http_retcode httprequestGet( httprequest *req, string **output );
00089 //~ //http_retcode httprequestDelete( httprequest *req );
00090 //~ //http_retcode httprequestPut( httprequest *req, char *data, int datalen );
00091 //~ //
00092 //~ //#if defined(DEBUG) || defined(_DEBUG)
00093 //~ //void httprequestValidateMem(httprequest *hreq);
00094 //~ //void httprequestCheckMem(httprequest *hreq);
00095 //~ //void uriValidateMem( uriparsed *uri );
00096 //~ //void uriCheckMem( uriparsed *uri );
00097 //~ //#else
00098 //~ //#define httprequestValidateMem(a)
00099 //~ //#define httprequestCheckMem(a)
00100 //~ //#define uriValidateMem(a)
00101 //~ //#define uriCheckMem(a)
00102 //~ //#endif
00103 //~ //
00104 //~ //#ifdef __cplusplus
00105 //~ //}
00106 //~ //#endif
00107 
00108 //~ #endif