mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-01-12 00:04:03 +08:00
- 增加客户端模式,支持主动拉流、推流: - addStreamProxy接口新增支持whep主动拉流,拉流地址目前只兼容zlm的whep url。 - addStreamPusherProxy接口新增支持whip主动推流,推流地址目前只兼容zlm的whip url。 - 以上推流url格式为webrtc[s]://server_host:server_port/app/stream_id?key=value, 内部会自动转换为http[s]://server_host:server_port/index/api/[whip/whep]?app=app&stream=stream_id&key=value。 - 增加WebRtc p2p 模式: - 增加 ICE FULL模式。 - 增加STUN/TURN 服务器。 - 增加websocket 信令。 - 增加P2P代理拉流。 --------- Co-authored-by: xia-chu <771730766@qq.com> Co-authored-by: mtdxc <mtdxc@126.com> Co-authored-by: cqm <cqm@97kid.com>
66 lines
1.8 KiB
C++
66 lines
1.8 KiB
C++
/**
|
|
ISC License
|
|
|
|
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#ifndef MS_RTC_SRTP_SESSION_HPP
|
|
#define MS_RTC_SRTP_SESSION_HPP
|
|
|
|
#include "Util/Byte.hpp"
|
|
|
|
#include <memory>
|
|
|
|
typedef struct srtp_ctx_t_ *srtp_t;
|
|
|
|
namespace RTC {
|
|
|
|
class DepLibSRTP;
|
|
|
|
class SrtpSession {
|
|
public:
|
|
using Ptr = std::shared_ptr<SrtpSession>;
|
|
enum class CryptoSuite {
|
|
NONE = 0,
|
|
AES_CM_128_HMAC_SHA1_80 = 1,
|
|
AES_CM_128_HMAC_SHA1_32,
|
|
AEAD_AES_256_GCM,
|
|
AEAD_AES_128_GCM
|
|
};
|
|
|
|
public:
|
|
enum class Type { INBOUND = 1, OUTBOUND };
|
|
|
|
public:
|
|
SrtpSession(Type type, CryptoSuite cryptoSuite, uint8_t *key, size_t keyLen);
|
|
~SrtpSession();
|
|
|
|
public:
|
|
bool EncryptRtp(uint8_t *data, int *len);
|
|
bool DecryptSrtp(uint8_t *data, int *len);
|
|
bool EncryptRtcp(uint8_t *data, int *len);
|
|
bool DecryptSrtcp(uint8_t *data, int *len);
|
|
void RemoveStream(uint32_t ssrc);
|
|
|
|
private:
|
|
// Allocated by this.
|
|
srtp_t session { nullptr };
|
|
std::shared_ptr<DepLibSRTP> _env;
|
|
};
|
|
|
|
} // namespace RTC
|
|
|
|
#endif
|