winlin

merge handshake to protocol

@@ -516,8 +516,8 @@ if [ $SRS_LIBRTMP = YES ]; then @@ -516,8 +516,8 @@ if [ $SRS_LIBRTMP = YES ]; then
516 fi 516 fi
517 # 517 #
518 # utest, the unit-test cases of srs, base on gtest1.6 518 # utest, the unit-test cases of srs, base on gtest1.6
519 -MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_handshake"  
520 - "srs_utest_protocol" "srs_utest_kernel" "srs_utest_core") 519 +MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol"
  520 + "srs_utest_kernel" "srs_utest_core")
521 ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot}) 521 ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot})
522 ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile}) 522 ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile})
523 MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") 523 MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
@@ -116,8 +116,6 @@ file @@ -116,8 +116,6 @@ file
116 ..\utest\srs_utest_amf0.cpp, 116 ..\utest\srs_utest_amf0.cpp,
117 ..\utest\srs_utest_core.hpp, 117 ..\utest\srs_utest_core.hpp,
118 ..\utest\srs_utest_core.cpp, 118 ..\utest\srs_utest_core.cpp,
119 - ..\utest\srs_utest_handshake.hpp,  
120 - ..\utest\srs_utest_handshake.cpp,  
121 ..\utest\srs_utest_kernel.hpp, 119 ..\utest\srs_utest_kernel.hpp,
122 ..\utest\srs_utest_kernel.cpp, 120 ..\utest\srs_utest_kernel.cpp,
123 ..\utest\srs_utest_protocol.hpp, 121 ..\utest\srs_utest_protocol.hpp,
1 -/*  
2 -The MIT License (MIT)  
3 -  
4 -Copyright (c) 2013-2014 winlin  
5 -  
6 -Permission is hereby granted, free of charge, to any person obtaining a copy of  
7 -this software and associated documentation files (the "Software"), to deal in  
8 -the Software without restriction, including without limitation the rights to  
9 -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of  
10 -the Software, and to permit persons to whom the Software is furnished to do so,  
11 -subject to the following conditions:  
12 -  
13 -The above copyright notice and this permission notice shall be included in all  
14 -copies or substantial portions of the Software.  
15 -  
16 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
17 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS  
18 -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR  
19 -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER  
20 -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN  
21 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
22 -*/  
23 -  
24 -#ifndef SRS_UTEST_HANDSHAKE_HPP  
25 -#define SRS_UTEST_HANDSHAKE_HPP  
26 -  
27 -/*  
28 -#include <srs_utest_handshake.hpp>  
29 -*/  
30 -#include <srs_utest.hpp>  
31 -  
32 -#include <srs_protocol_rtmp.hpp>  
33 -#include <srs_protocol_handshake.hpp>  
34 -  
35 -#ifdef SRS_AUTO_SSL  
36 -using namespace srs;  
37 -#endif  
38 -  
39 -#include <srs_protocol_io.hpp>  
40 -  
41 -class MockEmptyIO : public ISrsProtocolReaderWriter  
42 -{  
43 -public:  
44 - MockEmptyIO();  
45 - virtual ~MockEmptyIO();  
46 -// for protocol  
47 -public:  
48 - virtual bool is_never_timeout(int64_t timeout_us);  
49 -// for handshake.  
50 -public:  
51 - virtual int read_fully(void* buf, size_t size, ssize_t* nread);  
52 - virtual int write(void* buf, size_t size, ssize_t* nwrite);  
53 -// for protocol  
54 -public:  
55 - virtual void set_recv_timeout(int64_t timeout_us);  
56 - virtual int64_t get_recv_timeout();  
57 - virtual int64_t get_recv_bytes();  
58 -// for protocol  
59 -public:  
60 - virtual void set_send_timeout(int64_t timeout_us);  
61 - virtual int64_t get_send_timeout();  
62 - virtual int64_t get_send_bytes();  
63 - virtual int writev(const iovec *iov, int iov_size, ssize_t* nwrite);  
64 -// for protocol/amf0/msg-codec  
65 -public:  
66 - virtual int read(void* buf, size_t size, ssize_t* nread);  
67 -};  
68 -  
69 -#endif  
@@ -32,4 +32,41 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -32,4 +32,41 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 #include <string> 32 #include <string>
33 #include <srs_protocol_utility.hpp> 33 #include <srs_protocol_utility.hpp>
34 34
  35 +#include <srs_protocol_rtmp.hpp>
  36 +#include <srs_protocol_handshake.hpp>
  37 +
  38 +#ifdef SRS_AUTO_SSL
  39 +using namespace srs;
  40 +#endif
  41 +
  42 +#include <srs_protocol_io.hpp>
  43 +
  44 +class MockEmptyIO : public ISrsProtocolReaderWriter
  45 +{
  46 +public:
  47 + MockEmptyIO();
  48 + virtual ~MockEmptyIO();
  49 +// for protocol
  50 +public:
  51 + virtual bool is_never_timeout(int64_t timeout_us);
  52 +// for handshake.
  53 +public:
  54 + virtual int read_fully(void* buf, size_t size, ssize_t* nread);
  55 + virtual int write(void* buf, size_t size, ssize_t* nwrite);
  56 +// for protocol
  57 +public:
  58 + virtual void set_recv_timeout(int64_t timeout_us);
  59 + virtual int64_t get_recv_timeout();
  60 + virtual int64_t get_recv_bytes();
  61 +// for protocol
  62 +public:
  63 + virtual void set_send_timeout(int64_t timeout_us);
  64 + virtual int64_t get_send_timeout();
  65 + virtual int64_t get_send_bytes();
  66 + virtual int writev(const iovec *iov, int iov_size, ssize_t* nwrite);
  67 +// for protocol/amf0/msg-codec
  68 +public:
  69 + virtual int read(void* buf, size_t size, ssize_t* nread);
  70 +};
  71 +
35 #endif 72 #endif