• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

echo.h

Go to the documentation of this file.
00001 // Red5 server side support for the echo_test via RTMP
00002 // 
00003 //   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef _ECHO_H_
00020 #define _ECHO_H_
00021 
00022 #include <vector>
00023 #include <boost/shared_ptr.hpp>
00024 #include <boost/shared_array.hpp>
00025 #include <boost/scoped_array.hpp>
00026 #include <sstream>
00027 
00028 // gnash headers
00029 #include "amf.h"
00030 #include "buffer.h"
00031 #include "element.h"
00032 #include "http.h"
00033 #include "cygnal.h"
00034 
00035 // cygnal headers
00036 #include "rtmp_server.h"
00037 #include "handler.h"
00038 
00039 namespace cygnal
00040 {
00041     
00042 class EchoTest : public cygnal::RTMPServer
00043 {
00044 public:
00045     EchoTest ();
00046     ~EchoTest ();
00047   
00048     // Parse an Echo Request message coming from the Red5 echo_test.
00049     std::vector<boost::shared_ptr<cygnal::Element > > parseEchoRequest(cygnal::Buffer &buf)
00050         { return parseEchoRequest(buf.reference(), buf.size()); };
00051     std::vector<boost::shared_ptr<cygnal::Element > > parseEchoRequest(boost::uint8_t *buf, size_t size);
00052     
00053     // format a response to the 'echo' test used for testing Gnash.
00054     boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num, cygnal::Element &el);
00055     boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num, cygnal::Buffer &data);
00056     boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num, boost::uint8_t *data, size_t size);
00057 
00058     boost::shared_ptr<cygnal::Buffer> getResponse() { return _response; };
00059     void setResponse(boost::shared_ptr<cygnal::Buffer> &x) { _response = x; };
00060 
00061     void setNetConnection(gnash::RTMPMsg *msg) { _netconnect.reset(msg); };
00062     void setNetConnection(boost::shared_ptr<gnash::RTMPMsg> msg) { _netconnect = msg; };
00063     boost::shared_ptr<gnash::RTMPMsg> getNetConnection() { return _netconnect;};
00064     
00065 private:
00066     boost::shared_ptr<cygnal::Buffer> _response;    
00067     boost::shared_ptr<Handler::cygnal_init_t> _info;
00073     boost::shared_ptr<gnash::RTMPMsg>   _netconnect;    
00074 };  
00075 
00076 // the standard API
00077 extern "C" {
00078     boost::shared_ptr<Handler::cygnal_init_t>echo_init_func(boost::shared_ptr<gnash::RTMPMsg> &msg);
00079     
00080     boost::shared_ptr<cygnal::Buffer> echo_read_func();
00081     size_t echo_write_func(boost::uint8_t *data, size_t size);
00082 }
00083 
00084 } // end of cygnal namespace
00085 #endif  // end of __ECHO_H__
00086 
00087 // local Variables:
00088 // mode: C++
00089 // indent-tabs-mode: t
00090 // End:

Generated on Fri Mar 16 2012 15:46:09 for Gnash by  doxygen 1.7.1