/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsINetDataCacheManager.idl
 */

#ifndef __gen_nsINetDataCacheManager_h__
#define __gen_nsINetDataCacheManager_h__

#include "nsISupports.h"
#include "nsINetDataCache.h"

class nsISimpleEnumerator; /* forward declaration */

class nsICachedNetData; /* forward declaration */

class nsINetDataDiskCache; /* forward declaration */

class nsIURI; /* forward declaration */


/* starting interface:    nsINetDataCacheManager */
#define NS_INETDATACACHEMANAGER_IID_STR "71c8ab00-6d5c-11d3-90c8-000064657374"

#define NS_INETDATACACHEMANAGER_IID \
  {0x71c8ab00, 0x6d5c, 0x11d3, \
    { 0x90, 0xc8, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 }}

/**
 * The network-response cache manager is partly responsible for the caching of
 * content and associated metadata that has been retrieved via the network.
 * (The remaining responsibility for caching lies with individual network
 * protocol handlers.)
 *
 * The cache manager supervises the actions of individual cache components,
 * such as the memory cache, the disk cache and any extension caches, e.g. a
 * read-only CD-ROM cache.
 *
 * @See nsINetDataCache
 * @See nsICachedNetData
 */
class NS_NO_VTABLE nsINetDataCacheManager : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(NS_INETDATACACHEMANAGER_IID)

  /**
     * Flag for the GetCachedNetData() method: If set, the memory cache is
     * neither searched nor will any data be stored into it.  This might be
     * appropriate, for example, with images, because they have their own
     * cache for storing *decoded* images.
     */
  enum { BYPASS_MEMORY_CACHE = 1U };

  /**
     * Flag for the GetCachedNetData() method: If set, the disk cache
     * is neither searched nor will any be data stored into it.
     * However, read-only extension caches may be searched.  This
     * might be used to avoid leaving persistent records of secure
     * data.
     */
  enum { BYPASS_PERSISTENT_CACHE = 2U };

  /**
     * Flag for the GetCachedNetData() method: If set, any stream
     * content is stored in the cache as a single disk file.  Content
     * will not be cached in the memory cache nor is it cached in a
     * flat-file cache database.  This is used to implement the jar
     * protocol handler and to provide the stream-as-file semantics
     * required by the classic bowser plugin API.
     */
  enum { CACHE_AS_FILE = 4U };

  /**
		These enum's are used for the ClearCache calls. 
	*/
  enum { ALL_CACHES = 1U };

  enum { MEM_CACHE = 2U };

  enum { FILE_CACHE = 4U };

  enum { FLAT_CACHE = 8U };

  /**
     * Fetch the cache entry record for the given URI.  If one does not exist,
     * create a new, empty record.  The normal search order for caches is:
     *   + Memory cache
     *   + Disk cache
     *   + File cache (stream-as-file cache)
     *   + All extension caches
     *
     * When writing, data is typically stored in both the memory cache and the
     * disk cache.  Both the search order and this write policy can be modified by
     * setting one or more of the flag argument bits, as defined above.
     *
     * The optionally-NULL secondaryKey argument can be used, e.g. for form
     * post data or for HTTP headers in the case of HTTP.
     */
  /* nsICachedNetData getCachedNetData (in string uri, [size_is (secondaryKeyLength)] in string secondaryKey, in PRUint32 secondaryKeyLength, in PRUint32 flags); */
  NS_IMETHOD GetCachedNetData(const char *uri, const char *secondaryKey, PRUint32 secondaryKeyLength, PRUint32 flags, nsICachedNetData **_retval) = 0;

  /**
     * Returns true if cached content is available for the given URI, even if
     * only partial data is stored.  The flags argument behaves the same as for
     * the GetCachedNetData() method, above.
     */
  /* boolean contains (in string uri, [size_is (secondaryKeyLength)] in string secondaryKey, in PRUint32 secondaryKeyLength, in PRUint32 flags); */
  NS_IMETHOD Contains(const char *uri, const char *secondaryKey, PRUint32 secondaryKeyLength, PRUint32 flags, PRBool *_retval) = 0;

  /**
     * Total number of unexpired URI entries stored in all caches.  This number
     * does not take into account duplicate URIs, e.g. because the memory cache
     * and the disk cache might each contain an entry for the same URI.
     */
  /* readonly attribute PRUint32 numEntries; */
  NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries) = 0;

  /**
     * Enumerate the unexpired URI entries stored in all caches.  Some URIs may
     * be enumerated more than once, e.g.  because the the memory cache and the
     * disk cache might each contain an entry for the same URI.
     */
  /* nsISimpleEnumerator newCacheEntryIterator (); */
  NS_IMETHOD NewCacheEntryIterator(nsISimpleEnumerator **_retval) = 0;

  /* nsISimpleEnumerator newCacheModuleIterator (); */
  NS_IMETHOD NewCacheModuleIterator(nsISimpleEnumerator **_retval) = 0;

  /**
     * Remove all entries from all writable caches.  This could be used, for
     * example, after a guest ends a browser session.  This is equivalent to
     * setting the DiskCacheCapacity to zero, except that all cache entries,
     * even those in active use, will be deleted.  Also, any global cache
     * database files will be deleted.
     */
  /* void removeAll (); */
  NS_IMETHOD RemoveAll(void) = 0;

  /**
      *	Clears the specified cache
      */
  /* void clear (in PRUint32 aCacheToClear); */
  NS_IMETHOD Clear(PRUint32 aCacheToClear) = 0;

  /**
     * The disk cache is made up of the file cache (for stream-as-file
     * requests) and a (possibly independent) persistent cache that handles all
     * other cache requests.  This attribute sets/gets the combined capacity of
     * these caches, measured in KBytes.  Setting the capacity lower than the
     * current amount of space currently in use may cause cache entries to be
     * evicted from the cache to accomodate the requested capacity.
     */
  /* attribute PRUint32 diskCacheCapacity; */
  NS_IMETHOD GetDiskCacheCapacity(PRUint32 *aDiskCacheCapacity) = 0;
  NS_IMETHOD SetDiskCacheCapacity(PRUint32 aDiskCacheCapacity) = 0;

  /**
     * This attribute sets/gets the capacity of the memory cache, measured in
     * KBytes.  Setting the capacity lower than the current amount of space
     * currently in use may cause cache entries to be evicted from the cache to
     * accomodate the requested capacity.
     */
  /* attribute PRUint32 memCacheCapacity; */
  NS_IMETHOD GetMemCacheCapacity(PRUint32 *aMemCacheCapacity) = 0;
  NS_IMETHOD SetMemCacheCapacity(PRUint32 aMemCacheCapacity) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSINETDATACACHEMANAGER \
  NS_IMETHOD GetCachedNetData(const char *uri, const char *secondaryKey, PRUint32 secondaryKeyLength, PRUint32 flags, nsICachedNetData **_retval); \
  NS_IMETHOD Contains(const char *uri, const char *secondaryKey, PRUint32 secondaryKeyLength, PRUint32 flags, PRBool *_retval); \
  NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries); \
  NS_IMETHOD NewCacheEntryIterator(nsISimpleEnumerator **_retval); \
  NS_IMETHOD NewCacheModuleIterator(nsISimpleEnumerator **_retval); \
  NS_IMETHOD RemoveAll(void); \
  NS_IMETHOD Clear(PRUint32 aCacheToClear); \
  NS_IMETHOD GetDiskCacheCapacity(PRUint32 *aDiskCacheCapacity); \
  NS_IMETHOD SetDiskCacheCapacity(PRUint32 aDiskCacheCapacity); \
  NS_IMETHOD GetMemCacheCapacity(PRUint32 *aMemCacheCapacity); \
  NS_IMETHOD SetMemCacheCapacity(PRUint32 aMemCacheCapacity); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSINETDATACACHEMANAGER(_to) \
  NS_IMETHOD GetCachedNetData(const char *uri, const char *secondaryKey, PRUint32 secondaryKeyLength, PRUint32 flags, nsICachedNetData **_retval) { return _to ## GetCachedNetData(uri, secondaryKey, secondaryKeyLength, flags, _retval); } \
  NS_IMETHOD Contains(const char *uri, const char *secondaryKey, PRUint32 secondaryKeyLength, PRUint32 flags, PRBool *_retval) { return _to ## Contains(uri, secondaryKey, secondaryKeyLength, flags, _retval); } \
  NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries) { return _to ## GetNumEntries(aNumEntries); } \
  NS_IMETHOD NewCacheEntryIterator(nsISimpleEnumerator **_retval) { return _to ## NewCacheEntryIterator(_retval); } \
  NS_IMETHOD NewCacheModuleIterator(nsISimpleEnumerator **_retval) { return _to ## NewCacheModuleIterator(_retval); } \
  NS_IMETHOD RemoveAll(void) { return _to ## RemoveAll(); } \
  NS_IMETHOD Clear(PRUint32 aCacheToClear) { return _to ## Clear(aCacheToClear); } \
  NS_IMETHOD GetDiskCacheCapacity(PRUint32 *aDiskCacheCapacity) { return _to ## GetDiskCacheCapacity(aDiskCacheCapacity); } \
  NS_IMETHOD SetDiskCacheCapacity(PRUint32 aDiskCacheCapacity) { return _to ## SetDiskCacheCapacity(aDiskCacheCapacity); } \
  NS_IMETHOD GetMemCacheCapacity(PRUint32 *aMemCacheCapacity) { return _to ## GetMemCacheCapacity(aMemCacheCapacity); } \
  NS_IMETHOD SetMemCacheCapacity(PRUint32 aMemCacheCapacity) { return _to ## SetMemCacheCapacity(aMemCacheCapacity); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsNetDataCacheManager : public nsINetDataCacheManager
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSINETDATACACHEMANAGER

  nsNetDataCacheManager();
  virtual ~nsNetDataCacheManager();
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsNetDataCacheManager, nsINetDataCacheManager)

nsNetDataCacheManager::nsNetDataCacheManager()
{
  NS_INIT_ISUPPORTS();
  /* member initializers and constructor code */
}

nsNetDataCacheManager::~nsNetDataCacheManager()
{
  /* destructor code */
}

/* nsICachedNetData getCachedNetData (in string uri, [size_is (secondaryKeyLength)] in string secondaryKey, in PRUint32 secondaryKeyLength, in PRUint32 flags); */
NS_IMETHODIMP nsNetDataCacheManager::GetCachedNetData(const char *uri, const char *secondaryKey, PRUint32 secondaryKeyLength, PRUint32 flags, nsICachedNetData **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* boolean contains (in string uri, [size_is (secondaryKeyLength)] in string secondaryKey, in PRUint32 secondaryKeyLength, in PRUint32 flags); */
NS_IMETHODIMP nsNetDataCacheManager::Contains(const char *uri, const char *secondaryKey, PRUint32 secondaryKeyLength, PRUint32 flags, PRBool *_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* readonly attribute PRUint32 numEntries; */
NS_IMETHODIMP nsNetDataCacheManager::GetNumEntries(PRUint32 *aNumEntries)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* nsISimpleEnumerator newCacheEntryIterator (); */
NS_IMETHODIMP nsNetDataCacheManager::NewCacheEntryIterator(nsISimpleEnumerator **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* nsISimpleEnumerator newCacheModuleIterator (); */
NS_IMETHODIMP nsNetDataCacheManager::NewCacheModuleIterator(nsISimpleEnumerator **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void removeAll (); */
NS_IMETHODIMP nsNetDataCacheManager::RemoveAll()
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void clear (in PRUint32 aCacheToClear); */
NS_IMETHODIMP nsNetDataCacheManager::Clear(PRUint32 aCacheToClear)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute PRUint32 diskCacheCapacity; */
NS_IMETHODIMP nsNetDataCacheManager::GetDiskCacheCapacity(PRUint32 *aDiskCacheCapacity)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsNetDataCacheManager::SetDiskCacheCapacity(PRUint32 aDiskCacheCapacity)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute PRUint32 memCacheCapacity; */
NS_IMETHODIMP nsNetDataCacheManager::GetMemCacheCapacity(PRUint32 *aMemCacheCapacity)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsNetDataCacheManager::SetMemCacheCapacity(PRUint32 aMemCacheCapacity)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

// ContractID prefix for Components that implement this interface
#define NS_NETWORK_CACHE_MANAGER_CONTRACTID NS_NETWORK_CACHE_CONTRACTID "?name=manager"

#endif /* __gen_nsINetDataCacheManager_h__ */
