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

#ifndef __gen_nsINetDataCache_h__
#define __gen_nsINetDataCache_h__

#include "nsISupports.h"

class nsIURI; /* forward declaration */

class nsINetDataCacheRecord; /* forward declaration */

class nsISimpleEnumerator; /* forward declaration */


/* starting interface:    nsINetDataCache */
#define NS_INETDATACACHE_IID_STR "ccfc58c0-6dde-11d3-90c8-000064657374"

#define NS_INETDATACACHE_IID \
  {0xccfc58c0, 0x6dde, 0x11d3, \
    { 0x90, 0xc8, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 }}

/**
 * The nsINetDataCache defines the low-level API for a network-data
 * cache, used to cache the responses to network retrieval commands.
 * This interface, along with nsINetDataCacheRecord, is implemented by
 * the memory cache, the file cache and, optionally, by some extension
 * caches.  This interface is essentially a pseudo-private API for the
 * cache manager.  Other clients should never use this interface.
 *
 * Each cache entry may contain both content, e.g. GIF image data, and
 * associated metadata, e.g. HTTP headers.  Each entry is indexed by two
 * different keys: a record id number and a key created by combining the URI
 * with a "secondary key", e.g. HTTP post data.
 *
 * The nsINetDataCache interface is agnostic as to where the data is
 * stored and whether the storage is volatile or persistent.  The
 * memory cache, any disk caches and any extension caches must all
 * implement this interface.
 *
 */
class NS_NO_VTABLE nsINetDataCache : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(NS_INETDATACACHE_IID)

  /**
	 * Human-readable description of the cache module, e.g. "Disk Cache"
	 */
  /* readonly attribute wstring description; */
  NS_IMETHOD GetDescription(PRUnichar * *aDescription) = 0;

  /**
     * Returns true if cached data is available for the given opaque key,
     * even if only partial data is stored.
     */
  /* boolean contains ([size_is (length)] in string key, in PRUint32 length); */
  NS_IMETHOD Contains(const char *key, PRUint32 length, PRBool *_retval) = 0;

  /**
     * Fetch the cache entry record for the given opaque key.  If one does not
     * exist, create a new, empty record.
     */
  /* nsINetDataCacheRecord getCachedNetData ([size_is (length)] in string key, in PRUint32 length); */
  NS_IMETHOD GetCachedNetData(const char *key, PRUint32 length, nsINetDataCacheRecord **_retval) = 0;

  /**
     * Fetch the cache entry record for the given URI using the record ID as a key.
     */
  /* nsINetDataCacheRecord getCachedNetDataByID (in PRInt32 RecordID); */
  NS_IMETHOD GetCachedNetDataByID(PRInt32 RecordID, nsINetDataCacheRecord **_retval) = 0;

  /**
	 * False indicates that this cache is entirely bypassed.
	 */
  /* attribute boolean enabled; */
  NS_IMETHOD GetEnabled(PRBool *aEnabled) = 0;
  NS_IMETHOD SetEnabled(PRBool aEnabled) = 0;

  /**
     * Constants for flags attribute, below
     */
  enum { READ_ONLY = 1 };

  enum { MEMORY_CACHE = 2 };

  enum { FLAT_FILE_CACHE = 4 };

  enum { FILE_PER_URL_CACHE = 8 };

  /**
	 * See constants defined above.
	 */
  /* readonly attribute PRUint32 flags; */
  NS_IMETHOD GetFlags(PRUint32 *aFlags) = 0;

  /**
     * Total number of URI entries stored in the cache.
     */
  /* readonly attribute PRUint32 numEntries; */
  NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries) = 0;

  /**
     * Maximum number of URI entries that may be stored in the cache.
     */
  /* readonly attribute PRUint32 maxEntries; */
  NS_IMETHOD GetMaxEntries(PRUint32 *aMaxEntries) = 0;

  /**
     * Enumerate the URI entries stored in the cache.
     */
  /* nsISimpleEnumerator newCacheEntryIterator (); */
  NS_IMETHOD NewCacheEntryIterator(nsISimpleEnumerator **_retval) = 0;

  /**
	 * Contains a reference to the next cache in search order.  For the memory
	 * cache, this attribute always references the disk cache.  For the disk
	 * cache, it contains a reference to the first extension cache.
	 */
  /* attribute nsINetDataCache nextCache; */
  NS_IMETHOD GetNextCache(nsINetDataCache * *aNextCache) = 0;
  NS_IMETHOD SetNextCache(nsINetDataCache * aNextCache) = 0;

  /**
     * An estimate of the amount of storage occupied by the cache, in kB.
     * Actual use may be slightly higher than reported due to cache overhead
     * and heap fragmentation (in the memory cache) or block quantization (in
     * the disk cache).
	 */
  /* readonly attribute PRUint32 storageInUse; */
  NS_IMETHOD GetStorageInUse(PRUint32 *aStorageInUse) = 0;

  /**
     * Remove all entries from a writable cache.  This could be used, for
     * example, after a guest ends a browser session.  This is equivalent to
     * setting the cache's Capacity 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;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSINETDATACACHE \
  NS_IMETHOD GetDescription(PRUnichar * *aDescription); \
  NS_IMETHOD Contains(const char *key, PRUint32 length, PRBool *_retval); \
  NS_IMETHOD GetCachedNetData(const char *key, PRUint32 length, nsINetDataCacheRecord **_retval); \
  NS_IMETHOD GetCachedNetDataByID(PRInt32 RecordID, nsINetDataCacheRecord **_retval); \
  NS_IMETHOD GetEnabled(PRBool *aEnabled); \
  NS_IMETHOD SetEnabled(PRBool aEnabled); \
  NS_IMETHOD GetFlags(PRUint32 *aFlags); \
  NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries); \
  NS_IMETHOD GetMaxEntries(PRUint32 *aMaxEntries); \
  NS_IMETHOD NewCacheEntryIterator(nsISimpleEnumerator **_retval); \
  NS_IMETHOD GetNextCache(nsINetDataCache * *aNextCache); \
  NS_IMETHOD SetNextCache(nsINetDataCache * aNextCache); \
  NS_IMETHOD GetStorageInUse(PRUint32 *aStorageInUse); \
  NS_IMETHOD RemoveAll(void); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSINETDATACACHE(_to) \
  NS_IMETHOD GetDescription(PRUnichar * *aDescription) { return _to ## GetDescription(aDescription); } \
  NS_IMETHOD Contains(const char *key, PRUint32 length, PRBool *_retval) { return _to ## Contains(key, length, _retval); } \
  NS_IMETHOD GetCachedNetData(const char *key, PRUint32 length, nsINetDataCacheRecord **_retval) { return _to ## GetCachedNetData(key, length, _retval); } \
  NS_IMETHOD GetCachedNetDataByID(PRInt32 RecordID, nsINetDataCacheRecord **_retval) { return _to ## GetCachedNetDataByID(RecordID, _retval); } \
  NS_IMETHOD GetEnabled(PRBool *aEnabled) { return _to ## GetEnabled(aEnabled); } \
  NS_IMETHOD SetEnabled(PRBool aEnabled) { return _to ## SetEnabled(aEnabled); } \
  NS_IMETHOD GetFlags(PRUint32 *aFlags) { return _to ## GetFlags(aFlags); } \
  NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries) { return _to ## GetNumEntries(aNumEntries); } \
  NS_IMETHOD GetMaxEntries(PRUint32 *aMaxEntries) { return _to ## GetMaxEntries(aMaxEntries); } \
  NS_IMETHOD NewCacheEntryIterator(nsISimpleEnumerator **_retval) { return _to ## NewCacheEntryIterator(_retval); } \
  NS_IMETHOD GetNextCache(nsINetDataCache * *aNextCache) { return _to ## GetNextCache(aNextCache); } \
  NS_IMETHOD SetNextCache(nsINetDataCache * aNextCache) { return _to ## SetNextCache(aNextCache); } \
  NS_IMETHOD GetStorageInUse(PRUint32 *aStorageInUse) { return _to ## GetStorageInUse(aStorageInUse); } \
  NS_IMETHOD RemoveAll(void) { return _to ## RemoveAll(); } 

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

/* Header file */
class nsNetDataCache : public nsINetDataCache
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSINETDATACACHE

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

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsNetDataCache, nsINetDataCache)

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

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

/* readonly attribute wstring description; */
NS_IMETHODIMP nsNetDataCache::GetDescription(PRUnichar * *aDescription)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* boolean contains ([size_is (length)] in string key, in PRUint32 length); */
NS_IMETHODIMP nsNetDataCache::Contains(const char *key, PRUint32 length, PRBool *_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* nsINetDataCacheRecord getCachedNetData ([size_is (length)] in string key, in PRUint32 length); */
NS_IMETHODIMP nsNetDataCache::GetCachedNetData(const char *key, PRUint32 length, nsINetDataCacheRecord **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* nsINetDataCacheRecord getCachedNetDataByID (in PRInt32 RecordID); */
NS_IMETHODIMP nsNetDataCache::GetCachedNetDataByID(PRInt32 RecordID, nsINetDataCacheRecord **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute boolean enabled; */
NS_IMETHODIMP nsNetDataCache::GetEnabled(PRBool *aEnabled)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsNetDataCache::SetEnabled(PRBool aEnabled)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* readonly attribute PRUint32 flags; */
NS_IMETHODIMP nsNetDataCache::GetFlags(PRUint32 *aFlags)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

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

/* readonly attribute PRUint32 maxEntries; */
NS_IMETHODIMP nsNetDataCache::GetMaxEntries(PRUint32 *aMaxEntries)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

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

/* attribute nsINetDataCache nextCache; */
NS_IMETHODIMP nsNetDataCache::GetNextCache(nsINetDataCache * *aNextCache)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsNetDataCache::SetNextCache(nsINetDataCache * aNextCache)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* readonly attribute PRUint32 storageInUse; */
NS_IMETHODIMP nsNetDataCache::GetStorageInUse(PRUint32 *aStorageInUse)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

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

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

// ContractID prefix for Components that implement this interface
#define NS_NETWORK_CACHE_CONTRACTID "@mozilla.org/network/cache;1"
#define NS_NETWORK_MEMORY_CACHE_CONTRACTID NS_NETWORK_CACHE_CONTRACTID "?name=memory-cache"
#define NS_NETWORK_FLAT_CACHE_CONTRACTID   NS_NETWORK_CACHE_CONTRACTID "?name=flat-cache"
#define NS_NETWORK_FILE_CACHE_CONTRACTID   NS_NETWORK_CACHE_CONTRACTID "?name=file-cache"

#endif /* __gen_nsINetDataCache_h__ */
