"Fossies" - the Fresh Open Source Software Archive

Member "rpm2html-1.11.2/rpmdata.h" (5 Oct 2010, 9672 Bytes) of package /linux/privat/rpm2html-1.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "rpmdata.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * rpmdata.h : describes the data gathered for each RPM analyzed.
    3  *
    4  * See Copyright for the status of this software.
    5  *
    6  * $Id: rpmdata.h,v 1.58 2010/10/05 14:36:54 hany Exp $
    7  */
    8 
    9 #ifndef __RPMDATA_H__
   10 #define __RPMDATA_H__
   11 
   12 #include <sys/types.h>
   13 #if defined(HAVE_RPM_RPMLEGACY_H)
   14 #define _RPM_4_4_COMPAT
   15 #include <rpm/rpmlegacy.h>
   16 #endif
   17 #if defined(HAVE_RPM_RPMIO_H)
   18 #include <rpm/rpmio.h>
   19 #endif
   20 #include <rpm/header.h>
   21 
   22 /*
   23  * Structure associated with a local directory containing RPM files.
   24  */
   25 
   26 #define MAX_ARCHS   (sizeof(int) * 8)
   27 
   28 typedef struct rpm_dir {
   29     struct rpm_dir *next;   /* next in list */
   30     int no;         /* ID in SQL base */
   31     int vendor;         /* vendor ID in SQL base */
   32     char *color;        /* The bgcolor for the pages :-) */
   33     char *dir;              /* where to store the HTML files */
   34     char *subdir;       /* subdirectory for multiple archive */
   35     char *ftp;              /* The host URL it's mirrored from */
   36     char *ftpsrc;       /* The host URL where src.rpm can be found */
   37     char *host;                 /* Hostname for the server */
   38     char *mail;         /* mail contact for this directory */
   39     char *maint;        /* Maintainer name for this directory */
   40     char *name;         /* Name for this repository */
   41     char *rpmdir;               /* The local repository */
   42     char *trust;        /* Confidences in the files */
   43     char *url;              /* The output URL */
   44     int   files;        /* number of files */
   45     int   installbase;      /* Is this from an installed base */
   46     int   size;         /* aggregated size of files */
   47     int   nb_mirrors;       /* numbers of mirrors */
   48     int   max_mirrors;      /* numbers of slot allocated */
   49     char **mirrors;             /* Urls for download */
   50     int   html;             /* Should we build the HTML pages */
   51     int   build_tree;       /* Should we build the filesystem tree */
   52     int   follow_symlinks;  /* Should we follow all symlinks */
   53     int   rpm_symlinks;     /* Should we open links to RPM files */
   54     struct rpm_realdir *root;   /* The corresponding filesystem tree */
   55     char *dbpath;               /* The rpm db path */   /* Added by A. Gibert */  
   56 } rpmDir, *rpmDirPtr;
   57 
   58 /*
   59  * Structure associated with a local directory containing HTML files.
   60  * We build a tree providing an actual map of the generated site.
   61  */
   62 
   63 typedef struct rpm_subdir {
   64     struct rpm_subdir *parent;  /* Parent directory ususally .. */
   65     char  *name;        /* subdirectory name */
   66     char  *color;       /* Color for the HTML output */
   67     char  *htmlpath;        /* full path w.r.t. rpm2html_url */
   68     char  *rpmpath;     /* full path w.r.t. rpm2html_dir */
   69     int    html;        /* Should we build the HTML pages */
   70     int    nb_subdirs;      /* number of subdirectories */
   71     int    max_subdirs;     /* number of subdirectories allocated */
   72     struct rpm_subdir **subdirs;/* list of the subdirectories */ 
   73 } rpmSubdir, *rpmSubdirPtr;
   74 
   75 /*
   76  * Structure associated with a real directory containing files owned
   77  * by RPM packages. It reflect the content of user's filesystem if
   78  * it installed the packages.
   79  */
   80 
   81 #define RPM_ELEM_DIRECTORY  0x1   /* File or directory ? */
   82 
   83 typedef struct rpm_realdir {
   84     struct rpm_realdir *parent; /* Parent directory */
   85     char  *name;        /* directory name */
   86     int    nb_elem;     /* number of files (and subdirs)  */
   87     int    max_elem;        /* size of allocated arrays       */
   88                                 /* pointers to an array of either */
   89     void **elems;               /* filename or subdir rpm_realdir */
   90     char **names;               /* pointer to the array of names  */
   91     char  *flags;               /* pointer to array of flags      */
   92 } rpmRealDir, *rpmRealDirPtr;
   93 
   94 /*
   95  * structure associated with an architecture.
   96  */
   97 
   98 typedef struct rpm_arch {
   99     struct rpm_arch *next;  /* next in the list */
  100     char *os;           /* the Operating System name */
  101     char *arch;         /* the CPU architecture */
  102 } rpmArch, *rpmArchPtr;
  103 
  104 /*
  105  * structure associated with an rpm
  106  */
  107 
  108 typedef struct rpm_data {
  109     struct rpm_data *next;  /* next in the full list of RPMs */
  110     struct rpm_data *nextSoft;  /* next software */
  111     struct rpm_data *nextArch;  /* RPM for same software on other archs */
  112     struct rpm_data *nextHash;  /* next in the hash list */
  113     /*
  114      * These information need to be kept until the end of the processing
  115      * to allow the dump of resources directories.
  116      */
  117     rpmDirPtr dir;      /* directory infos */
  118     char *url;                  /* URL for the software */
  119     char *filename;     /* name of the file */
  120     const char *name;       /* name of the software */
  121     char *summary;      /* 1 line summary */
  122     const char *group;      /* type of software */
  123     const char *version;    /* version of the software */
  124     const char *release;    /* software release */
  125     const char *arch;           /* the architecture system */
  126     const char *os;             /* the target system */
  127     const char *distribution;   /* general OS distribution */
  128     const char *vendor;     /* general OS vendor */
  129     time_t date;        /* date of packaging */
  130     int_32 size;        /* size of the software */
  131     const char *subdir;     /* subdirectory holding the rpm */
  132 
  133     struct rpm_extra_data *extra;/* see below */
  134 } rpmData, *rpmDataPtr;
  135 
  136 typedef struct rpm_extra_data {
  137     /*
  138      * These information are loaded and discarded as soon as the
  139      * HTML and RDF pages are built.
  140      */
  141     char *packager;     /* the packager */
  142     char *description;          /* short description */
  143     char *copyright;            /* software copyright */
  144     char *changelog;            /* changelog */
  145     char *srcrpm;       /* source RPM */
  146     time_t stamp;       /* modification file of the archive */
  147     char *host;         /* build host */
  148     int   nb_resources;         /* #of resources provided */
  149     int   max_resources;    /* #of resources slot allocated */
  150     struct rpm_resource **resources;/* list of them */
  151     int   nb_requires;          /* #of resources required */
  152     int   max_requires;         /* #of resources slot allocated */
  153     struct rpm_resource **requires;/* list of them */
  154     char *filelist;             /* the filelist */
  155     int   nb_sigs;          /* #of signatures required */
  156     int   max_sigs;         /* #of signatures slot allocated */
  157     struct rpm_sig **sigs;  /* list of them */
  158 } rpmExtraData, *rpmExtraDataPtr;
  159 
  160 /*
  161  * structure associated with a resource
  162  */
  163 typedef struct rpm_resource {
  164     struct rpm_resource *next;  /* next in the list */
  165     struct rpm_resource *nextHash;/* next in the hash table list */
  166     char *name;         /* name of the resource */
  167     char *version;              /* version of the resource */
  168     rpm_dep_flag flag;          /* flag of the resource */
  169     int   nb_provider;      /* #of resources provided */
  170     int   max_provider;     /* #of resources slot allocated */
  171     time_t stamp;       /* max stamp of the provider */
  172     struct rpm_data **provider; /* list of them */
  173 } rpmRess, *rpmRessPtr;
  174 
  175 /*
  176  * structure associated with signature
  177  */
  178 typedef struct rpm_sig {
  179     int size;           /* size of signature */
  180     int tag;            /* signature tag */
  181     int type;           /* signature type */
  182     int *sig;           /* signature */
  183     #if defined(WITH_GPG)
  184     char *resolve;      /* resolved signature */
  185     #endif
  186 } rpmSig, *rpmSigPtr;
  187 
  188 /*
  189  * Variables.
  190  */
  191 extern int   rpm2htmlVerbose;
  192 extern int   force;
  193 extern time_t currentTime;
  194 
  195 extern const char *archNames[MAX_ARCHS];
  196 extern int nbArchs;
  197 
  198 extern rpmDataPtr rpmSoftwareList; /* avoid different archs clash */
  199 extern rpmRessPtr ressList;
  200 extern rpmArchPtr archList;
  201 extern rpmRessPtr ressInstalledList;
  202 extern rpmDirPtr dirList;
  203 extern rpmSubdirPtr dirTree;
  204 extern rpmRealDirPtr treeRoot;
  205 
  206 /*
  207  * Functions
  208  */
  209 extern rpmSubdirPtr rpmNewSubdir(rpmSubdirPtr dir, const char *name,
  210      const char *htmlpath, const char *rpmpath, const char *color, int html);
  211 extern void rpmRemoveSubdir(rpmSubdirPtr tree);
  212 extern void rpmFreeSubdir(rpmSubdirPtr tree);
  213 extern void rpmDirFree(rpmDirPtr dir);
  214 
  215 extern void rpmAddSoftware(rpmDataPtr rpm);
  216 extern void rpmDataPrint(rpmDataPtr rpm);
  217 extern rpmDataPtr rpmSearchSoftware(const char *name, const char *version,
  218                     const char *release, const char *arch);
  219 /* extern void rpmDataPrintAll(void); */
  220 extern rpmRessPtr rpmRessAdd(char *ress, rpmDataPtr rpm, int installed);
  221 extern rpmRessPtr rpmRequAdd(char *requ, char *requv, rpm_dep_flag requf, rpmDataPtr rpm, int installed);
  222 extern rpmArchPtr rpmArchAdd(char *os, char *arch);
  223 extern rpmDataPtr rpmOpen(char *nameRpm, rpmDirPtr dir, rpmSubdirPtr tree);
  224 extern rpmDataPtr rpmDirScanAll(void);
  225 extern void rpmDirScanOneDist(const char *dist);
  226 extern void rpmDirScanOneDir(const char *directory);
  227 extern char *extractEMail(char *string);
  228 extern char *protectEmail(char *string);
  229 
  230 extern rpmDataPtr rpmAddList(rpmDataPtr old, rpmDataPtr newlist);
  231 
  232 extern void rpmGroupSort(rpmDataPtr *list, int installed);
  233 extern void rpmDistribSort(rpmDataPtr *list, int installed);
  234 extern void rpmVendorSort(rpmDataPtr *list, int installed);
  235 extern void rpmDateSort(rpmDataPtr *list, int installed);
  236 extern void rpmNameSort(rpmDataPtr *list, int installed);
  237 extern void rpmRessSort(rpmRessPtr ress);
  238 
  239 extern rpmRealDirPtr rpmCreateRealRoot(void);
  240 extern void rpmDestroyRealRoot(rpmRealDirPtr dir);
  241 extern void rpmAddRealFile(rpmRealDirPtr root, const char *file,
  242                            rpmDataPtr rpm);
  243 extern rpmRealDirPtr rpmMergeRealRoots(rpmRealDirPtr root1,
  244                                        rpmRealDirPtr root2);
  245 extern void rpmFreeExtraData(rpmDataPtr rpm);
  246 extern void rpmdataCleanup(void);
  247 extern void rpmlistCleanup(void);
  248 extern void rpmDataListFree(rpmDataPtr *base);
  249 extern void rpmRessListFree(rpmRessPtr *base);
  250 extern void rpmDirListFree(rpmDirPtr *base);
  251 #endif /* __RPMDATA_H__ */