HTTP.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2003,2004 Sony Corporation 
00003 //
00004 // Permission to use, copy, modify, and redistribute this software for
00005 // non-commercial use is hereby granted.
00006 //
00007 // This software is provided "as is" without warranty of any kind,
00008 // either expressed or implied, including but not limited to the
00009 // implied warranties of fitness for a particular purpose.
00010 //
00011 
00012 #ifndef HTTP_h_DEFINED
00013 #define HTTP_h_DEFINED
00014 
00015 enum HTTPStatus {
00016         HTTP_CONTINUE,
00017         HTTP_SWITCHING_PROTOCOLS,
00018         HTTP_OK,
00019         HTTP_CREATED,
00020         HTTP_ACCEPTED,
00021         HTTP_NO_CONTENT,
00022         HTTP_BAD_REQUEST,
00023         HTTP_NOT_FOUND,
00024         HTTP_SERVER_ERROR,
00025         HTTP_NOT_IMPLEMENTED,
00026         HTTP_STATUS_END,
00027 };
00028 
00029 enum HTTPHeader {
00030         HTTP_SERVER,
00031         HTTP_CONTENT_TYPE,
00032         HTTP_CONTENT_LENGTH,
00033         HTTP_MIME_VERSION,
00034         HTTP_EXPIRES,
00035         HTTP_DATE,
00036         HTTP_HEADER_END,
00037 };
00038 
00039 static const char HTTP_VERSION[] = "HTTP/1.0";
00040 
00041 class HTTP {
00042 public:
00043     HTTP() {}
00044     ~HTTP() {}
00045 
00046     bool Parse(char* httpReq, char* method, char* uri, char* httpVer);
00047 
00048     int Status(char* dest, HTTPStatus st);
00049     int HeaderField(char* dest, HTTPHeader hdr, char* value);
00050 
00051 private:
00052     static const int MAX_HEADER_SIZE = 2048;
00053     static const int BUFSIZE = MAX_HEADER_SIZE + 3; // '\r\n\0'
00054 
00055     char buffer[BUFSIZE];
00056 };
00057 
00058 #endif // HTTP_h_DEFINED

Generated on Sun Dec 2 23:04:28 2007 for openSDK by  doxygen 1.3.9.1