Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _HTTP_SERVER_H_
00020 #define _HTTP_SERVER_H_
00021
00022 #include <string>
00023 #include <vector>
00024 #include <boost/shared_ptr.hpp>
00025 #include <boost/shared_array.hpp>
00026 #include <boost/scoped_array.hpp>
00027 #include <sstream>
00028
00029 #include "amf.h"
00030 #include "cque.h"
00031 #include "rtmp.h"
00032 #include "http.h"
00033 #include "handler.h"
00034 #include "network.h"
00035 #include "buffer.h"
00036 #include "diskstream.h"
00037
00038 namespace cygnal
00039 {
00040
00041 class DSOEXPORT HTTPServer : public gnash::HTTP
00042 {
00043 public:
00044 HTTPServer();
00045 ~HTTPServer();
00046
00047
00048 http_method_e processClientRequest(int fd);
00049 http_method_e processClientRequest(Handler *hand, int fd, cygnal::Buffer *buf);
00050 cygnal::Buffer &processGetRequest(Handler *hand, int fd, cygnal::Buffer *buf);
00051 boost::shared_ptr<cygnal::Buffer> processPostRequest(int fd, cygnal::Buffer *buf);
00052 boost::shared_ptr<cygnal::Buffer> processPutRequest(int fd, cygnal::Buffer *buf);
00053 boost::shared_ptr<cygnal::Buffer> processDeleteRequest(int fd, cygnal::Buffer *buf);
00054 boost::shared_ptr<cygnal::Buffer> processConnectRequest(int fd, cygnal::Buffer *buf);
00055 boost::shared_ptr<cygnal::Buffer> processOptionsRequest(int fd, cygnal::Buffer *buf);
00056 boost::shared_ptr<cygnal::Buffer> processHeadRequest(int fd, cygnal::Buffer *buf);
00057 boost::shared_ptr<cygnal::Buffer> processTraceRequest(int fd, cygnal::Buffer *buf);
00058
00059
00060 boost::shared_ptr<cygnal::Buffer> formatServerReply(http_status_e code);
00061 cygnal::Buffer &formatGetReply(gnash::DiskStream::filetype_e type, size_t size, http_status_e code);
00062 cygnal::Buffer &formatGetReply(size_t size, http_status_e code);
00063 cygnal::Buffer &formatGetReply(http_status_e code);
00064 cygnal::Buffer &formatPostReply(rtmpt_cmd_e code);
00065 cygnal::Buffer &formatErrorResponse(http_status_e err);
00066
00067
00068
00069
00070 rtmpt_cmd_e extractRTMPT(boost::uint8_t *data);
00071 rtmpt_cmd_e extractRTMPT(cygnal::Buffer &data)
00072 { return extractRTMPT(data.reference()); };
00073
00074 #if 0
00075
00076
00077 http_method_e extractCommand(boost::uint8_t *data);
00078 http_method_e extractCommand(cygnal::Buffer &data)
00079 { return extractCommand(data.reference()); };
00080
00081
00082
00083
00084 boost::uint8_t *processHeaderFields(cygnal::Buffer &buf);
00085 #endif
00086
00087 #if 0
00088
00089 std::vector<boost::shared_ptr<cygnal::Element > > parseEchoRequest(gnash::cygnal::Buffer &buf) { return parseEchoRequest(buf.reference(), buf.size()); };
00090 std::vector<boost::shared_ptr<cygnal::Element > > parseEchoRequest(boost::uint8_t *buf, size_t size);
00091
00092
00093 gnash::cygnal::Buffer &formatEchoResponse(const std::string &num, cygnal::Element &el);
00094 gnash::cygnal::Buffer &formatEchoResponse(const std::string &num, cygnal::Buffer &data);
00095 gnash::cygnal::Buffer &formatEchoResponse(const std::string &num, uint8_t *data, size_t size);
00096 #endif
00097
00098 bool http_handler(Handler *hand, int netfd, cygnal::Buffer *buf);
00099 boost::shared_ptr<gnash::DiskStream> getDiskStream() { return _diskstream; };
00100
00101 void dump();
00102 private:
00103 boost::shared_ptr<gnash::DiskStream> _diskstream;
00104 };
00105
00106 }
00107
00108
00109 #endif
00110
00111
00112
00113
00114
00115