/** * CRXHttpResponse.h */ #ifndef __CRXHTTPRESPONSE_H__ #define __CRXHTTPRESPONSE_H__ #include "CRXHttpMessage.h" #define ERROR_HTTP_RESPONSE -4000 #define ERROR_HTTP_RESPONSE_INVALID_LENGTH ERROR_HTTP_RESPONSE - 1 #define ERROR_HTTP_RESPONSE_INVALID_FORMAT ERROR_HTTP_RESPONSE - 2 #define ERROR_HTTP_RESPONSE_FAILED_TO_MEMORY_ALLOCATION ERROR_HTTP_RESPONSE - 3 #define ERROR_HTTP_RESPONSE_FAILED_TO_PARSE_CONTENT ERROR_HTTP_RESPONSE - 4 class CRXHttpResponse : public CRXHttpMessage { private: int mStatusCode; std::string mStatusString; bool mIsChunked; /* Transfer-Encoding */ int mContentLength; struct __content_body__ { char * mBody; int mLength; } mContent; public: CRXHttpResponse (void); ~CRXHttpResponse (void); private: void Parse (void); int ParseContent (const char * aContent, const int aLength); void Reset (void); void ResetContent (void); public: int GetStatusCode (void) const; int SetResponse (const char * aHttpResponse, const int aResponseLength); std::string GetHeader (void) const; const char * GetContentBody (void) const; int GetContentLength (void) const; CRXHttpResponse & operator = (const char * aHttpResponse); }; #endif // #ifndef __CRXHTTPRESPONSE_H__