00001
00002 #ifndef HTTPRESPONSE_H
00003 #define HTTPRESPONSE_H
00004
00005 #include <map>
00006 #include <list>
00007
00008 #include "datum.h"
00009
00010
00011
00012 enum ResponseCode { HTTPRESPONSECODE_INVALID = 0,
00013 HTTPRESPONSECODE_200_OK = 200,
00014 HTTPRESPONSECODE_301_MOVEDPERMANENTLY = 301,
00015 HTTPRESPONSECODE_302_FOUND = 302,
00016 HTTPRESPONSECODE_401_UNAUTHORIZED = 401,
00017 HTTPRESPONSECODE_403_FORBIDDEN = 403,
00018 HTTPRESPONSECODE_404_NOTFOUND = 404,
00019 HTTPRESPONSECODE_500_INTERNALSERVERERROR = 500 };
00020 extern const char * ResponsePhrase [ ];
00021
00022 typedef std::map < std::string, Datum > CookieParameters;
00023 typedef std::map < std::string, std::string > StringMap;
00024 typedef std::list < std::string > StringList;
00025
00027
00031 class HttpResponse {
00032
00034 public:
00036
00037
00039
00041
00043 HttpResponse ( );
00044
00046 ~HttpResponse ( );
00047
00049 void SetBody ( const char * ipsBody,
00050 int inBodyLength
00051 );
00052
00054 void SetCookie ( CookieParameters & iroCookieParameters );
00055
00056
00058 char * GetBody ( ) { return psBody; };
00059
00061
00063
00065 ResponseCode nResponseCode;
00066
00067
00069 StringMap oResponseHeaders;
00070
00072 StringList oCookieList;
00073
00075 protected:
00077
00079
00081
00083 char * psBody;
00084
00086 int nBodyLength;
00087
00088
00089 };
00090
00091
00092 #endif // HTTPRESPONSE_H