home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / dssclien.h < prev    next >
Text File  |  1998-04-25  |  7KB  |  175 lines

  1. #ifndef DSSCLIENT_H
  2. #define DSSCLIENT_H
  3. // DSSCLIENT.H
  4. //
  5. // Application-level constants and data structure definitions for DSS applications
  6. //  on the broadcast PC platform.
  7. //
  8. //  Copyright (c) 1996 - 1997 Microsoft Corp
  9. //  All rights reserved.
  10.  
  11. // Upper edge events
  12.  
  13. typedef double NDCDATE;            // from WTYPES.H
  14.  
  15. // Upper edge purchase details
  16.  
  17. typedef struct BPCDetails {
  18.     SHORT   iChannel;       // channel number.  Might not be in tunable range
  19.     NDCDATE tStartTime;     // starting time
  20.     NDCDATE tExpiry;        // from HPO as two fields (for offers only)
  21.     LONG    lDuration;      // program item duration in seconds
  22.     LONG    iItemID;        // provider-supplied item identifier
  23.     LONG    iLocation;      // for DSS, is transponder of PIP
  24.     LONG    lUserId;        // for DSS, is CAM ID (history use, only)
  25.     LONG    iStorageId;     // provider-specific storage identifier
  26.     BSTR    szTitle;        // title.
  27.     LONG    iRating;        // event rating
  28.     BSTR    szYear;         // item year as string for UI
  29.     BSTR    szDescription;  // Description string
  30.     CURRENCY ViewCost;      // event cost in units of smallest currency
  31.     CURRENCY TapeCost;      // event cost to tape
  32.     PURCHASEACTION iAction; // Action/Status of item (see below)
  33.     LONG    lStatus;        // bitmask indicator of item status
  34.     LONG    iReason;        // explanation for service denial/error
  35.     BSTR    szReason;       // text expression of iReason
  36.     BSTR    rgbCwpBuffer;   // storage for encrypted cwp (DSS)
  37. #ifdef __cplusplus
  38.     inline BPCDetails() {
  39.         memset(this, 0, sizeof(*this));
  40.         iRating = -1;  // make sure we know this didn't come from verifier
  41.     }
  42.     inline BPCDetails(const BPCDetails &det) {
  43.         // shallow copy everything
  44.         memcpy(this, &det, sizeof(*this));
  45.         // deep copy the allocated structures
  46.         if (det.szDescription) szDescription = ::SysAllocString(det.szDescription);
  47.         if (det.szYear) szYear = ::SysAllocString(det.szYear);
  48.         if (det.szTitle) szTitle = ::SysAllocString(det.szTitle);
  49.         if (det.szReason) szReason = ::SysAllocString(det.szReason);
  50.         if (det.rgbCwpBuffer) rgbCwpBuffer  = ::SysAllocString(det.rgbCwpBuffer);
  51.     }
  52.     inline ~BPCDetails() {
  53.         if (szDescription) ::SysFreeString(szDescription);
  54.         if (szYear) ::SysFreeString(szYear);
  55.         if (szTitle) ::SysFreeString(szTitle);
  56.         if (szReason) ::SysFreeString(szReason);
  57.         if (rgbCwpBuffer) ::SysFreeString(rgbCwpBuffer);
  58. #ifdef _DEBUG
  59.         memset(this, 0, sizeof(*this));
  60. #endif
  61.     }
  62.     inline BPCDetails &operator=(const BPCDetails &det) {
  63.         if (this != &det) {
  64.             // shallow copy everything
  65.             memcpy(this, &det, sizeof(*this));
  66.             // deep copy the allocated structures
  67.             if (det.szDescription) szDescription = ::SysAllocString(det.szDescription);
  68.             if (det.szYear) szYear = ::SysAllocString(det.szYear);
  69.             if (det.szTitle) szTitle = ::SysAllocString(det.szTitle);
  70.             if (det.szReason) szReason = ::SysAllocString(det.szReason);
  71.             if (det.rgbCwpBuffer) rgbCwpBuffer  = ::SysAllocString(det.rgbCwpBuffer);
  72.         }
  73.         return *this;
  74.     }
  75.     inline bool operator==(const BPCDetails &det) const {
  76.         return (iItemID == det.iItemID && iStorageId == det.iStorageId);
  77.     }
  78.     inline bool operator!=(const BPCDetails &det) const {
  79.         return !(det == *this);
  80.     }
  81.     inline bool operator<(const BPCDetails &det) const {
  82.         return (iItemID < det.iItemID || (iItemID == det.iItemID && iStorageId < det.iStorageId));
  83.     }
  84.     inline bool operator>(const BPCDetails &det) const {
  85.         return (iItemID > det.iItemID || (iItemID == det.iItemID && iStorageId > det.iStorageId));
  86.     }
  87.  
  88. #endif
  89. } BPCDETAILS, *LPBPCDETAILS;
  90.  
  91. typedef struct ProviderMsg {
  92.     LONG    iMsgId;                 // used for association
  93.     BOOL    fIsRead;                // nonzero if read by user
  94.     LONG    lUserId;                // for DSS is 4 byte CAM ID
  95.     NDCDATE odDateTimeStamp;        // OLE DATE type
  96.     NDCDATE odExpiry;               // OLE DATE type
  97.     BSTR    szTitle;                // may not be null for tombstone
  98.     BSTR    szMessageText;          // if null, is tombstone
  99. #ifdef __cplusplus
  100.     inline ProviderMsg() {
  101.         memset(this, 0, sizeof(*this));
  102.     }
  103.     inline ProviderMsg(const ProviderMsg &msg) {
  104.         // shallow copy everything
  105.         memcpy(this, &msg, sizeof(*this));
  106.         // deep copy the allocated structures
  107.         if (msg.szTitle) szTitle = ::SysAllocString(msg.szTitle);
  108.         if (msg.szMessageText) szMessageText = ::SysAllocString(msg.szMessageText);
  109.     }
  110.     inline ~ProviderMsg() {
  111.         if (szTitle) ::SysFreeString(szTitle);
  112.         if (szMessageText) ::SysFreeString(szMessageText);
  113. #ifdef _DEBUG
  114.         memset(this, 0, sizeof(*this));
  115. #endif
  116.     }
  117.     inline ProviderMsg &operator=(const ProviderMsg &msg) {
  118.         if (this != &msg) {
  119.             // shallow copy everything
  120.             memcpy(this, &msg, sizeof(*this));
  121.             // deep copy the allocated structures
  122.             if (msg.szTitle) szTitle = ::SysAllocString(msg.szTitle);
  123.             if (msg.szMessageText) szMessageText = ::SysAllocString(msg.szMessageText);
  124.         }
  125.         return *this;
  126.     }
  127.     inline bool operator==(const ProviderMsg &msg) const {
  128.         return (lUserId == msg.lUserId && iMsgId == msg.iMsgId);
  129.     }
  130.     inline bool operator!=(const ProviderMsg &msg) const {
  131.         return !(msg == *this);
  132.     }
  133.     inline bool operator<(const ProviderMsg &msg) const {
  134.         return (lUserId < msg.lUserId || (lUserId == msg.lUserId && iMsgId < msg.iMsgId));
  135.     }
  136.     inline bool operator>(const ProviderMsg &msg) const {
  137.         return (lUserId > msg.lUserId || (lUserId == msg.lUserId && iMsgId > msg.iMsgId));
  138.     }
  139.  
  140. #endif
  141. } PROVIDERMSG,*LPPROVIDERMSG;
  142.  
  143. typedef struct ExplicitOsd {
  144.     DWORD   dwAttributes;
  145.     BSTR    bsString;
  146. #ifdef __cplusplus
  147.     inline ExplicitOsd() { memset(this, 0, sizeof(*this)); }
  148.     inline ExplicitOsd(ExplicitOsd &osd) {
  149.         // shallow copy everything
  150.         memcpy(this, &osd, sizeof(*this));
  151.         // deep copy the allocated structures
  152.         if (osd.bsString) bsString = ::SysAllocString(osd.bsString);
  153.     }
  154.     inline ~ExplicitOsd() {
  155.         if (bsString) ::SysFreeString(bsString);
  156. #ifdef _DEBUG
  157.         memset(this, 0, sizeof(*this));
  158. #endif
  159.     }
  160.     inline ExplicitOsd &operator=(ExplicitOsd &osd) {
  161.         if (this != &osd) {
  162.             // shallow copy everything
  163.             memcpy(this, &osd, sizeof(*this));
  164.             // deep copy the allocated structures
  165.             if (osd.bsString) bsString = ::SysAllocString(osd.bsString);
  166.         }
  167.         return *this;
  168.     }
  169. #endif
  170. } EXPLICITOSD,*LPEXPLICITOSD;
  171.  
  172. #endif
  173.  
  174. // End of Source File
  175.