IWMSCacheProxyServer::GetContentInformation

banner art

Previous Next

IWMSCacheProxyServer::GetContentInformation

The GetContentInformation method is called by the cache plug-in to retrieve content information.

Syntax

  HRESULT GetContentInformation(
  
  BSTR
  
  bstrOriginUrl
  ,
  
  IWMSContext*
  
  pPresentationContext
  ,
  
  IWMSCacheProxy*
  
  pICacheProxy
  ,
  IWMSProxyContext*  pIProxyContext,IWMSCacheProxyServerCallback*pCallback,VARIANTvarContext);

Parameters

bstrOriginUrl

[in] BSTR containing the URL on the origin server that identifies the location of the content.

pPresentationContext

[in] Pointer to an IWMSContext interface containing a presentation context.

pICacheProxy

[in] Pointer to an IWMSCacheProxy interface identifying the plug-in. Event plug-ins can use the pointer to access the cache proxy plug-in when an event occurs.

piProxyContext

[in, optional] Pointer to an IWMSProxyContext interface that enables the server to retrieve client credentials and the name and port number of the proxy server that handles the client request. This can be NULL if the cache proxy plug-in does not specify an upstream proxy configuration.

pCallback

[in, optional] Pointer to an IWMSCacheProxyServerCallback interface. The server calls IWMSCacheProxyServerCallback::OnGetContentInformation to respond to the plug-in.

varContext

[in, optional] VARIANT containing a value defined by the plug-in. For example, your plug-in can use this parameter to persist state information. The server does not alter this value and passes it back when calling IWMSCacheProxyServerCallback::OnGetContentInformation.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code Number Description
E_INVALIDARG 0x80070057 The bstrOriginUrl, pCallback, or pPresentationContext parameter is NULL.
E_OUTOFMEMORY 0x8007000E The server could not allocate memory.

Remarks

Cache proxy plug-ins generally call GetContentInformation when performing any of the following operations:

  • Rolling over to a different protocol
  • Establishing a cache-miss policy
  • Processing a prestuff request

In each case, the plug-in must get more information about the content before it can proceed. For example, to establish a cache-miss policy, the plug-in must determine whether the content is a broadcast, a playlist, or on-demand. Also, before prestuffing content, it must determine whether the content can be cached.

When the plug-in calls GetContentInformation, the server retrieves the appropriate information from the upstream server, and calls IWMSCacheProxyServerCallback::OnGetContentInformation to return a cache information context pointer to the plug-in. The context contains a pointer to an IWMSDataContainerVersion interface that the plug-in can use to retrieve the following information:

  • Flags that indicate whether the content can be cached, proxied, or split
  • The size of the content, in bytes
  • Entity tags that can be used to differentiate content
  • A count of the entity tags
  • The content expiration date
  • The time at which the content was last modified

A plug-in typically does not have access to client credentials. Therefore, a call to GetContentInformation can fail (the server returns E_ACCESSDENIED) if the origin server requires authentication. In this case, the plug-in can instruct the server to play the content on demand by returning WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND when it calls IWMSCacheProxyCallback::OnQueryCacheMissPolicy. When the cache proxy server again fails the authentication challenge, it passes the authentication request through to the client, thereby allowing the client to pass its credentials upstream.

Example Code

    // Retrieve the requested URL and protocol from local
    // variables. HTTP and RTSP are common protocols.
    bstrUrl = m_pszProtocolName;
    bstrUrl.Append( L"://" );
    bstrUrl.Append(m_bstrContent );

    hr = m_pICacheProxyServer->GetContentInformation(
                         bstrUrl,
                         pPresentationContext,
                         this,
                         (IWMSProxyContext*) this,
                         this,
                         varContext);

Requirements

Header: streamcache.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next