1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 11:21:52 +00:00

add protocol stack

This commit is contained in:
winlin 2013-10-19 08:42:21 +08:00
parent fbe6e061c0
commit a323483bea
7 changed files with 117 additions and 2 deletions

2
trunk/configure vendored
View file

@ -85,7 +85,7 @@ ModuleLibIncs=(${LibSTRoot})
MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server"
"srs_core_error" "srs_core_conn" "srs_core_client" "srs_core_error" "srs_core_conn" "srs_core_client"
"srs_core_rtmp" "srs_core_socket" "srs_core_buffer" "srs_core_rtmp" "srs_core_socket" "srs_core_buffer"
"srs_core_auto_free") "srs_core_auto_free" "srs_core_protocol")
MODULE_DIR="src/core" . auto/modules.sh MODULE_DIR="src/core" . auto/modules.sh
CORE_OBJS="${MODULE_OBJS[@]}" CORE_OBJS="${MODULE_OBJS[@]}"

View file

@ -65,6 +65,13 @@ int SrsClient::do_cycle()
} }
srs_verbose("rtmp handshake success"); srs_verbose("rtmp handshake success");
SrsApp* app = NULL;
if ((ret = rtmp->connect_app(&app)) != ERROR_SUCCESS) {
srs_warn("rtmp connect vhost/app failed. ret=%d", ret);
return ret;
}
srs_verbose("rtmp connect vhost/app success");
return ret; return ret;
} }

View file

@ -0,0 +1,39 @@
/*
The MIT License (MIT)
Copyright (c) 2013 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core_protocol.hpp>
#include <srs_core_log.hpp>
#include <srs_core_error.hpp>
#include <srs_core_socket.hpp>
#include <srs_core_buffer.hpp>
SrsProtocol::SrsProtocol(st_netfd_t client_stfd)
{
stfd = client_stfd;
}
SrsProtocol::~SrsProtocol()
{
}

View file

@ -0,0 +1,45 @@
/*
The MIT License (MIT)
Copyright (c) 2013 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_CORE_PROTOCOL_HPP
#define SRS_CORE_PROTOCOL_HPP
/*
#include <srs_core_protocol.hpp>
*/
#include <srs_core.hpp>
#include <st.h>
class SrsProtocol
{
private:
st_netfd_t stfd;
public:
SrsProtocol(st_netfd_t client_stfd);
virtual ~SrsProtocol();
public:
};
#endif

View file

@ -25,17 +25,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_log.hpp> #include <srs_core_log.hpp>
#include <srs_core_error.hpp> #include <srs_core_error.hpp>
#include <srs_core_buffer.hpp>
#include <srs_core_socket.hpp> #include <srs_core_socket.hpp>
#include <srs_core_protocol.hpp>
#include <srs_core_auto_free.hpp> #include <srs_core_auto_free.hpp>
SrsRtmp::SrsRtmp(st_netfd_t client_stfd) SrsRtmp::SrsRtmp(st_netfd_t client_stfd)
{ {
protocol = new SrsProtocol(client_stfd);
stfd = client_stfd; stfd = client_stfd;
} }
SrsRtmp::~SrsRtmp() SrsRtmp::~SrsRtmp()
{ {
if (protocol) {
delete protocol;
protocol = NULL;
}
} }
int SrsRtmp::handshake() int SrsRtmp::handshake()
@ -83,3 +88,9 @@ int SrsRtmp::handshake()
return ret; return ret;
} }
int SrsRtmp::connect_app(SrsApp** papp)
{
int ret = ERROR_SUCCESS;
return ret;
}

View file

@ -30,17 +30,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp> #include <srs_core.hpp>
#include <string>
#include <st.h> #include <st.h>
struct SrsApp
{
std::string vhost;
std::string app;
};
class SrsProtocol;
class SrsRtmp class SrsRtmp
{ {
private: private:
SrsProtocol* protocol;
st_netfd_t stfd; st_netfd_t stfd;
public: public:
SrsRtmp(st_netfd_t client_stfd); SrsRtmp(st_netfd_t client_stfd);
virtual ~SrsRtmp(); virtual ~SrsRtmp();
public: public:
virtual int handshake(); virtual int handshake();
virtual int connect_app(SrsApp** papp);
}; };
#endif #endif

View file

@ -16,6 +16,8 @@ file
..\core\srs_core_client.cpp, ..\core\srs_core_client.cpp,
..\core\srs_core_rtmp.hpp, ..\core\srs_core_rtmp.hpp,
..\core\srs_core_rtmp.cpp, ..\core\srs_core_rtmp.cpp,
..\core\srs_core_protocol.hpp,
..\core\srs_core_protocol.cpp,
..\core\srs_core_socket.hpp, ..\core\srs_core_socket.hpp,
..\core\srs_core_socket.cpp, ..\core\srs_core_socket.cpp,
..\core\srs_core_buffer.hpp, ..\core\srs_core_buffer.hpp,