rmappv.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:12k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /****************************************************************************
  2.  * 
  3.  *  $Id: rmappv.h,v 1.1 2003/05/30 02:17:36 gabest Exp $
  4.  *
  5.  *  Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.
  6.  *  
  7.  *  http://www.real.com/devzone
  8.  *
  9.  *  This program contains proprietary information of RealNetworks, Inc.,
  10.  *  and is licensed subject to restrictions on use and distribution.
  11.  *
  12.  *  RealMedia Architecture Interfaces for pay-per-view database plugins
  13.  *
  14.  */
  15. #ifndef _RMAPPV_H_
  16. #define _RMAPPV_H_
  17. #ifdef _MACINTOSH // Unsure whether this should be included on other platforms?
  18. #include <time.h> // Get definition of time_t.
  19. #endif
  20. /*
  21.  * Structures and definitions for PPVPermission
  22.  */
  23. #define PPV_MAX_URL_LEN         2048
  24. typedef enum _PPVURLType {
  25.     PPV_URL_TYPE_FILE = 0,
  26.     PPV_URL_TYPE_DIRECTORY    
  27. } PPVURLType;
  28. typedef enum _PPVPermissionType {
  29.     PPV_PERMISSION_GENERAL = 0,
  30.     PPV_PERMISSION_EXPIRES,
  31.     PPV_PERMISSION_DEBIT,
  32.     PPV_PERMISSION_CREDIT,
  33.     PPV_PERMISSION_NONE
  34. } PPVPermissionType;
  35. typedef struct _PPVPermission
  36. {
  37.     char      pURL[PPV_MAX_URL_LEN];
  38.     PPVURLType      nURLType;
  39.     PPVPermissionType nPermissionType;
  40.     time_t      tExpires;
  41.     UINT32      ulDebitTime;
  42. } PPVPermission;
  43. /*
  44.  * Structures and definitions for PPVAccessLog
  45.  */
  46. typedef enum _PPVAccessPermissionOn {
  47.     PPV_PERMISSION_ON_FILE = 0,
  48.     PPV_PERMISSION_ON_DIRECTORY,
  49.     PPV_PERMISSION_ON_NONE
  50. } PPVAccessPermissionOn;
  51. typedef enum _PPVAccessDisconnectType {
  52.     PPV_DISCONNECT_CLIENT = 0,
  53.     PPV_DISCONNECT_TIME_EXPIRED
  54. } PPVAccessDisconnectType;
  55. typedef struct _PPVAccessLog
  56. {
  57.     BOOL     bAccessGranted;
  58.     char*     pUserid;
  59.     char*     pGUID;
  60.     char*     pIPAddress;
  61.     char*     pURL;
  62.     PPVPermissionType      nPermissionType;
  63.     PPVAccessPermissionOn   nPermOn;
  64.     time_t     tStartTime;
  65.     time_t     tStopTime;
  66.     UINT32     lTotalTime;
  67.     PPVAccessDisconnectType nWhyDisconnect;
  68. } PPVAccessLog;
  69. /*
  70.  * Structures and definitions for PPVRegLog
  71.  */
  72. typedef enum _PPVRegStatus
  73. {
  74.     PPV_GUID_REG_SUCCESS = 0,
  75.     PPV_GUID_REG_FAILED_LOCKED,
  76.     PPV_GUID_REG_FAILED_COLLISION,
  77.     PPV_GUID_REG_FAILED_OLD_PLAYER,
  78.     PPV_GUID_REG_FAILED_NO_USER,
  79.     PPV_GUID_REG_FAILED
  80. } PPVRegStatus;
  81. typedef struct _PPVRegLog
  82. {
  83.    PPVRegStatus     nStatus;
  84.    char*     pUserid;
  85.    char*     pGUID;
  86.    char*     pIPAddress;
  87.    time_t     tRequestTime;
  88.    char*     pURLRedirect;
  89. } PPVRegLog;
  90. /****************************************************************************
  91.  * 
  92.  *  Interface:
  93.  *
  94.  * IRMAPPVDatabase
  95.  *
  96.  *  Purpose:
  97.  * This interface provides access to a backend database used to store
  98.  * information related to the server's pay-per-view feature.
  99.  *
  100.  *  IID_IRMAPPVDatabase:
  101.  *
  102.  * {00001d00-0901-11d1-8B06-00A024406D59}
  103.  *
  104.  */
  105. DEFINE_GUID(IID_IRMAPPVDatabase, 0x00001d00, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  106.  0xa0, 0x24, 0x40, 0x6d, 0x59);
  107. #undef  INTERFACE
  108. #define INTERFACE   IRMAPPVDatabase
  109. DECLARE_INTERFACE_(IRMAPPVDatabase, IUnknown)
  110. {
  111.     /*
  112.      * IUnknown methods
  113.      */
  114.     STDMETHOD(QueryInterface) (THIS_
  115. REFIID riid,
  116. void** ppvObj) PURE;
  117.     STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  118.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  119.     /*
  120.      * IRMAPPVDatabase methods
  121.      */
  122.     /************************************************************************
  123.      * Method:
  124.      *     IRMAPPVDatabase::InitPPVDB
  125.      * Purpose:
  126.      *     Open & Initialize the PPV Database.
  127.      *     This function will called once per instance before any other
  128.      *     methods are called.
  129.      *
  130.      * pDBName Name of the database (if supported)
  131.      * pUserID User ID to access database (if supported)
  132.      * pPassword Password to access database (if supported)
  133.      */
  134.     STDMETHOD(InitPPVDB) (THIS_
  135.  const char* pDBName,
  136.  const char* pUserID,
  137.  const char* pPassword) PURE;
  138.     /************************************************************************
  139.      * Method:
  140.      *     IRMAPPVDatabase::GetPPVDBInfo
  141.      * Purpose:
  142.      *     Get this databases short name.
  143.      *     This unique identifier is used to identify this database plugin.
  144.      *     It should be unique enough that no other plugin will ever have
  145.      *     the same plugin name.
  146.      */
  147.     STDMETHOD(GetPPVDBInfo) (THIS_
  148.  REF(const char*) /*OUT*/ pShortName) PURE;
  149.     /************************************************************************
  150.      * Method:
  151.      *     IRMAPPVDatabase::InsertUser
  152.      * Purpose:
  153.      *     Inserts a user into the database (the user should not already
  154.      *     exist).
  155.      *
  156.      *     pUserid Userid key of the record to insert
  157.      *     pPasswordCipher Optional Password to associate with this user;
  158.      * The password being passed in is already
  159.      * encrypted.
  160.      */
  161.     STDMETHOD(InsertUser) (THIS_
  162.  const char* pUserid,
  163.  const char* pPasswordCipher) PURE;
  164.     /************************************************************************
  165.      * Method:
  166.      *     IRMAPPVDatabase::RemoveUser
  167.      * Purpose:
  168.      *     Removes a user from the database.
  169.      *
  170.      *     pUserid Userid key of the record
  171.      */
  172.     STDMETHOD(RemoveUser) (THIS_
  173.  const char* pUserid) PURE;
  174.     /************************************************************************
  175.      * Method:
  176.      *     IRMAPPVDatabase::RegisterGUID
  177.      * Purpose:
  178.      *     Registers a GUID to be associated with the pUserid
  179.      *
  180.      *     pUserid Userid key of the record
  181.      *     pGUID GUID to associate with user record
  182.      *     bForce Forces registration of guid, even if
  183.      * the uuid_writeable flag is set to read only
  184.      */
  185.     STDMETHOD(RegisterGUID) (THIS_
  186.  const char* pUserid,
  187.  const char* pGUID,
  188.  BOOL bForce) PURE;
  189.     /************************************************************************
  190.      * Method:
  191.      *     IRMAPPVDatabase::SetPassword
  192.      * Purpose:
  193.      *     Sets the password for the user associated with pUserid 
  194.      *
  195.      *     pUserid Userid key of the record
  196.      *     pCipherPassword User's Password
  197.      */
  198.     STDMETHOD(SetPassword) (THIS_
  199.  const char* pUserid,
  200.  const char* pCipherPassword) PURE;
  201.     /************************************************************************
  202.      * Method:
  203.      *     IRMAPPVDatabase::ValidateUser
  204.      * Purpose:
  205.      *     Sets the password for the user associated with pUserid 
  206.      *
  207.      *     pUserid Userid key of the record
  208.      *     pPPVPermission Permission structure with URL to validate on
  209.      */
  210.     STDMETHOD(ValidateUser) (THIS_
  211.  const char* pUserid,
  212.  PPVPermission* pPPVPermission) PURE;
  213.     /************************************************************************
  214.      * Method:
  215.      *     IRMAPPVDatabase::GrantPermission
  216.      * Purpose:
  217.      *     Adds a permission record.
  218.      *
  219.      *     pUserid Userid key of the record
  220.      *     pPPVPermission Permission structure with URL
  221.      */
  222.     STDMETHOD(GrantPermission) (THIS_
  223.  const char* pUserid,
  224.  const PPVPermission* pPPVPermission) PURE;
  225.     /************************************************************************
  226.      * Method:
  227.      *     IRMAPPVDatabase::RevokePermission
  228.      * Purpose:
  229.      *     Removes a permission record.
  230.      *
  231.      *     pUserid Userid key of the record
  232.      *     pPPVPermission Permission structure with URL
  233.      */
  234.     STDMETHOD(RevokePermission) (THIS_
  235.  const char* pUserid,
  236.  const PPVPermission* pPPVPermission) PURE;
  237.     /************************************************************************
  238.      * Method:
  239.      *     IRMAPPVDatabase::RevokeAllPermissions
  240.      * Purpose:
  241.      *     Removes all permission records for a user.
  242.      *
  243.      *     pUserid Userid key of the record
  244.      */
  245.     STDMETHOD(RevokeAllPermissions) (THIS_
  246.  const char* pUserid) PURE;
  247.  
  248.     /************************************************************************
  249.      * Method:
  250.      *     IRMAPPVDatabase::GetRedirect
  251.      * Purpose:
  252.      *     Gets the redirection Url corresponding to the requested Url
  253.      *     from the database.
  254.      *
  255.      *     pURL Url key of redirect record (In)
  256.      *     pURLRedirect Url to redirect to (Out)
  257.      *     ulURLRedirectLen Maximum length of pURLRedirect (In)
  258.      */
  259.     STDMETHOD(GetRedirect) (THIS_
  260.  const char* pURL,
  261.  char* pURLRedirect,
  262.  UINT32 ulURLRedirectLen) PURE;
  263.     /************************************************************************
  264.      * Method:
  265.      *     IRMAPPVDatabase::PutRedirect
  266.      * Purpose:
  267.      *     Adds a redirection Url to the database to correspond with
  268.      *     the Url key.
  269.      *     
  270.      *
  271.      *     pURL Url key of redirect record (In)
  272.      *     pURLRedirect Url to redirect to (In)
  273.      */
  274.     STDMETHOD(PutRedirect) (THIS_
  275.  const char* pURL,
  276.  const char* pURLRedirect) PURE;
  277.     /************************************************************************
  278.      * Method:
  279.      *     IRMAPPVDatabase::GrantTime
  280.      * Purpose:
  281.      *     Grants a user time to view (specified by pPPVPermission).
  282.      *
  283.      *     pUserid Userid key of the record
  284.      *     pPPVPermission Permission structure with URL
  285.      *     ulGrant Amount of time to grant
  286.      */
  287.     STDMETHOD(GrantTime) (THIS_
  288.  const char*      pUserid,
  289.  const PPVPermission* pPPVPermission,
  290.  UINT32 ulGrant) PURE;
  291.     /************************************************************************
  292.      * Method:
  293.      *     IRMAPPVDatabase::DeductTime
  294.      * Purpose:
  295.      *     Deducts a user time to view (specified by pPPVPermission).
  296.      *
  297.      *     pUserid Userid key of the record
  298.      *     pPPVPermission Permission structure with URL
  299.      *     ulDeduct Amount of time to deduct
  300.      */
  301.     STDMETHOD(DeductTime) (THIS_
  302.  const char*      pUserid,
  303.  const PPVPermission* pPPVPermission,
  304.  UINT32 ulDeduct) PURE;
  305.     /************************************************************************
  306.      * Method:
  307.      *     IRMAPPVDatabase::GetPasswordFromUserid
  308.      * Purpose:
  309.      *     Get's a users password
  310.      *
  311.      *     pUserid Userid key of the record (In)
  312.      *     pCipherPassword Password to get (Out)
  313.      *     ulCipherPasswordLen Maximum length of pCipherPassword
  314.      */
  315.     STDMETHOD(GetPasswordFromUserid) (THIS_
  316.  const char*     pUserid,
  317.  char*          pCipherPassword,
  318.  UINT32     ulCipherPasswordLen) PURE;
  319.     /************************************************************************
  320.      * Method:
  321.      *     IRMAPPVDatabase::GetUseridFromGUID
  322.      * Purpose:
  323.      *     Get's a users id
  324.      *
  325.      *     pGUID GUID of existing user (In)
  326.      *     pUserid Userid key of the record (Out)
  327.      *     ulUseridLen Maximum length of pUserid (In)
  328.      */
  329.     STDMETHOD(GetUseridFromGUID) (THIS_
  330.  const char*     pGUID,
  331.  char*          pUserid,
  332.  UINT32     ulUseridLen) PURE;
  333.     /************************************************************************
  334.      * Method:
  335.      *     IRMAPPVDatabase::LogReg
  336.      * Purpose:
  337.      *     This function inserts a new record into the data with the logging
  338.      *     information contained in pPPVRegLog
  339.      */
  340.     STDMETHOD(LogReg) (THIS_
  341.  PPVRegLog*  pPPVRegLog) PURE;
  342.     /************************************************************************
  343.      * Method:
  344.      *     IRMAPPVDatabase::LogAccess
  345.      * Purpose:
  346.      *     This function inserts a new record into the data with the logging
  347.      *     information contained in pPPVAccessLog
  348.      */
  349.     STDMETHOD(LogAccess) (THIS_
  350.  PPVAccessLog*  pPPVAccessLog) PURE;
  351. };
  352. #endif /*_RMAPPV_H_*/