00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _RTMPMSG_H_
00020 #define _RTMPMSG_H_
00021
00022 #include <boost/cstdint.hpp>
00023 #include <string>
00024 #include <vector>
00025
00026 #include "amf.h"
00027 #include "rtmp.h"
00028 #include "element.h"
00029 #include "network.h"
00030 #include "buffer.h"
00031
00032 namespace gnash
00033 {
00034
00035 class RTMPMsg
00036 {
00037 public:
00038 typedef enum {
00039 APP_GC,
00040 APP_RESOURCE_LOWMEMORY,
00041 APP_SCRIPT_ERROR,
00042 APP_SCRIPT_WARNING,
00043 APP_SHUTDOWN,
00044 NC_CALL_BADVERSION,
00045 NC_CALL_FAILED,
00046 NC_CONNECT_APPSHUTDOWN,
00047 NC_CONNECT_CLOSED,
00048 NC_CONNECT_FAILED,
00049 NC_CONNECT_INVALID_APPLICATION,
00050 NC_CONNECT_REJECTED,
00051 NC_CONNECT_SUCCESS,
00052 NS_CLEAR_FAILED,
00053 NS_CLEAR_SUCCESS,
00054 NS_DATA_START,
00055 NS_FAILED,
00056 NS_INVALID_ARGUMENT,
00057 NS_PAUSE_NOTIFY,
00058 NS_PLAY_COMPLETE,
00059 NS_PLAY_FAILED,
00060 NS_PLAY_FILE_STRUCTURE_INVALID,
00061 NS_PLAY_INSUFFICIENT_BW,
00062 NS_PLAY_NO_SUPPORTED_TRACK_FOUND,
00063 NS_PLAY_PUBLISHNOTIFY,
00064 NS_PLAY_RESET,
00065 NS_PLAY_START,
00066 NS_PLAY_STOP,
00067 NS_PLAY_STREAMNOTFOUND,
00068 NS_PLAY_SWITCH,
00069 NS_PLAY_UNPUBLISHNOTIFY,
00070 NS_PUBLISH_BADNAME,
00071 NS_PUBLISH_START,
00072 NS_RECORD_FAILED,
00073 NS_RECORD_NOACCESS,
00074 NS_RECORD_START,
00075 NS_RECORD_STOP,
00076 NS_SEEK_FAILED,
00077 NS_SEEK_NOTIFY,
00078 NS_UNPAUSE_NOTIFY,
00079 NS_UNPUBLISHED_SUCCESS,
00080 SO_CREATION_FAILED,
00081 SO_NO_READ_ACCESS,
00082 SO_NO_WRITE_ACCESS,
00083 SO_PERSISTENCE_MISMATCH,
00084
00085 NS_CREATE_STREAM,
00086 NS_DELETE_STREAM
00087 } rtmp_status_e;
00088 typedef enum {
00089 FROM_CLIENT,
00090 FROM_SERVER
00091 } rtmp_source_e;
00092 RTMPMsg();
00093 ~RTMPMsg();
00094
00095 void addObject(boost::shared_ptr<cygnal::Element> el) { _amfobjs.push_back(el); };
00096 size_t size() { return _amfobjs.size(); };
00097 std::vector<boost::shared_ptr<cygnal::Element> > getElements() { return _amfobjs; };
00098
00099 void setMethodName(const std::string &name) { _method = name; } ;
00100 std::string &getMethodName() { return _method; };
00101
00102 void setTransactionID(double num) { _transid = num; };
00103 double getTransactionID() { return _transid; };
00104
00105 rtmp_status_e checkStatus(boost::shared_ptr<cygnal::Element> el);
00106 void setStatus(rtmp_status_e st) { _status = st; };
00107 rtmp_status_e getStatus() { return _status; };
00108
00109 void setChannel(boost::uint8_t num) { _channel = num; };
00110 boost::uint8_t getChannel() { return _channel; } ;
00111
00112 boost::shared_ptr<cygnal::Element> operator[](size_t x);
00113 boost::shared_ptr<cygnal::Element> at(size_t x) { return _amfobjs[x]; };
00114
00121 DSOEXPORT boost::shared_ptr<cygnal::Element> findProperty(const std::string &name);
00122
00123
00124
00125
00126 DSOEXPORT void dump();
00127
00128 protected:
00129 rtmp_source_e _routing;
00130 rtmp_status_e _status;
00131 std::string _method;
00132 double _transid;
00133 std::vector<boost::shared_ptr<cygnal::Element> > _amfobjs;
00134 boost::uint8_t _channel;
00135 };
00136
00137 }
00138
00139 #endif
00140
00141
00142
00143
00144
00145