00001 #ifndef _RTSP_H_
00002 #define _RTSP_H_
00003
00004
00005 #include "session.h"
00006 #include "socket.h"
00007
00008 #include <map>
00009 #include <list>
00010 #include <string>
00011 #include <iostream>
00012
00013 using namespace std;
00014
00015 class _Request {
00016 public:
00017 _Request(const string &req);
00018 inline const string &get_method(void) {
00019 return method;
00020 }
00021 inline const string &get_uri(void) {
00022 return uri;
00023 }
00024 inline const map<string, string> &get_fields(void) {
00025 return fields;
00026 }
00027 protected:
00028 string method;
00029 string uri;
00030 map<string, string> fields;
00031 };
00032
00033 class _Responce {
00034 public:
00035 enum status {STATUS_EMPTY, STATUS_BUSY, STATUS_OK};
00036 _Responce():_status(STATUS_EMPTY) {};
00037 inline void set_status(status st) {
00038 _status = st;
00039 }
00040 void add_field(const string &name, const string &value);
00041 void add_include(const string &include);
00042 string serialize(void);
00043 protected:
00044 status _status;
00045 map<string, string> fields;
00046 string include;
00047 };
00048
00049 class RTSP_Server {
00050 public:
00051 enum event {
00052 EMPTY,
00053 DESCRIBE,
00054 PLAY,
00055 PAUSE,
00056 TEARDOWN,
00057 IS_DAEMON_ENABLED
00058 };
00059
00060
00061 RTSP_Server(int (*h)(void *, RTSP_Server *, RTSP_Server::event), void *handler_data, Session *_session = NULL);
00062 ~RTSP_Server();
00063
00064
00065 void main(void);
00066 protected:
00067 bool process(Socket *s);
00068 string make_sdp(string uri);
00069 string make_transport(string req);
00070 Session *session;
00071
00072 int (*handler_f)(void *, RTSP_Server *, RTSP_Server::event);
00073 void *handler_data;
00074 int handler(RTSP_Server::event event) {
00075 return handler_f(handler_data, this, event);
00076 }
00077 void *_busy;
00078
00079 string part_of_request;
00080
00081
00082 };
00083
00084 #endif // _RTSP_H_