2013-11-23 03:36:07 +00:00
|
|
|
/*
|
|
|
|
The MIT License (MIT)
|
|
|
|
|
2014-01-01 02:37:12 +00:00
|
|
|
Copyright (c) 2013-2014 winlin
|
2013-11-23 03:36:07 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2014-03-01 06:09:22 +00:00
|
|
|
#ifndef SRS_RTMP_PROTOCOL_HANDSHKAE_HPP
|
|
|
|
#define SRS_RTMP_PROTOCOL_HANDSHKAE_HPP
|
2013-11-23 03:36:07 +00:00
|
|
|
|
|
|
|
/*
|
2014-03-01 06:03:02 +00:00
|
|
|
#include <srs_protocol_handshake.hpp>
|
2013-11-23 03:36:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <srs_core.hpp>
|
|
|
|
|
2014-03-01 04:43:04 +00:00
|
|
|
class ISrsProtocolReaderWriter;
|
2013-11-23 03:36:07 +00:00
|
|
|
class SrsComplexHandshake;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* try complex handshake, if failed, fallback to simple handshake.
|
|
|
|
*/
|
|
|
|
class SrsSimpleHandshake
|
|
|
|
{
|
|
|
|
public:
|
2014-03-18 03:32:58 +00:00
|
|
|
SrsSimpleHandshake();
|
|
|
|
virtual ~SrsSimpleHandshake();
|
2013-11-23 03:36:07 +00:00
|
|
|
public:
|
2014-03-18 03:32:58 +00:00
|
|
|
/**
|
|
|
|
* simple handshake.
|
|
|
|
* @param complex_hs, try complex handshake first,
|
|
|
|
* if NULL, use simple handshake.
|
|
|
|
* if failed, rollback to simple handshake.
|
|
|
|
*/
|
|
|
|
virtual int handshake_with_client(ISrsProtocolReaderWriter* io, SrsComplexHandshake* complex_hs);
|
|
|
|
virtual int handshake_with_server(ISrsProtocolReaderWriter* io, SrsComplexHandshake* complex_hs);
|
2013-11-23 03:36:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* rtmp complex handshake,
|
|
|
|
* @see also crtmp(crtmpserver) or librtmp,
|
|
|
|
* @see also: http://blog.csdn.net/win_lin/article/details/13006803
|
|
|
|
*/
|
|
|
|
class SrsComplexHandshake
|
|
|
|
{
|
|
|
|
public:
|
2014-03-18 03:32:58 +00:00
|
|
|
SrsComplexHandshake();
|
|
|
|
virtual ~SrsComplexHandshake();
|
2013-11-23 03:36:07 +00:00
|
|
|
public:
|
2014-03-18 03:32:58 +00:00
|
|
|
/**
|
|
|
|
* complex hanshake.
|
|
|
|
* @_c1, size of c1 must be 1536.
|
|
|
|
* @remark, user must free the c1.
|
|
|
|
* @return user must:
|
|
|
|
* continue connect app if success,
|
|
|
|
* try simple handshake if error is ERROR_RTMP_TRY_SIMPLE_HS,
|
|
|
|
* otherwise, disconnect
|
|
|
|
*/
|
|
|
|
virtual int handshake_with_client(ISrsProtocolReaderWriter* io, char* _c1);
|
|
|
|
virtual int handshake_with_server(ISrsProtocolReaderWriter* io);
|
2013-11-23 03:36:07 +00:00
|
|
|
};
|
|
|
|
|
2013-10-24 23:15:33 +00:00
|
|
|
#endif
|