' ########################################################################################
' Microsoft Windows
' File: StreamCache.inc
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_streamcache_PBI)
#DEFINE PBX_streamcache_PBI
%EQUATE `STREAMCACHE_INC = 1
'/* header files for imported files */
#INCLUDE ONCE "Legacy/COM/ObjIdl.inc"
#INCLUDE ONCE "Legacy/System/nsscore.inc"
#INCLUDE ONCE "Legacy/System/datacontainerversion.inc"
#INCLUDE ONCE "Legacy/System/event.inc"
#INCLUDE ONCE "Legacy/Media/wmsproxy.inc"
$IID_IWMSCacheProxy = GUID$("{2E34AB83-0D3D-11D2-9EEE-006097D2D7CF}")
$IID_IWMSCacheProxyCallback = GUID$("{2E34AB84-0D3D-11D2-9EEE-006097D2D7CF}")
$IID_IWMSCacheProxyServer = GUID$("{68F2A550-D815-11D2-BEF6-00A0C95EC343}")
$IID_IWMSCacheProxyServerCallback = GUID$("{68F2A551-D815-11D2-BEF6-00A0C95EC343}")
$IID_IWMSCacheItemDescriptor = GUID$("{C3CBA330-AC05-11D2-BEF0-00A0C95EC343}")
$IID_IWMSCacheItemCollection = GUID$("{E6E05D80-F45C-11D2-BEFE-00A0C95EC343}")
' ========================================================================================
' WMS_CACHE_QUERY_MISS_RESPONSE enum
' ========================================================================================
%EQUATE `WMS_CACHE_QUERY_MISS_SKIP = 0
%EQUATE `WMS_CACHE_QUERY_MISS_DISCONNECT = %WMS_CACHE_QUERY_MISS_SKIP + 1
%EQUATE `WMS_CACHE_QUERY_MISS_REDIRECT = %WMS_CACHE_QUERY_MISS_DISCONNECT + 1
%EQUATE `WMS_CACHE_QUERY_MISS_REDIRECT_TO_PROXY = %WMS_CACHE_QUERY_MISS_REDIRECT + 1
%EQUATE `WMS_CACHE_QUERY_MISS_PLAY_BROADCAST = %WMS_CACHE_QUERY_MISS_REDIRECT_TO_PROXY + 1
%EQUATE `WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND = %WMS_CACHE_QUERY_MISS_PLAY_BROADCAST + 1
%EQUATE `WMS_CACHE_QUERY_MISS_FORWARD_REQUEST = %WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND + 1
%EQUATE `WMS_CACHE_QUERY_MISS_PROCESS_REQUEST = %WMS_CACHE_QUERY_MISS_FORWARD_REQUEST + 1
' ========================================================================================
' WMS_CACHE_QUERY_RESPONSE enum
' ========================================================================================
%EQUATE `WMS_CACHE_QUERY_HIT_PLAY_ON_DEMAND = 0
%EQUATE `WMS_CACHE_QUERY_HIT_PLAY_BROADCAST = %WMS_CACHE_QUERY_HIT_PLAY_ON_DEMAND + 1
%EQUATE `WMS_CACHE_QUERY_HIT_PROCESS_REQUEST = %WMS_CACHE_QUERY_HIT_PLAY_BROADCAST + 1
%EQUATE `WMS_CACHE_QUERY_MISS = %WMS_CACHE_QUERY_HIT_PROCESS_REQUEST + 1
' ========================================================================================
' WMS_CACHE_VERSION_COMPARE_RESPONSE enum
' ========================================================================================
%EQUATE `WMS_CACHE_VERSION_FAIL_TO_CHECK_VERSION = 0
%EQUATE `WMS_CACHE_VERSION_CACHE_STALE = %WMS_CACHE_VERSION_FAIL_TO_CHECK_VERSION + 1
%EQUATE `WMS_CACHE_VERSION_CACHE_UP_TO_DATE = %WMS_CACHE_VERSION_CACHE_STALE + 1
' ========================================================================================
' WMS_CACHE_CONTENT_TYPE_FLAGS enum
' ========================================================================================
%EQUATE `WMS_CACHE_CONTENT_TYPE_BROADCAST = &H1
%EQUATE `WMS_CACHE_CONTENT_TYPE_PLAYLIST = &H2
' ========================================================================================
' WMS_CACHE_QUERY_TYPE_FLAGS enum
' ========================================================================================
%EQUATE `WMS_CACHE_QUERY_OPEN = &H1
%EQUATE `WMS_CACHE_QUERY_GET_CONTENT_INFO = &H2
%EQUATE `WMS_CACHE_QUERY_CACHE_EVENT = &H4
%EQUATE `WMS_CACHE_QUERY_REVERSE_PROXY = &H8
%EQUATE `WMS_CACHE_QUERY_LOCAL_EVENT = &H10
' ========================================================================================
' WMS_CACHE_CONTENT_DOWNLOAD_FLAGS enum
' ========================================================================================
%EQUATE `WMS_CONTENT_DOWNLOAD_ABORT_IF_BCAST = &H1
' ========================================================================================
' WMS_CACHE_REMOTE_EVENT_FLAGS enum
' ========================================================================================
%EQUATE `WMS_CACHE_REMOTE_OPEN = &H1
%EQUATE `WMS_CACHE_REMOTE_CLOSE = &H2
%EQUATE `WMS_CACHE_REMOTE_LOG = &H4
' ########################################################################################
' Interface name = IWMSCacheProxy
' IID = {2E34AB83-0D3D-11D2-9EEE-006097D2D7CF}
' Contains methods that administer a cache. This interface is implemented by a cache / proxy plug-in and called by the server.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSCacheProxy_INTERFACE_DEFINED)
 %IWMSCacheProxy_INTERFACE_DEFINED = 1
INTERFACE IWMSCacheProxy $IID_IWMSCacheProxy
 INHERIT IUnknown
 ' =====================================================================================
 METHOD QueryCache ( ' VTable offset = 12
 BYVAL bstrOriginUrl AS WSTRING
 , BYVAL pUserContext AS IWMSContext
 , BYVAL pCommandContext AS IWMSCommandContext
 , BYVAL pPresentationContext AS IWMSContext
 , BYVAL lQueryType AS LONG
 , BYVAL pCallback AS IWMSCacheProxyCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD QueryCacheMissPolicy ( ' VTable offset = 16
 BYVAL bstrOriginUrl AS WSTRING
 , BYVAL pUserContext AS IWMSContext
 , BYVAL pCommandContext AS IWMSCommandContext
 , BYVAL pPresentationContext AS IWMSContext
 , BYVAL pCachePluginContext AS IUnknown
 , BYVAL lQueryType AS LONG
 , BYVAL pCallback AS IWMSCacheProxyCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveCacheItem ( ' VTable offset = 20
 BYVAL bstrOriginUrl AS WSTRING
 , BYVAL pCallback AS IWMSCacheProxyCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveAllCacheItems ( ' VTable offset = 24
 BYVAL pCallback AS IWMSCacheProxyCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD AddCacheItem ( ' VTable offset = 28
 BYVAL bstrOriginUrl AS WSTRING
 , BYVAL bstrPrestuffUrl AS WSTRING
 , BYVAL lExpiration AS LONG
 , BYVAL lBandwidth AS LONG
 , BYVAL lRemoteEventFlags AS LONG
 , BYVAL pCallback AS IWMSCacheProxyCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD QuerySpaceForCacheItem ( ' VTable offset = 32
 BYVAL lContentSizeLow AS LONG
 , BYVAL lContentSizeHigh AS LONG
 , BYREF pvarfSpaceAvail AS INTEGER
 ) AS LONG
 ' =====================================================================================
 METHOD FindCacheItem ( ' VTable offset = 36
 BYVAL bstrOriginUrl AS WSTRING
 , BYREF ppCacheItemDescriptor AS IWMSCacheItemDescriptor
 ) AS LONG
 ' =====================================================================================
 METHOD CreateCacheItemCollection ( ' VTable offset = 40
 BYREF ppCacheItemCollection AS IWMSCacheItemCollection
 ) AS LONG
 ' =====================================================================================
 METHOD OnCacheClientClose ( ' VTable offset = 44
 BYVAL resultHr AS LONG
 , BYVAL pUserContext AS IWMSContext
 , BYVAL pPresentationContext AS IWMSContext
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSCacheProxy_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IWMSCacheProxyCallback
' IID = {2E34AB84-0D3D-11D2-9EEE-006097D2D7CF}
' Contains methods that enable a cache / proxy plug-in to respond to calls that the server makes through the IWMSCacheProxy interface. This interface is implemented by the server and called by a cache / proxy plug-in.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSCacheProxyCallback_INTERFACE_DEFINED)
 %IWMSCacheProxyCallback_INTERFACE_DEFINED = 1
INTERFACE IWMSCacheProxyCallback $IID_IWMSCacheProxyCallback
 INHERIT IUnknown
 ' =====================================================================================
 METHOD OnQueryCache ( ' VTable offset = 12
 BYVAL lHr AS LONG
 , BYVAL Response AS LONG
 , BYVAL bstrCacheUrl AS WSTRING
 , BYVAL pContentInfo AS IWMSContext
 , BYVAL pCachePluginContext AS IUnknown
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD OnQueryCacheMissPolicy ( ' VTable offset = 16
 BYVAL lHr AS LONG
 , BYVAL CacheMissPolicy AS LONG
 , BYVAL bstrUrl AS WSTRING
 , BYVAL pProxyContext AS IWMSProxyContext
 , BYVAL pContentInfo AS IWMSContext
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD OnRemoveCacheItem ( ' VTable offset = 20
 BYVAL lHr AS LONG
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD OnRemoveAllCacheItems ( ' VTable offset = 24
 BYVAL lHr AS LONG
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD OnAddCacheItem ( ' VTable offset = 28
 BYVAL lHr AS LONG
 , BYVAL pCacheItemDescriptor AS IWMSCacheItemDescriptor
 , BYVAL varServerContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSCacheProxyCallback_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IWMSCacheProxyServer
' IID = {68F2A550-D815-11D2-BEF6-00A0C95EC343}
' Contains methods that validate client authorization, retrieve information about cached content, determine whether the content is current, and download content to a cache.
' This interface is implemented by the server and called by a cache / proxy plug-in.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSCacheProxyServer_INTERFACE_DEFINED)
 %IWMSCacheProxyServer_INTERFACE_DEFINED = 1
INTERFACE IWMSCacheProxyServer $IID_IWMSCacheProxyServer
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetContentInformation ( ' VTable offset = 12
 BYVAL bstrOriginUrl AS WSTRING
 , BYVAL pPresentationContext AS IWMSContext
 , BYVAL pICacheProxy AS IWMSCacheProxy
 , BYVAL pIProxyContext AS IWMSProxyContext
 , BYVAL pCallback AS IWMSCacheProxyServerCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD CompareContentInformation ( ' VTable offset = 16
 BYVAL bstrOriginUrl AS WSTRING
 , BYVAL pContentInfo AS IWMSContext
 , BYVAL pPresentationContext AS IWMSContext
 , BYVAL pICacheProxy AS IWMSCacheProxy
 , BYVAL pIProxyContext AS IWMSProxyContext
 , BYVAL pCallback AS IWMSCacheProxyServerCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD DownloadContent ( ' VTable offset = 20
 BYVAL bstrOriginUrl AS WSTRING
 , BYVAL bstrCacheUrl AS WSTRING
 , BYVAL lBandwidth AS LONG
 , BYVAL lQuotaLow AS LONG
 , BYVAL lQuotaHigh AS LONG
 , BYVAL lBitFlags AS LONG
 , BYVAL pICacheProxy AS IWMSCacheProxy
 , BYVAL pIProxyContext AS IWMSProxyContext
 , BYVAL pCallback AS IWMSCacheProxyServerCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD CancelDownloadContent ( ' VTable offset = 24
 BYVAL pArchiveContext AS IWMSContext
 , BYVAL pCallback AS IWMSCacheProxyServerCallback
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSCacheProxyServer_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IWMSCacheProxyServerCallback
' IID = {68F2A551-D815-11D2-BEF6-00A0C95EC343}
' Contains methods that enable a cache / proxy plug-in to respond to calls that the server makes through the IWMSCacheProxyServer interface. This interface is implemented by a cache / proxy plug-in and called by the server.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSCacheProxyServerCallback_INTERFACE_DEFINED)
 %IWMSCacheProxyServerCallback_INTERFACE_DEFINED = 1
INTERFACE IWMSCacheProxyServerCallback $IID_IWMSCacheProxyServerCallback
 INHERIT IUnknown
 ' =====================================================================================
 METHOD OnGetContentInformation ( ' VTable offset = 12
 BYVAL lHr AS LONG
 , BYVAL pContentInfo AS IWMSContext
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD OnCompareContentInformation ( ' VTable offset = 16
 BYVAL lHr AS LONG
 , BYVAL CompareResponse AS LONG
 , BYVAL pNewContentInfo AS IWMSContext
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD OnDownloadContentProgress ( ' VTable offset = 20
 BYVAL lHr AS LONG
 , BYVAL opCode AS LONG
 , BYVAL pArchiveContext AS IWMSContext
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD OnDownloadContentFinished ( ' VTable offset = 24
 BYVAL lHr AS LONG
 , BYVAL DWORD
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD OnCancelDownloadContent ( ' VTable offset = 28
 BYVAL lHr AS LONG
 , BYVAL varContext AS VARIANT
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSCacheProxyServerCallback_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IWMSCacheItemDescriptor
' IID = {C3CBA330-AC05-11D2-BEF0-00A0C95EC343}
' Retrieves the size, version number, expiration date, and URL of cached content. This interface is implemented by a cache / proxy plug-in and called by the server.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSCacheItemDescriptor_INTERFACE_DEFINED)
 %IWMSCacheItemDescriptor_INTERFACE_DEFINED = 1
INTERFACE IWMSCacheItemDescriptor $IID_IWMSCacheItemDescriptor
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetOriginUrl ( ' VTable offset = 12
 BYREF pbstrOriginUrl AS WSTRING
 ) AS LONG
 ' =====================================================================================
 METHOD GetCacheUrl ( ' VTable offset = 16
 BYREF pbstrCacheUrl AS WSTRING
 ) AS LONG
 ' =====================================================================================
 METHOD GetContentInformation ( ' VTable offset = 20
 BYREF ppContentInfo AS IWMSContext
 ) AS LONG
 ' =====================================================================================
 METHOD GetContentSize ( ' VTable offset = 24
 BYREF plContentSizeLow AS LONG
 , BYREF plContentSizeHigh AS LONG
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSCacheItemDescriptor_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IWMSCacheItemCollection
' IID = {E6E05D80-F45C-11D2-BEFE-00A0C95EC343}
' Contains a collection of IWMSCacheItemDescriptor objects. This interface is implemented by a cache / proxy plug-in and called by the server.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSCacheItemCollection_INTERFACE_DEFINED)
 %IWMSCacheItemCollection_INTERFACE_DEFINED = 1
INTERFACE IWMSCacheItemCollection $IID_IWMSCacheItemCollection
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetCount ( ' VTable offset = 12
 BYREF plNumCacheItemDescriptors AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD GetItem ( ' VTable offset = 16
 BYVAL lIndex AS LONG
 , BYREF ppCacheItemDescriptor AS IWMSCacheItemDescriptor
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSCacheItemCollection_INTERFACE_DEFINED__ */
#ENDIF
