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

#ifndef __gen_nsINetDataCacheRecord_h__
#define __gen_nsINetDataCacheRecord_h__

#include "nsISupports.h"
#include "nsrootidl.h"

class nsIFile; /* forward declaration */

class nsIChannel; /* forward declaration */

class nsINetDataCache; /* forward declaration */

/**
 * The nsINetDataCacheRecord represents a single entry in a database that
 * caches data retrieved from the network. On top of this low-level interface
 * to the raw record data, the cache manager implements a higher-level record
 * interface, nsICachedNetData.  Each instance of nsINetDataCacheRecord is
 * (internally) associated with a parent database, an instance of the
 * nsINetDataCache interface.  This interface is essentially a pseudo-private
 * API for the cache manager.  Other clients should never use this interface.
 *
 * Each cache record may contain both content and metadata.  The content may
 * be, for example, GIF image data or HTML, and it is accessed through
 * nsIChannel's streaming API.  The opaque metadata, which may contain HTTP
 * headers among other things, is accessed as a contiguous byte array.  Each
 * entry in the cache is indexed by two different keys: a unique record id
 * number, generated by the cache, and an opaque string.  The latter contains
 * the URI and other secondary key information, e.g. HTTP form post key/value
 * pairs.
 *
 * The nsINetDataCacheRecord interface is agnostic as to where the data is
 * stored and whether the storage is volatile or persistent.  The memory cache,
 * the disk cache, a flat-file cache and any read-only extension caches must
 * all implement this interface.
 *
 * @See nsICachedNetData
 * @See nsINetDataCache
 * @See nsINetDataDiskCache
 * @See nsINetDataCacheManager
 */
class nsILoadGroup; /* forward declaration */


/* starting interface:    nsINetDataCacheRecord */
#define NS_INETDATACACHERECORD_IID_STR "fdcdd6a0-7461-11d3-90ca-0040056a906e"

#define NS_INETDATACACHERECORD_IID \
  {0xfdcdd6a0, 0x7461, 0x11d3, \
    { 0x90, 0xca, 0x00, 0x40, 0x05, 0x6a, 0x90, 0x6e }}

class NS_NO_VTABLE nsINetDataCacheRecord : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(NS_INETDATACACHERECORD_IID)

  /**
     * As far as the nsINetDataCacheRecord implementation is concerned, the
     * cache entry database key is an opaque blob, but it's intended to contain
     * both the URI and any secondary keys, such as HTTP post data.
     */
  /* void getKey (out unsigned long length, [size_is (length), retval] out string key); */
  NS_IMETHOD GetKey(PRUint32 *length, char **key) = 0;

  /**
     * A persistent record number assigned by the cache which must be unique
     * among all entries stored within the same cache.  The record ID serves as
     * an alternate key to the cache record.  Providing that they satisfy the
     * afforementioned uniqueness requirement, record IDs can be assigned any
     * value by the database except that they may never be zero.
     */
  /* readonly attribute PRInt32 recordID; */
  NS_IMETHOD GetRecordID(PRInt32 *aRecordID) = 0;

  /**
     * Opaque data which can be updated for each cache entry independently of
     * the content data.  This data is a combination of protocol-independent
     * data provided by the cache manager and protocol-specific meta-data,
     * e.g. HTTP headers.
     */
  /* void getMetaData (out PRUint32 length, [size_is (length), retval] out string metaData); */
  NS_IMETHOD GetMetaData(PRUint32 *length, char **metaData) = 0;

  /* void setMetaData (in PRUint32 length, [size_is (length)] in string data); */
  NS_IMETHOD SetMetaData(PRUint32 length, const char *data) = 0;

  /**
     * Number of content bytes stored in the cache, i.e. via the nsIChannel
     * streaming APIs.  This may be less than the complete content length if a
     * partial cache fill occurred.  Additionally, the cached content can be
     * truncated by reducing the value of this attribute.  When this attribute
     * is set to zero the associated cache disk file, if any, should be
     * deleted.
     */
  /* attribute PRUint32 storedContentLength; */
  NS_IMETHOD GetStoredContentLength(PRUint32 *aStoredContentLength) = 0;
  NS_IMETHOD SetStoredContentLength(PRUint32 aStoredContentLength) = 0;

  /**
	 * Opaque security info associated with the cache entry; it can't be serialized
	 * to disk, so it'll only make sense with memory cache
	 */
  /* attribute nsISupports securityInfo; */
  NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) = 0;
  NS_IMETHOD SetSecurityInfo(nsISupports * aSecurityInfo) = 0;

  /** 
     * Delete this cache entry and its associated content.
     */
  /* void delete (); */
  NS_IMETHOD Delete(void) = 0;

  /**
     * Create a channel for reading or writing a stream of content into the
     * entry.  However, many of the nsIChannel methods may return
     * NS_NOT_IMPLEMENTED, including:
     *
     *    + GetURI()
     *    + GetContentType()
     *    + GetContentLength()
     */
  /* nsIChannel newChannel (in nsILoadGroup loadGroup); */
  NS_IMETHOD NewChannel(nsILoadGroup *loadGroup, nsIChannel **_retval) = 0;

  /**
     * If a cache is implemented such that it stores each URI's content in an
     * individual disk file, this method will identify the file corresponding
     * to this record.  This may be used to implement the "stream-as-file"
     * semantics required by some plugins and by the 'jar:' protocol handler.
     * However, not all cache implementations are *required* to store the data
     * from each URI in an individual file, so it is acceptable for an
     * implementation of this method to signal NS_NOT_IMPLEMENTED.
     */
  /* readonly attribute nsIFile file; */
  NS_IMETHOD GetFile(nsIFile * *aFile) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSINETDATACACHERECORD \
  NS_IMETHOD GetKey(PRUint32 *length, char **key); \
  NS_IMETHOD GetRecordID(PRInt32 *aRecordID); \
  NS_IMETHOD GetMetaData(PRUint32 *length, char **metaData); \
  NS_IMETHOD SetMetaData(PRUint32 length, const char *data); \
  NS_IMETHOD GetStoredContentLength(PRUint32 *aStoredContentLength); \
  NS_IMETHOD SetStoredContentLength(PRUint32 aStoredContentLength); \
  NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo); \
  NS_IMETHOD SetSecurityInfo(nsISupports * aSecurityInfo); \
  NS_IMETHOD Delete(void); \
  NS_IMETHOD NewChannel(nsILoadGroup *loadGroup, nsIChannel **_retval); \
  NS_IMETHOD GetFile(nsIFile * *aFile); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSINETDATACACHERECORD(_to) \
  NS_IMETHOD GetKey(PRUint32 *length, char **key) { return _to ## GetKey(length, key); } \
  NS_IMETHOD GetRecordID(PRInt32 *aRecordID) { return _to ## GetRecordID(aRecordID); } \
  NS_IMETHOD GetMetaData(PRUint32 *length, char **metaData) { return _to ## GetMetaData(length, metaData); } \
  NS_IMETHOD SetMetaData(PRUint32 length, const char *data) { return _to ## SetMetaData(length, data); } \
  NS_IMETHOD GetStoredContentLength(PRUint32 *aStoredContentLength) { return _to ## GetStoredContentLength(aStoredContentLength); } \
  NS_IMETHOD SetStoredContentLength(PRUint32 aStoredContentLength) { return _to ## SetStoredContentLength(aStoredContentLength); } \
  NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) { return _to ## GetSecurityInfo(aSecurityInfo); } \
  NS_IMETHOD SetSecurityInfo(nsISupports * aSecurityInfo) { return _to ## SetSecurityInfo(aSecurityInfo); } \
  NS_IMETHOD Delete(void) { return _to ## Delete(); } \
  NS_IMETHOD NewChannel(nsILoadGroup *loadGroup, nsIChannel **_retval) { return _to ## NewChannel(loadGroup, _retval); } \
  NS_IMETHOD GetFile(nsIFile * *aFile) { return _to ## GetFile(aFile); } 

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

/* Header file */
class nsNetDataCacheRecord : public nsINetDataCacheRecord
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSINETDATACACHERECORD

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

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsNetDataCacheRecord, nsINetDataCacheRecord)

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

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

/* void getKey (out unsigned long length, [size_is (length), retval] out string key); */
NS_IMETHODIMP nsNetDataCacheRecord::GetKey(PRUint32 *length, char **key)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* readonly attribute PRInt32 recordID; */
NS_IMETHODIMP nsNetDataCacheRecord::GetRecordID(PRInt32 *aRecordID)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void getMetaData (out PRUint32 length, [size_is (length), retval] out string metaData); */
NS_IMETHODIMP nsNetDataCacheRecord::GetMetaData(PRUint32 *length, char **metaData)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void setMetaData (in PRUint32 length, [size_is (length)] in string data); */
NS_IMETHODIMP nsNetDataCacheRecord::SetMetaData(PRUint32 length, const char *data)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute PRUint32 storedContentLength; */
NS_IMETHODIMP nsNetDataCacheRecord::GetStoredContentLength(PRUint32 *aStoredContentLength)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsNetDataCacheRecord::SetStoredContentLength(PRUint32 aStoredContentLength)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute nsISupports securityInfo; */
NS_IMETHODIMP nsNetDataCacheRecord::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsNetDataCacheRecord::SetSecurityInfo(nsISupports * aSecurityInfo)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void delete (); */
NS_IMETHODIMP nsNetDataCacheRecord::Delete()
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* nsIChannel newChannel (in nsILoadGroup loadGroup); */
NS_IMETHODIMP nsNetDataCacheRecord::NewChannel(nsILoadGroup *loadGroup, nsIChannel **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* readonly attribute nsIFile file; */
NS_IMETHODIMP nsNetDataCacheRecord::GetFile(nsIFile * *aFile)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

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


#endif /* __gen_nsINetDataCacheRecord_h__ */
