realvod.h
来自「本人买的<<VC++项目开发实例>>源代码配套光盘.」· C头文件 代码 · 共 203 行
H
203 行
#ifndef _EXALLOW_H_
#define _EXALLOW_H_
/****************************************************************************
* Constants
*/
#define MY_PLUGIN_VERSION 0
#define MY_DESCRIPTION "Helix/RealServer Plugin"
#define MY_COPYRIGHT "讲解分析Hexlix/RealServer插件,自由版权"
#define MY_MORE_INFO_URL "http://www.real.com"
// The debugger can't handle symbols more than 255 characters long.
// STL often creates symbols longer than that.
// When symbols are longer than 255 characters, the warning is disabled.
#pragma warning(disable:4786)
#include <vector> //STL的vector
#include <string> //STL的string
using namespace std; //使用std的命名空间
/****************************************************************************
*
* CExampleAllowance Class
*
* This class inherits the minimum number of interfaces required to create
* an RMA Allowance plug-in. The IRMAPlayerConnectionAdviseSink interface
* provides notifications about significant events in a connected player's
* lifetime. The IRMAPlugin interface is required by all plug-ins to handle
* fundamental plug-in operations. Since this is a COM object, this class
* also inherits COM's IUnknown interface to handle object reference counting
* and interface query.
*/
class CExampleAllowance : public IRMAPlayerConnectionAdviseSink,
public IRMAPlugin,
public IRMAUDPResponse, //for UDP
public IRMACallback //for Heartbeat
{
public:
//关键字矢量表
typedef vector<string> STRING_VECTOR;
//授权报文结构
typedef struct tagAuthStruct
{
char szUserName[20];
char szPassword[20];
}AUTH_STRUCT;
//授权响应报文
typedef struct tagAuthRespStruct
{
UINT16 uResp;
}AUTH_RESP_STRUCT;
//计费报文结构
typedef struct tagBillingStruct
{
char szUserName[20]; //用户帐号
ULONG32 ulTimeInterval; //本次计费时长
}BILLING_STRUCT;
//计费响应结构
typedef struct tagBillingResp
{
UINT16 uResp;
}BILLING_RESP_STRUCT;
//插件的状态
typedef enum{statusNormal, statusAuthenticating
, statusHeartbeating} __STATUS;
public:
CExampleAllowance (void);
/************************************************************************
* IRMAPlayerConnectionAdviseSink Interface Methods ref: rmaallow.h
*/
STDMETHOD (OnConnection) (THIS_
IRMAPlayerConnectionResponse* pResponse);
STDMETHOD (SetPlayerController) (THIS_
IRMAPlayerController* pPlayerController);
STDMETHOD (SetRegistryID) (THIS_
UINT32 ulPlayerRegistryID);
STDMETHOD (OnURL) (THIS_
IRMARequest* pRequest);
STDMETHOD (OnBegin) (THIS);
STDMETHOD (OnPause) (THIS);
STDMETHOD (OnStop) (THIS);
STDMETHOD (OnDone) (THIS);
/************************************************************************
* IRMAPlugin Interface Methods ref: rmaplugn.h
*/
STDMETHOD(GetPluginInfo)
(THIS_
REF(BOOL) bLoadMultiple,
REF(const char*) pDescription,
REF(const char*) pCopyright,
REF(const char*) pMoreInfoURL,
REF(UINT32) versionNumber
);
STDMETHOD(InitPlugin) (THIS_ IUnknown* pContext);
/*
* IRMAUDPResponse
*
*/
STDMETHOD(ReadDone) (THIS_
PN_RESULT status,
IRMABuffer* pBuffer,
ULONG32 ulAddr,
UINT16 nPort);
/************************************************************************
* Method:
* IRMACallback::Func
* Purpose:
* This is the function that will be called when a callback is
* to be executed.
*/
STDMETHOD(Func) (THIS);
/************************************************************************
* IUnknown COM Interface Methods ref: pncom.h
*/
STDMETHOD (QueryInterface ) (THIS_ REFIID ID, void** ppInterfaceObj);
STDMETHOD_(UINT32, AddRef ) (THIS);
STDMETHOD_(UINT32, Release) (THIS);
private:
//受保护路径关键字的vector
STRING_VECTOR m_vectorProtectedDir;
STRING_VECTOR::iterator m_theIterator;
//当前插件是否在等待计费的返回报文
bool m_bWaitingBillingResp;
//用户的密码
char m_szPassword[20];
//用户帐号
char m_szUserName[20];
//从Cookie中取得用户的信息
void GetUserInfoFromCookie(const char *szCookies);
//分解字符串
char * GetStringByDelimitor(char *strDist, const char *strSource, const char *strSearchFor, const char chDelimiter);
//判断是否处于播放受保护内容
bool m_bIsCommercial;
//UDP数据缓冲接口
IRMABuffer * m_pUDPDataBuffer;
//UDP Socket接口
IRMAUDPSocket * m_pUDPSocket;
//计费函数
PN_RESULT OnBilling();
//授权超时处理
void OnAuthenticationTimeout();
//当前的插件状态
__STATUS m_stsStatus;
//计划接口
IRMAScheduler * m_pScheduler;
//设置计划
void ScheduleCallback(void);
//定时器的时长
UINT32 m_uCallbackInterval;
//Callback的句柄
CallbackHandle m_hCallback;
//错误处理接口
IRMAErrorMessages *m_pError;
//处理受保护的资源
PN_RESULT HandleProtectedURLRequest(void);
//RealSystem网络服务
IRMANetworkServices * m_pNetworkServices;
/****** Private Class Methods ******************************************/
~CExampleAllowance(void);
//处理受限的资源
PN_RESULT HandleLimitedURLRequest (void);
//处理翻转的内容
PN_RESULT HandleJukeboxURLRequest (void);
void DecrementLimitedURLCount (void);
/****** Private Class Variables ****************************************/
INT32 m_RefCount; // Object's reference count
IRMACommonClassFactory* m_pClassFactory; // Creates common RMA classes
IRMAPNRegistry* m_pRegistry; // Accesses server registry
IRMAPlayerConnectionResponse* m_pPCResponse;
IRMAPlayerController* m_pPlayerController;
// Location of player information in the server registry
UINT32 m_ulPlayerRegistryID;
IRMABuffer* m_pPlayerRegistryName;
BOOL m_bViewingLimitedURL;
/****** Private Static Class Variables *********************************/
static const char* zm_pDescription;
static const char* zm_pCopyright;
static const char* zm_pMoreInfoURL;
PRIVATE_DESTRUCTORS_ARE_NOT_A_CRIME // Avoids GCC compiler warning
};
#endif /* ifndef _EXALLOW_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?