]> git.tdb.fi Git - libs/net.git/blobdiff - source/message.h
Initial revision
[libs/net.git] / source / message.h
diff --git a/source/message.h b/source/message.h
new file mode 100644 (file)
index 0000000..c9dc618
--- /dev/null
@@ -0,0 +1,43 @@
+/* $Id$
+
+This file is part of libmsphttp
+Copyright © 2008  Mikkosoft Productions, Mikko Rasa
+Distributed under the LGPL
+*/
+
+#ifndef MSP_HTTP_MESSAGE_H_
+#define MSP_HTTP_MESSAGE_H_
+
+#include <string>
+#include "misc.h"
+
+namespace Msp {
+namespace Http {
+
+class Message
+{
+public:
+       virtual ~Message() { }
+
+       void set_header(const std::string &, const std::string &);
+       const std::string &get_header(const std::string &) const;
+       const std::string &get_data() const { return data; }
+       bool get_complete() const { return complete; }
+       void add_data(const std::string &);
+       unsigned parse_data(const std::string &);
+       virtual std::string str() const =0;
+protected:
+       Version http_version;
+       HeaderMap headers;
+       std::string data;
+       unsigned chunk_length;
+       bool complete;
+
+       Message();
+       std::string str_common() const;
+};
+
+} // namespace Http
+} // namespace Msp
+
+#endif