"Fossies" - the Fresh Open Source Software Archive

Member "rpm-4.15.0/lib/header_internal.h" (26 Jun 2019, 2367 Bytes) of package /linux/misc/rpm-4.15.0.tar.bz2:


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 "header_internal.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 4.14.1_vs_4.14.2.

    1 #ifndef H_HEADER_INTERNAL
    2 #define H_HEADER_INTERNAL
    3 
    4 /** \ingroup header
    5  * \file lib/header_internal.h
    6  */
    7 
    8 #include <rpm/header.h>
    9 #include <netinet/in.h>
   10 
   11 /** \ingroup header
   12  * Description of tag data.
   13  */
   14 typedef struct entryInfo_s * entryInfo;
   15 struct entryInfo_s {
   16     rpm_tag_t tag;      /*!< Tag identifier. */
   17     rpm_tagtype_t type;     /*!< Tag data type. */
   18     int32_t offset;     /*!< Offset into data segment (ondisk only). */
   19     rpm_count_t count;      /*!< Number of tag elements. */
   20 };
   21 
   22 typedef struct hdrblob_s * hdrblob;
   23 struct hdrblob_s {
   24     int32_t *ei;
   25     int32_t il;
   26     int32_t dl;
   27     entryInfo pe;
   28     int32_t pvlen;
   29     uint8_t *dataStart;
   30     uint8_t *dataEnd;
   31 
   32     rpmTagVal regionTag;
   33     int32_t ril;
   34     int32_t rdl;
   35 };
   36 
   37 #ifdef __cplusplus
   38 extern "C" {
   39 #endif
   40 
   41 /* convert entry info to host endianess */
   42 static inline void ei2h(const struct entryInfo_s *pe, struct entryInfo_s *info)
   43 {
   44     info->tag = ntohl(pe->tag);
   45     info->type = ntohl(pe->type);
   46     info->offset = ntohl(pe->offset);
   47     info->count = ntohl(pe->count);
   48 }
   49 
   50 static inline void ei2td(const struct entryInfo_s *info,
   51           unsigned char * dataStart, size_t len,
   52           struct rpmtd_s *td)
   53 {
   54     td->tag = info->tag;
   55     td->type = info->type;
   56     td->count = info->count;
   57     td->size = len;
   58     td->data = dataStart + info->offset;
   59     td->ix = -1;
   60     td->flags = RPMTD_IMMUTABLE;
   61 }
   62 
   63 RPM_GNUC_INTERNAL
   64 hdrblob hdrblobCreate(void);
   65 
   66 RPM_GNUC_INTERNAL
   67 hdrblob hdrblobFree(hdrblob blob);
   68 
   69 RPM_GNUC_INTERNAL
   70 rpmRC hdrblobInit(const void *uh, size_t uc,
   71         rpmTagVal regionTag, int exact_size,
   72         struct hdrblob_s *blob, char **emsg);
   73 
   74 RPM_GNUC_INTERNAL
   75 rpmRC hdrblobRead(FD_t fd, int magic, int exact_size, rpmTagVal regionTag, hdrblob blob, char **emsg);
   76 
   77 RPM_GNUC_INTERNAL
   78 rpmRC hdrblobImport(hdrblob blob, int fast, Header *hdrp, char **emsg);
   79 
   80 RPM_GNUC_INTERNAL
   81 rpmRC hdrblobGet(hdrblob blob, uint32_t tag, rpmtd td);
   82 
   83 /** \ingroup header
   84  * Set header instance (rpmdb record number)
   85  * @param h     header
   86  * @param instance  record number
   87  */
   88 RPM_GNUC_INTERNAL
   89 void headerSetInstance(Header h, unsigned int instance);
   90 
   91 /* Package IO helper to consolidate partial read and error handling */
   92 RPM_GNUC_INTERNAL
   93 ssize_t Freadall(FD_t fd, void * buf, ssize_t size);
   94 
   95 RPM_GNUC_INTERNAL
   96 int headerIsSourceHeuristic(Header h);
   97 #ifdef __cplusplus
   98 }   
   99 #endif
  100 
  101 #endif  /* H_HEADER_INTERNAL */