📄 rtspclnt.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
* Version: RCSL 1.0/RPSL 1.0
*
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file, are
* subject to the current version of the RealNetworks Public Source License
* Version 1.0 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the RealNetworks Community Source License Version 1.0
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
* in which case the RCSL will apply. You may also obtain the license terms
* directly from RealNetworks. You may not use this file except in
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
* applicable to this file, the RCSL. Please see the applicable RPSL or
* RCSL for the rights, obligations and limitations governing use of the
* contents of the file.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the portions
* it created.
*
* This file, and the files included with this file, is distributed and made
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef _RTSPCLNT_H_
#define _RTSPCLNT_H_
#include "rtspif.h"
#include "rtspbase.h"
#include "rtsptran.h"
#include "rtptran.h"
#include "rtspmdsc.h"
#include "sdptypes.h" // SdpFileType
#include "hxpreftr.h"
#include "hxbufctl.h" // IHXTransportBufferLimit
#include "hxrtsp2.h"
class RTSPClientState;
class RTSPOptionsMessage;
class RTSPTeardownMessage;
class RTSPGetParamMessage;
class RTSPSetParamMessage;
class RTSPSetupMessage;
class RTSPAnnounceMessage;
class RTSPPlayMessage;
class RTSPRedirectMessage;
class RTSPParser;
class RTSPClientProtocol;
class CByteGrowingQueue;
class HXMutex;
class MIMEHeader;
struct IHXKeyValueList;
struct IHXValues;
struct IHXStreamDescription;
struct IHXPacket;
struct IHXConnectionlessControl;
struct IHXInterruptState;
#if defined(HELIX_CONFIG_NOSTATICS)
#include "globals/hxglobalptr.h"
#define RTSPClientSessionManagerType const RTSPClientSessionManager* const
#else
#define RTSPClientSessionManagerType RTSPClientSessionManager*
#endif /* defined(HELIX_CONFIG_NOSTATICS) */
typedef enum
{
ALTERNATE_SERVER,
ALTERNATE_PROXY
} ReconnectType;
typedef enum
{
ENTER_PREFETCH = 0,
LEAVE_PREFETCH,
ENTER_FASTSTART,
LEAVE_FASTSTART,
PAUSE_BUFFER,
RESUME_BUFFER
} TRANSPORT_MSG;
typedef struct _ReconnectInfo
{
CHXString m_server;
UINT32 m_ulPort;
} ReconnectInfo;
typedef struct _RTSPClientProtocolInfo
{
RTSPClientProtocol* m_pProt;
CHXSimpleList m_seqNoList;
CHXMapLongToObj m_interleaveMap;
} RTSPClientProtocolInfo;
typedef enum _RTSPIndex
{
SETUP = 0,
REDIRECT = 1,
PLAY = 2,
PAUSE = 3,
SET_PARAM = 4,
GET_PARAM = 5,
OPTIONS = 6,
DESCRIBE = 7,
TEARDOWN = 8,
RECORD = 9,
ANNOUNCE = 10
} RTSPIndex;
const UINT32 RTSP_TABLE_SIZE = 11;
struct RTSPTableEntry
{
const char* pMethod;
RTSPIndex index;
};
class RTSPTransportInfo
{
public:
RTSPTransportInfo ();
~RTSPTransportInfo ();
BOOL containsStreamNumber (UINT16 streamNumber);
void addStreamNumber (UINT16 streamNumber);
RTSPTransport* m_pTransport;
RTCPBaseTransport* m_pRTCPTransport;
UINT16 m_sPort;
UINT16 m_sResendPort;
private:
CHXSimpleList m_streamNumberList;
};
class RTSPTransportRequest
{
public:
RTSPTransportRequest (RTSPTransportTypeEnum tType, UINT16 sPort);
~RTSPTransportRequest ();
HX_RESULT addTransportInfo (RTSPTransport* pTransport,
RTCPBaseTransport* pRTCPTransport,
UINT16 streamNumber,
UINT16 sPort);
RTSPTransportInfo* getTransportInfo(UINT16 streamNumber);
void ResetTransports();
RTSPTransportInfo* getFirstTransportInfo();
RTSPTransportInfo* getNextTransportInfo();
RTSPTransportTypeEnum m_lTransportType;
UINT16 m_sPort;
UINT16 m_sResendPort;
INT8 m_tcpInterleave;
BOOL m_bDelete;
private:
CHXSimpleList m_transportInfoList;
LISTPOSITION m_lListPos;
};
class RTSPClientSession : public IHXTCPResponse,
public IHXInterruptSafe
{
public:
RTSPClientSession ();
virtual ~RTSPClientSession ();
HX_RESULT Done ();
HX_RESULT Init (IUnknown* pContext,
RTSPClientProtocol* pProt,
const char* pHostName,
UINT16 uPort,
UINT32 ulActualAddr,
BOOL bUseProxy,
BOOL bHTTPCloak,
UINT16 uCloakPort);
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj);
STDMETHOD_(ULONG32,AddRef) (THIS);
STDMETHOD_(ULONG32,Release) (THIS);
/*
* IHXTCPResponse methods
*/
STDMETHOD(ConnectDone) (THIS_
HX_RESULT status);
STDMETHOD(ReadDone) (THIS_
HX_RESULT status,
IHXBuffer* pBuffer);
STDMETHOD(WriteReady) (THIS_
HX_RESULT status);
STDMETHOD(Closed) (THIS_
HX_RESULT status);
/*
* IHXInterruptSafe methods
*/
STDMETHOD_(BOOL,IsInterruptSafe) (THIS) {return TRUE;};
HX_RESULT addProtocol (RTSPClientProtocol* pProt);
HX_RESULT removeProtocol (RTSPClientProtocol* pProt);
int getProtocolCount ();
HX_RESULT setProtocolInterleave (RTSPClientProtocol* pProt,
INT8 interleave);
HX_RESULT setProtocolSeqNo (RTSPClientProtocol* pProt,
UINT32 seqNo);
HX_RESULT removeProtocolSeqNo (RTSPClientProtocol* pProt,
UINT32 seqNo);
BOOL isEmpty ();
IHXTCPSocket* getSocket ();
HX_RESULT closeSocket ();
HX_RESULT reopenSocket (RTSPClientProtocol* pProt);
UINT32 getNextSeqNo (RTSPClientProtocol* pProt);
BOOL HttpOnly ();
BOOL m_bIgnoreSession;
BOOL m_bUseProxy;
char* m_pForeignHost;
UINT16 m_uForeignPort;
UINT32 m_ulActualAddr;
char* m_pActualHost;
UINT16 m_uActualPort;
UINT16 m_uCloakPort;
BOOL m_bReopenSocket;
IUnknown* m_pContext;
BOOL m_bHTTPOnly;
BOOL m_bChallengeDone;
BOOL m_bChallengeMet;
VOLATILE BOOL m_bIsValidChallengeT;
void ReportError(HX_RESULT);
private:
HX_RESULT handleInput (BYTE* pData, UINT32 dataLen);
RTSPClientProtocol*
findProtocolFromInterleave (INT8 interleave);
RTSPClientProtocol*
findProtocolFromSeqNo (UINT32 seqNo);
RTSPClientProtocol*
findProtocolFromSessionID (CHXString* pszSessionID);
void getSessionID (RTSPMessage* pMsg, CHXString* pszSessionID);
IHXNetworkServices* m_pNetworkServices;
IHXTCPSocket* m_pSessionSocket;
CHXSimpleList m_protList;
INT32 m_lRefCount;
UINT32 m_ulLastSeqNo;
CByteGrowingQueue* m_pInQueue;
RTSPParser* m_pParser;
BOOL m_bSessionDone;
BOOL m_bSetSessionCalled;
// used in Connect/ConnectDone
RTSPClientProtocol* m_pConnectingProt;
HXMutex* m_pMutex;
};
class RTSPClientSessionManager : public IUnknown
{
public:
~RTSPClientSessionManager();
static RTSPClientSessionManager* instance();
BOOL isValid () { return SessionManGlobal() != NULL; }
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj);
STDMETHOD_(ULONG32,AddRef) (THIS);
STDMETHOD_(ULONG32,Release) (THIS);
/*
* RTSPClientSessionManager methods
*/
virtual HX_RESULT newSession (IUnknown* pContext,
RTSPClientProtocol* pProt,
const char* pHostName,
UINT16 uPort,
UINT32 ulActualAddr,
BOOL bUseProxy,
BOOL bHTTPOnly,
UINT16 uCloakPort);
HX_RESULT removeFromSession (RTSPClientProtocol* pProt,
RTSPClientSession* pSessionRemoved);
RTSPClientSession*
findSession (UINT32 ulActualAddr,
UINT16 uActualPort,
BOOL bUseProxy,
const char* pForeignHost,
UINT16 uForeignPort,
IUnknown* pContext = NULL);
CHXSimpleList* getSessionList () { return &m_sessionList; }
int getSessionCount ();
BOOL MatchPlayerContext (IUnknown* pNewContext, IUnknown* pKnownContext);
protected:
RTSPClientSessionManager();
static RTSPClientSessionManagerType zm_pSessionManager;
static RTSPClientSessionManager*& SessionManGlobal();
HXMutex* m_pMutex;
CHXSimpleList m_sessionList;
private:
IHXResolver* m_pResolver;
INT32 m_lRefCount;
};
class RTSPClientProtocol: public RTSPBaseProtocol,
public IHXRTSPClientProtocol,
public IHXRTSPClientTransportResponse,
public IHXPendingStatus,
public IHXStatistics,
public IHXResolverResponse,
public IHXThinnableSource,
public IHXPacketResend,
public IHXInterruptSafe,
public IHXResendBufferControl,
public IHXTransportSyncServer,
public IHXTransportBufferLimit
{
public:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -