add more dpointer placeholders
[ntk/apt.git] / apt-pkg / acquire-item.h
index 36a926a..943c618 100644 (file)
@@ -27,6 +27,7 @@
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/hashes.h>
+#include <apt-pkg/weakptr.h>
 
 /** \addtogroup acquire
  *  @{
@@ -46,7 +47,7 @@
  *
  *  \see pkgAcquire
  */
-class pkgAcquire::Item
+class pkgAcquire::Item : public WeakPointable
 {  
    protected:
    
@@ -111,10 +112,10 @@ class pkgAcquire::Item
    string ErrorText;
 
    /** \brief The size of the object to fetch. */
-   unsigned long FileSize;
+   unsigned long long FileSize;
 
    /** \brief How much of the object was already fetched. */
-   unsigned long PartialSize;
+   unsigned long long PartialSize;
 
    /** \brief If not \b NULL, contains the name of a subprocess that
     *  is operating on this object (for instance, "gzip" or "gpgv").
@@ -142,6 +143,7 @@ class pkgAcquire::Item
     *  download progress indicator's overall statistics.
     */
    bool Local;
+   string UsedMirror;
 
    /** \brief The number of fetch queues into which this item has been
     *  inserted.
@@ -242,6 +244,17 @@ class pkgAcquire::Item
 
    /** \return \b true if this object is being fetched from a trusted source. */
    virtual bool IsTrusted() {return false;};
+   
+   // report mirror problems
+   /** \brief Report mirror problem
+    * 
+    *  This allows reporting mirror failures back to a centralized
+    *  server. The apt-report-mirror-failure script is called for this
+    * 
+    *  \param FailCode A short failure string that is send
+    */
+   void ReportMirrorFailure(string FailCode);
+
 
    /** \brief Initialize an item.
     *
@@ -422,6 +435,10 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
     *  off the front?
     */
    vector<DiffInfo> available_patches;
+
+   /** Stop applying patches when reaching that sha1 */
+   string ServerSha1;
+
    /** The current status of this patch. */
    enum DiffState
      {
@@ -475,6 +492,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
     */
    pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc,
                    string ShortDesc, HashString ExpectedHash,
+                   string ServerSha1,
                    vector<DiffInfo> diffs=vector<DiffInfo>());
 };
                                                                        /*}}}*/
@@ -540,10 +558,13 @@ class pkgAcqIndex : public pkgAcquire::Item
     *
     *  \param compressExt The compression-related extension with which
     *  this index file should be downloaded, or "" to autodetect
-    *  (".bz2" is used if bzip2 is installed, ".gz" otherwise).
+    *  Compression types can be set with config Acquire::CompressionTypes,
+    *  default is ".lzma" or ".bz2" (if the needed binaries are present)
+    *  fallback is ".gz" or none.
     */
    pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
-              string ShortDesc, HashString ExpectedHash, string compressExt="");
+              string ShortDesc, HashString ExpectedHash, 
+              string compressExt="");
 };
                                                                        /*}}}*/
 /** \brief An acquire item that is responsible for fetching a          {{{
@@ -558,6 +579,7 @@ class pkgAcqIndexTrans : public pkgAcqIndex
    public:
   
    virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual string Custom600Headers();
 
    /** \brief Create a pkgAcqIndexTrans.
     *
@@ -569,12 +591,6 @@ class pkgAcqIndexTrans : public pkgAcqIndex
     *  \param URIDesc A "URI-style" description of this index file.
     *
     *  \param ShortDesc A brief description of this index file.
-    *
-    *  \param ExpectedHash The expected hashsum of this index file.
-    *
-    *  \param compressExt The compression-related extension with which
-    *  this index file should be downloaded, or "" to autodetect
-    *  (".bz2" is used if bzip2 is installed, ".gz" otherwise).
     */
    pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
                    string ShortDesc);
@@ -612,7 +628,6 @@ class pkgAcqMetaSig : public pkgAcquire::Item
    /** \brief The last good signature file */
    string LastGoodSig;
 
-
    /** \brief The fetch request that is currently being processed. */
    pkgAcquire::ItemDesc Desc;
 
@@ -860,6 +875,9 @@ class pkgAcqFile : public pkgAcquire::Item
     */
    unsigned int Retries;
    
+   /** \brief Should this file be considered a index file */
+   bool IsIndexFile;
+
    public:
    
    // Specialized action members
@@ -868,6 +886,7 @@ class pkgAcqFile : public pkgAcquire::Item
                     pkgAcquire::MethodConfig *Cnf);
    virtual string DescURI() {return Desc.URI;};
    virtual string HashSum() {return ExpectedHash.toStr(); };
+   virtual string Custom600Headers();
 
    /** \brief Create a new pkgAcqFile object.
     *
@@ -891,6 +910,8 @@ class pkgAcqFile : public pkgAcquire::Item
     *
     *  \param DestFilename The filename+path the file is downloaded to.
     *
+    *  \param IsIndexFile The file is considered a IndexFile and cache-control
+    *                     headers like "cache-control: max-age=0" are send
     *
     * If DestFilename is empty, download to DestDir/<basename> if
     * DestDir is non-empty, $CWD/<basename> otherwise.  If
@@ -900,7 +921,8 @@ class pkgAcqFile : public pkgAcquire::Item
 
    pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long Size,
              string Desc, string ShortDesc,
-             const string &DestDir="", const string &DestFilename="");
+             const string &DestDir="", const string &DestFilename="",
+             bool IsIndexFile=false);
 };
                                                                        /*}}}*/
 /** @} */