mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SRT: Upgrade libsrt from 1.4.1 to 1.5.1. v6.0.12 (#3362)
Co-authored-by: winlin <winlin@vip.126.com>
This commit is contained in:
parent
7a56208f2f
commit
fe086dfc31
143 changed files with 38185 additions and 15108 deletions
162
trunk/3rdparty/srt-1-fit/srtcore/channel.h
vendored
162
trunk/3rdparty/srt-1-fit/srtcore/channel.h
vendored
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* SRT - Secure, Reliable, Transport
|
||||
* Copyright (c) 2018 Haivision Systems Inc.
|
||||
*
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -50,138 +50,118 @@ modified by
|
|||
Haivision Systems Inc.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __UDT_CHANNEL_H__
|
||||
#define __UDT_CHANNEL_H__
|
||||
|
||||
#ifndef INC_SRT_CHANNEL_H
|
||||
#define INC_SRT_CHANNEL_H
|
||||
|
||||
#include "platform_sys.h"
|
||||
#include "udt.h"
|
||||
#include "packet.h"
|
||||
#include "socketconfig.h"
|
||||
#include "netinet_any.h"
|
||||
|
||||
namespace srt
|
||||
{
|
||||
|
||||
class CChannel
|
||||
{
|
||||
void createSocket(int family);
|
||||
|
||||
public:
|
||||
// XXX There's currently no way to access the socket ID set for
|
||||
// whatever the channel is currently working for. Required to find
|
||||
// some way to do this, possibly by having a "reverse pointer".
|
||||
// Currently just "unimplemented".
|
||||
std::string CONID() const { return ""; }
|
||||
|
||||
// XXX There's currently no way to access the socket ID set for
|
||||
// whatever the channel is currently working for. Required to find
|
||||
// some way to do this, possibly by having a "reverse pointer".
|
||||
// Currently just "unimplemented".
|
||||
std::string CONID() const { return ""; }
|
||||
CChannel();
|
||||
~CChannel();
|
||||
|
||||
CChannel();
|
||||
CChannel(int version);
|
||||
~CChannel();
|
||||
/// Open a UDP channel.
|
||||
/// @param [in] addr The local address that UDP will use.
|
||||
|
||||
/// Open a UDP channel.
|
||||
/// @param [in] addr The local address that UDP will use.
|
||||
void open(const sockaddr_any& addr);
|
||||
|
||||
void open(const sockaddr* addr = NULL);
|
||||
void open(int family);
|
||||
|
||||
/// Open a UDP channel based on an existing UDP socket.
|
||||
/// @param [in] udpsock UDP socket descriptor.
|
||||
/// Open a UDP channel based on an existing UDP socket.
|
||||
/// @param [in] udpsock UDP socket descriptor.
|
||||
|
||||
void attach(UDPSOCKET udpsock);
|
||||
void attach(UDPSOCKET udpsock, const sockaddr_any& adr);
|
||||
|
||||
/// Disconnect and close the UDP entity.
|
||||
/// Disconnect and close the UDP entity.
|
||||
|
||||
void close() const;
|
||||
void close() const;
|
||||
|
||||
/// Get the UDP sending buffer size.
|
||||
/// @return Current UDP sending buffer size.
|
||||
/// Get the UDP sending buffer size.
|
||||
/// @return Current UDP sending buffer size.
|
||||
|
||||
int getSndBufSize();
|
||||
int getSndBufSize();
|
||||
|
||||
/// Get the UDP receiving buffer size.
|
||||
/// @return Current UDP receiving buffer size.
|
||||
/// Get the UDP receiving buffer size.
|
||||
/// @return Current UDP receiving buffer size.
|
||||
|
||||
int getRcvBufSize();
|
||||
int getRcvBufSize();
|
||||
|
||||
/// Set the UDP sending buffer size.
|
||||
/// @param [in] size expected UDP sending buffer size.
|
||||
/// Query the socket address that the channel is using.
|
||||
/// @param [out] addr pointer to store the returned socket address.
|
||||
|
||||
void setSndBufSize(int size);
|
||||
void getSockAddr(sockaddr_any& addr) const;
|
||||
|
||||
/// Set the UDP receiving buffer size.
|
||||
/// @param [in] size expected UDP receiving buffer size.
|
||||
/// Query the peer side socket address that the channel is connect to.
|
||||
/// @param [out] addr pointer to store the returned socket address.
|
||||
|
||||
void setRcvBufSize(int size);
|
||||
void getPeerAddr(sockaddr_any& addr) const;
|
||||
|
||||
/// Set the IPV6ONLY option.
|
||||
/// @param [in] IPV6ONLY value.
|
||||
/// Send a packet to the given address.
|
||||
/// @param [in] addr pointer to the destination address.
|
||||
/// @param [in] packet reference to a CPacket entity.
|
||||
/// @return Actual size of data sent.
|
||||
|
||||
void setIpV6Only(int ipV6Only);
|
||||
int sendto(const sockaddr_any& addr, srt::CPacket& packet) const;
|
||||
|
||||
/// Query the socket address that the channel is using.
|
||||
/// @param [out] addr pointer to store the returned socket address.
|
||||
/// Receive a packet from the channel and record the source address.
|
||||
/// @param [in] addr pointer to the source address.
|
||||
/// @param [in] packet reference to a CPacket entity.
|
||||
/// @return Actual size of data received.
|
||||
|
||||
void getSockAddr(sockaddr* addr) const;
|
||||
EReadStatus recvfrom(sockaddr_any& addr, srt::CPacket& packet) const;
|
||||
|
||||
/// Query the peer side socket address that the channel is connect to.
|
||||
/// @param [out] addr pointer to store the returned socket address.
|
||||
void setConfig(const CSrtMuxerConfig& config);
|
||||
|
||||
void getPeerAddr(sockaddr* addr) const;
|
||||
/// Get the IP TTL.
|
||||
/// @param [in] ttl IP Time To Live.
|
||||
/// @return TTL.
|
||||
|
||||
/// Send a packet to the given address.
|
||||
/// @param [in] addr pointer to the destination address.
|
||||
/// @param [in] packet reference to a CPacket entity.
|
||||
/// @return Actual size of data sent.
|
||||
int getIpTTL() const;
|
||||
|
||||
int sendto(const sockaddr* addr, CPacket& packet) const;
|
||||
/// Get the IP Type of Service.
|
||||
/// @return ToS.
|
||||
|
||||
/// Receive a packet from the channel and record the source address.
|
||||
/// @param [in] addr pointer to the source address.
|
||||
/// @param [in] packet reference to a CPacket entity.
|
||||
/// @return Actual size of data received.
|
||||
int getIpToS() const;
|
||||
|
||||
EReadStatus recvfrom(sockaddr* addr, CPacket& packet) const;
|
||||
|
||||
#ifdef SRT_ENABLE_IPOPTS
|
||||
/// Set the IP TTL.
|
||||
/// @param [in] ttl IP Time To Live.
|
||||
/// @return none.
|
||||
|
||||
void setIpTTL(int ttl);
|
||||
|
||||
/// Set the IP Type of Service.
|
||||
/// @param [in] tos IP Type of Service.
|
||||
|
||||
void setIpToS(int tos);
|
||||
|
||||
/// Get the IP TTL.
|
||||
/// @param [in] ttl IP Time To Live.
|
||||
/// @return TTL.
|
||||
|
||||
int getIpTTL() const;
|
||||
|
||||
/// Get the IP Type of Service.
|
||||
/// @return ToS.
|
||||
|
||||
int getIpToS() const;
|
||||
#ifdef SRT_ENABLE_BINDTODEVICE
|
||||
bool getBind(char* dst, size_t len);
|
||||
#endif
|
||||
|
||||
int ioctlQuery(int type) const;
|
||||
int sockoptQuery(int level, int option) const;
|
||||
int ioctlQuery(int type) const;
|
||||
int sockoptQuery(int level, int option) const;
|
||||
|
||||
const sockaddr* bindAddress() { return &m_BindAddr; }
|
||||
const sockaddr_any& bindAddressAny() { return m_BindAddr; }
|
||||
const sockaddr* bindAddress() { return m_BindAddr.get(); }
|
||||
const sockaddr_any& bindAddressAny() { return m_BindAddr; }
|
||||
|
||||
private:
|
||||
void setUDPSockOpt();
|
||||
void setUDPSockOpt();
|
||||
|
||||
private:
|
||||
const int m_iIPversion; // IP version
|
||||
int m_iSockAddrSize; // socket address structure size (pre-defined to avoid run-time test)
|
||||
UDPSOCKET m_iSocket; // socket descriptor
|
||||
|
||||
UDPSOCKET m_iSocket; // socket descriptor
|
||||
#ifdef SRT_ENABLE_IPOPTS
|
||||
int m_iIpTTL;
|
||||
int m_iIpToS;
|
||||
#endif
|
||||
int m_iSndBufSize; // UDP sending buffer size
|
||||
int m_iRcvBufSize; // UDP receiving buffer size
|
||||
int m_iIpV6Only; // IPV6_V6ONLY option (-1 if not set)
|
||||
sockaddr_any m_BindAddr;
|
||||
// Mutable because when querying original settings
|
||||
// this comprises the cache for extracted values,
|
||||
// although the object itself isn't considered modified.
|
||||
mutable CSrtMuxerConfig m_mcfg; // Note: ReuseAddr is unused and ineffective.
|
||||
sockaddr_any m_BindAddr;
|
||||
};
|
||||
|
||||
} // namespace srt
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue