⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rmappv.pas

📁 Delphi源码REAlRMSDK.rar
💻 PAS
字号:
unit RmaPpv;

interface

uses
  PnTypes;

//***************************************************************************
//
//  $Id: rmappv.h,v 1.6 1999/04/03 17:26:12 sehancher Exp $
//
//  Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.
//
//  http://www.real.com/devzone
//
//  This program contains proprietary information of RealNetworks, Inc.,
//  and is licensed subject to restrictions on use and distribution.
//
//  RealMedia Architecture Interfaces for pay-per-view database plugins
//
//

//
// Structures and definitions for PPVPermission
//

const
  PPV_MAX_URL_LEN = 2048;
  {$EXTERNALSYM PPV_MAX_URL_LEN}

type
  _PPVURLType = (PPV_URL_TYPE_FILE, PPV_URL_TYPE_DIRECTORY);
  {$EXTERNALSYM _PPVURLType}
  PPVURLType = _PPVURLType;
  {$EXTERNALSYM PPVURLType}

  _PPVPermissionType = (PPV_PERMISSION_GENERAL, PPV_PERMISSION_EXPIRES,
    PPV_PERMISSION_DEBIT, PPV_PERMISSION_CREDIT, PPV_PERMISSION_NONE);
  {$EXTERNALSYM _PPVPermissionType}
  PPVPermissionType =_PPVPermissionType;
  {$EXTERNALSYM PPVPermissionType}

  time_t = Longint;

  _PPVPermission = record
    pURL: array [0..PPV_MAX_URL_LEN - 1] of Char;
    nURLType: PPVURLType;
    nPermissionType: PPVPermissionType;
    tExpires: time_t;
    ulDebitTime: UINT32;
  end;
  {$EXTERNALSYM _PPVPermission}
  PPVPermission = _PPVPermission;
  {$EXTERNALSYM PPVPermission}

//
// Structures and definitions for PPVAccessLog
//

  _PPVAccessPermissionOn = (PPV_PERMISSION_ON_FILE, PPV_PERMISSION_ON_DIRECTORY, PPV_PERMISSION_ON_NONE);
  {$EXTERNALSYM _PPVAccessPermissionOn}
  PPVAccessPermissionOn = _PPVAccessPermissionOn;
  {$EXTERNALSYM PPVAccessPermissionOn}

  _PPVAccessDisconnectType = (PPV_DISCONNECT_CLIENT, PPV_DISCONNECT_TIME_EXPIRED);
  {$EXTERNALSYM _PPVAccessDisconnectType}
  PPVAccessDisconnectType = _PPVAccessDisconnectType;
  {$EXTERNALSYM PPVAccessDisconnectType}

  time_t = longint;

  _PPVAccessLog = record
    bAccessGranted: BOOL;
    pUserid: PChar;
    pGUID: PChar;
    pIPAddress: PChar;
    pURL: PChar;
    nPermissionType: PPVPermissionType;
    nPermOn: PPVAccessPermissionOn;
    tStartTime: time_t;
    tStopTime: time_t;
    lTotalTime: Cardinal;
    nWhyDisconnect: PPVAccessDisconnectType;
  end;
  {$EXTERNALSYM _PPVAccessLog}
  PPVAccessLog = _PPVAccessLog;
  {$EXTERNALSYM PPVAccessLog}

//
// Structures and definitions for PPVRegLog
//

  _PPVRegStatus = (PPV_GUID_REG_SUCCESS, PPV_GUID_REG_FAILED_LOCKED, PPV_GUID_REG_FAILED_COLLISION,
    PPV_GUID_REG_FAILED_OLD_PLAYER, PPV_GUID_REG_FAILED_NO_USER, PPV_GUID_REG_FAILED);
  {$EXTERNALSYM _PPVRegStatus}
  PPVRegStatus = _PPVRegStatus;
  {$EXTERNALSYM PPVRegStatus}

  time_t = Longint;

  _PPVRegLog = record
    nStatus: PPVRegStatus;
    pUserid: PChar;
    pGUID: PChar;
    pIPAddress: PChar;
    tRequestTime: time_t;
    pURLRedirect: PChar;
  end;
  {$EXTERNALSYM _PPVRegLog}
  PPVRegLog = _PPVRegLog;
  {$EXTERNALSYM PPVRegLog}

//***************************************************************************
//
//  Interface:
//
//	IRMAPPVDatabase
//
//  Purpose:
//	This interface provides access to a backend database used to store
//	information related to the server's pay-per-view feature.
//
//  IID_IRMAPPVDatabase:
//
//	{00001d00-0901-11d1-8B06-00A024406D59}
//
//

const
  IID_IRMAPPVDatabase: TGUID = '{00001d00-0901-11d1-8B06-00A024406D59}';
  {$EXTERNALSYM IID_IRMAPPVDatabase}

type
  IRMAPPVDatabase = interface (IUnknown)
  ['{00001d00-0901-11d1-8B06-00A024406D59}']

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::InitPPVDB
    //	Purpose:
    //	    Open & Initialize the PPV Database.
    //	    This function will called once per instance before any other
    //	    methods are called.
    //
    // pDBName			Name of the database (if supported)
    // pUserID			User ID to access database (if supported)
    // pPassword		Password to access database (if supported)
    //

    function InitPPVDB(pDBName, pUserID, pPassword: PChar): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::GetPPVDBInfo
    //	Purpose:
    //	    Get this databases short name.
    //	    This unique identifier is used to identify this database plugin.
    //	    It should be unique enough that no other plugin will ever have
    //	    the same plugin name.
    //

    function GetPPVDBInfo(out pShortName: PChar): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::InsertUser
    //	Purpose:
    //	    Inserts a user into the database (the user should not already
    //	    exist).
    //
    //	    pUserid		Userid key of the record to insert
    //	    pPasswordCipher	Optional Password to associate with this user;
    //				The password being passed in is already
    //				encrypted.
    //

    function InsertUser(pUserid, pPasswordCipher: PChar): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::RemoveUser
    //	Purpose:
    //	    Removes a user from the database.
    //
    //	    pUserid		Userid key of the record
    //

    function RemoveUser(pUserid: PChar): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::RegisterGUID
    //	Purpose:
    //	    Registers a GUID to be associated with the pUserid
    //
    //	    pUserid		Userid key of the record
    //	    pGUID		GUID to associate with user record
    //	    bForce		Forces registration of guid, even if
    // 			the uuid_writeable flag is set to read only
    //

    function RegisterGUID(pUserid, pGUID: PChar; bForce: BOOL): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::SetPassword
    //	Purpose:
    //	    Sets the password for the user associated with pUserid
    //
    //	    pUserid		Userid key of the record
    //	    pCipherPassword	User's Password
    //

    function SetPassword(pUserid, pCipherPassword: PChar): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::ValidateUser
    //	Purpose:
    //	    Sets the password for the user associated with pUserid
    //
    //	    pUserid		Userid key of the record
    //	    pPPVPermission	Permission structure with URL to validate on
    //

    function ValidateUser(pUserid: PChar; const pPPVPermission: PPVPermission): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::GrantPermission
    //	Purpose:
    //	    Adds a permission record.
    //
    //	    pUserid		Userid key of the record
    //	    pPPVPermission	Permission structure with URL
    //

    function GrantPermission(pUserid: PChar; const pPPVPermission: PPVPermission): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::RevokePermission
    //	Purpose:
    //	    Removes a permission record.
    //
    //	    pUserid		Userid key of the record
    //	    pPPVPermission	Permission structure with URL
    //

    function RevokePermission(pUserid: PChar; const pPPVPermission: PPVPermission): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::RevokeAllPermissions
    //	Purpose:
    //	    Removes all permission records for a user.
    //
    //	    pUserid		Userid key of the record
    //

    function RevokeAllPermissions(pUserid: PChar): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::GetRedirect
    //	Purpose:
    //	    Gets the redirection Url corresponding to the requested Url
    //	    from the database.
    //
    //	    pURL		Url key of redirect record (In)
    //	    pURLRedirect	Url to redirect to (Out)
    //	    ulURLRedirectLen	Maximum length of pURLRedirect (In)
    //

    function GetRedirect(pURL, pURLRedirect: PChar; ulURLRedirectLen: UINT32): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::PutRedirect
    //	Purpose:
    //	    Adds a redirection Url to the database to correspond with
    //	    the Url key.
    //
    //
    //	    pURL		Url key of redirect record (In)
    //	    pURLRedirect	Url to redirect to (In)
    //

    function PutRedirect(pURL, pURLRedirect: PChar): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::GrantTime
    //	Purpose:
    //	    Grants a user time to view (specified by pPPVPermission).
    //
    //	    pUserid		Userid key of the record
    //	    pPPVPermission	Permission structure with URL
    //	    ulGrant		Amount of time to grant
    //

    function GrantTime(pUserid: PChar; const pPPVPermission: PPVPermission; ulGrant: UINT32): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::DeductTime
    //	Purpose:
    //	    Deducts a user time to view (specified by pPPVPermission).
    //
    //	    pUserid		Userid key of the record
    //	    pPPVPermission	Permission structure with URL
    //	    ulDeduct		Amount of time to deduct
    //

    function DeductTime(pUserid: PChar; const pPPVPermission: PPVPermission; ulDeduct: UINT32): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::GetPasswordFromUserid
    //	Purpose:
    //	    Get's a users password
    //
    //	    pUserid		Userid key of the record (In)
    //	    pCipherPassword	Password to get (Out)
    //	    ulCipherPasswordLen	Maximum length of pCipherPassword
    //

    function GetPasswordFromUserid(pUserid, pCipherPassword: PChar; ulCipherPasswordLen: UINT32): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::GetUseridFromGUID
    //	Purpose:
    //	    Get's a users id
    //
    //	    pGUID		GUID of existing user (In)
    //	    pUserid		Userid key of the record (Out)
    //	    ulUseridLen		Maximum length of pUserid (In)
    //

    function GetUseridFromGUID(pGUID, pUserid: PChar; ulUseridLen: UINT32): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::LogReg
    //	Purpose:
    //	    This function inserts a new record into the data with the logging
    //	    information contained in pPPVRegLog
    //

    function LogReg(const pPPVRegLog: PPVRegLog): HRESULT; stdcall;

    //***********************************************************************
    //	Method:
    //	    IRMAPPVDatabase::LogAccess
    //	Purpose:
    //	    This function inserts a new record into the data with the logging
    //	    information contained in pPPVAccessLog
    //

    function LogAccess(const pPPVAccessLog: PPVAccessLog): HRESULT; stdcall;

  end;
  {$EXTERNALSYM IRMAPPVDatabase}

implementation

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -