mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
extract core and app module.
This commit is contained in:
parent
62fbe9e760
commit
4e91a3d5aa
18 changed files with 99 additions and 20 deletions
5
trunk/configure
vendored
5
trunk/configure
vendored
|
@ -124,7 +124,7 @@ fi
|
||||||
#Core Module
|
#Core Module
|
||||||
MODULE_ID="CORE"
|
MODULE_ID="CORE"
|
||||||
MODULE_DEPENDS=()
|
MODULE_DEPENDS=()
|
||||||
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS})
|
ModuleLibIncs=(${SRS_OBJS})
|
||||||
MODULE_FILES=("srs_core")
|
MODULE_FILES=("srs_core")
|
||||||
MODULE_DIR="src/core" . auto/modules.sh
|
MODULE_DIR="src/core" . auto/modules.sh
|
||||||
CORE_OBJS="${MODULE_OBJS[@]}"
|
CORE_OBJS="${MODULE_OBJS[@]}"
|
||||||
|
@ -141,7 +141,8 @@ MODULE_FILES=("srs_core_log" "srs_core_server"
|
||||||
"srs_core_handshake" "srs_core_pithy_print"
|
"srs_core_handshake" "srs_core_pithy_print"
|
||||||
"srs_core_config" "srs_core_refer" "srs_core_reload"
|
"srs_core_config" "srs_core_refer" "srs_core_reload"
|
||||||
"srs_core_hls" "srs_core_forward" "srs_core_encoder"
|
"srs_core_hls" "srs_core_forward" "srs_core_encoder"
|
||||||
"srs_core_http" "srs_core_thread" "srs_core_bandwidth")
|
"srs_core_http" "srs_core_thread" "srs_core_bandwidth"
|
||||||
|
"srs_core_st")
|
||||||
MODULE_DIR="src/app" . auto/modules.sh
|
MODULE_DIR="src/app" . auto/modules.sh
|
||||||
APP_OBJS="${MODULE_OBJS[@]}"
|
APP_OBJS="${MODULE_OBJS[@]}"
|
||||||
#
|
#
|
||||||
|
|
|
@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <srs_core.hpp>
|
#include <srs_core.hpp>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
|
|
||||||
class SrsRequest;
|
class SrsRequest;
|
||||||
class SrsRtmp;
|
class SrsRtmp;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <srs_core.hpp>
|
#include <srs_core.hpp>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
#include <srs_core_conn.hpp>
|
#include <srs_core_conn.hpp>
|
||||||
#include <srs_core_reload.hpp>
|
#include <srs_core_reload.hpp>
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <srs_core.hpp>
|
#include <srs_core.hpp>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
|
|
||||||
class SrsServer;
|
class SrsServer;
|
||||||
class SrsConnection
|
class SrsConnection
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
#include <srs_core_thread.hpp>
|
#include <srs_core_thread.hpp>
|
||||||
|
|
||||||
class SrsSharedPtrMessage;
|
class SrsSharedPtrMessage;
|
||||||
|
|
|
@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <srs_core.hpp>
|
#include <srs_core.hpp>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
|
|
||||||
#ifdef SRS_HTTP
|
#ifdef SRS_HTTP
|
||||||
|
|
||||||
class SrsRequest;
|
class SrsRequest;
|
||||||
|
|
|
@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include <st.h>
|
||||||
|
|
||||||
ILogContext::ILogContext()
|
ILogContext::ILogContext()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
#include <srs_core_log.hpp>
|
#include <srs_core_log.hpp>
|
||||||
#include <srs_core_error.hpp>
|
#include <srs_core_error.hpp>
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
|
|
||||||
class SrsProtocol;
|
class SrsProtocol;
|
||||||
class ISrsMessage;
|
class ISrsMessage;
|
||||||
class SrsCommonMessage;
|
class SrsCommonMessage;
|
||||||
|
|
|
@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
#include <srs_core_reload.hpp>
|
#include <srs_core_reload.hpp>
|
||||||
#include <srs_core_thread.hpp>
|
#include <srs_core_thread.hpp>
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <srs_core.hpp>
|
#include <srs_core.hpp>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the socket provides TCP socket over st,
|
* the socket provides TCP socket over st,
|
||||||
* that is, the sync socket mechanism.
|
* that is, the sync socket mechanism.
|
||||||
|
|
|
@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
#include <srs_core_reload.hpp>
|
#include <srs_core_reload.hpp>
|
||||||
|
|
||||||
class SrsSource;
|
class SrsSource;
|
||||||
|
|
37
trunk/src/app/srs_core_st.cpp
Normal file
37
trunk/src/app/srs_core_st.cpp
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014 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_st.hpp>
|
||||||
|
|
||||||
|
void srs_close_stfd(st_netfd_t& stfd)
|
||||||
|
{
|
||||||
|
if (stfd) {
|
||||||
|
int fd = st_netfd_fileno(stfd);
|
||||||
|
st_netfd_close(stfd);
|
||||||
|
stfd = NULL;
|
||||||
|
|
||||||
|
// st does not close it sometimes,
|
||||||
|
// close it manually.
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
}
|
38
trunk/src/app/srs_core_st.hpp
Normal file
38
trunk/src/app/srs_core_st.hpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014 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_ST_HPP
|
||||||
|
#define SRS_CORE_ST_HPP
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <srs_core.hpp>
|
||||||
|
|
||||||
|
#include <st.h>
|
||||||
|
|
||||||
|
// close the netfd, and close the underlayer fd.
|
||||||
|
extern void srs_close_stfd(st_netfd_t& stfd);
|
||||||
|
|
||||||
|
#endif
|
|
@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <srs_core.hpp>
|
#include <srs_core.hpp>
|
||||||
|
|
||||||
|
#include <srs_core_st.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the handler for the thread, callback interface.
|
* the handler for the thread, callback interface.
|
||||||
* the thread model defines as:
|
* the thread model defines as:
|
||||||
|
|
|
@ -109,16 +109,3 @@ void srs_vhost_resolve(std::string& vhost, std::string& app)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void srs_close_stfd(st_netfd_t& stfd)
|
|
||||||
{
|
|
||||||
if (stfd) {
|
|
||||||
int fd = st_netfd_fileno(stfd);
|
|
||||||
st_netfd_close(stfd);
|
|
||||||
stfd = NULL;
|
|
||||||
|
|
||||||
// st does not close it sometimes,
|
|
||||||
// close it manually.
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <st.h>
|
|
||||||
|
|
||||||
// generated by configure.
|
// generated by configure.
|
||||||
#include <srs_auto_headers.hpp>
|
#include <srs_auto_headers.hpp>
|
||||||
|
|
||||||
|
@ -104,9 +102,6 @@ extern std::string srs_dns_resolve(std::string host);
|
||||||
// app...vhost...request_vhost
|
// app...vhost...request_vhost
|
||||||
extern void srs_vhost_resolve(std::string& vhost, std::string& app);
|
extern void srs_vhost_resolve(std::string& vhost, std::string& app);
|
||||||
|
|
||||||
// close the netfd, and close the underlayer fd.
|
|
||||||
extern void srs_close_stfd(st_netfd_t& stfd);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* disable copy constructor of class
|
* disable copy constructor of class
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -52,6 +52,8 @@ file
|
||||||
..\app\srs_core_thread.cpp,
|
..\app\srs_core_thread.cpp,
|
||||||
..\app\srs_core_server.hpp,
|
..\app\srs_core_server.hpp,
|
||||||
..\app\srs_core_server.cpp,
|
..\app\srs_core_server.cpp,
|
||||||
|
..\app\srs_core_st.hpp,
|
||||||
|
..\app\srs_core_st.cpp,
|
||||||
..\app\srs_core_stream.hpp,
|
..\app\srs_core_stream.hpp,
|
||||||
..\app\srs_core_stream.cpp,
|
..\app\srs_core_stream.cpp,
|
||||||
..\app\srs_core_socket.hpp,
|
..\app\srs_core_socket.hpp,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue