Sanitize python object -> tag number exception handling
[platform/upstream/rpm.git] / lib / rpmfi_internal.h
1 #ifndef _RPMFI_INTERNAL_H
2 #define _RPMFI_INTERNAL_H
3
4 #include <rpm/header.h>
5 #include <rpm/rpmfi.h>
6 #include "lib/fsm.h"            /* for FSM_t */
7 #include "lib/fprint.h"
8
9 /* 
10  * This limits maximum unique strings (user + group names) from packages to 
11  * 65535, should be plenty but easy to bump if ever needed.
12  */
13 typedef uint16_t scidx_t;
14 typedef struct strcache_s *strcache;
15
16 #define RPMFIMAGIC      0x09697923
17
18 /**
19  * A package filename set.
20  */
21 struct rpmfi_s {
22     int i;                      /*!< Current file index. */
23     int j;                      /*!< Current directory index. */
24
25     Header h;                   /*!< Header for file info set (or NULL) */
26
27     const char ** bnl;          /*!< Base name(s) (from header) */
28     const char ** dnl;          /*!< Directory name(s) (from header) */
29
30     strcache flinkcache;        /*!< File link cache */
31     scidx_t * flinks;           /*!< Index to file link(s) cache */
32     scidx_t * flangs;           /*!< Index to file lang(s) cache */
33
34     uint32_t * dil;             /*!< Directory indice(s) (from header) */
35     const rpm_flag_t * fflags;  /*!< File flag(s) (from header) */
36     const rpm_off_t * fsizes;   /*!< File size(s) (from header) */
37     const rpm_time_t * fmtimes; /*!< File modification time(s) (from header) */
38     rpm_mode_t * fmodes;        /*!< File mode(s) (from header) */
39     const rpm_rdev_t * frdevs;  /*!< File rdev(s) (from header) */
40     const rpm_ino_t * finodes;  /*!< File inodes(s) (from header) */
41
42     scidx_t *fuser;             /*!< Index to file owner(s) cache */
43     scidx_t *fgroup;            /*!< Index to file group(s) cache */
44
45     char * fstates;             /*!< File state(s) (from header) */
46
47     const rpm_color_t * fcolors;/*!< File color bits (header) */
48     strcache fcapcache;         /*!< File capabilities cache */
49     scidx_t * fcaps;            /*!< Index to file cap(s) cache */
50
51     const char ** cdict;        /*!< File class dictionary (header) */
52     rpm_count_t ncdict;         /*!< No. of class entries. */
53     const uint32_t * fcdictx;   /*!< File class dictionary index (header) */
54
55     const uint32_t * ddict;     /*!< File depends dictionary (header) */
56     rpm_count_t nddict;         /*!< No. of depends entries. */
57     const uint32_t * fddictx;   /*!< File depends dictionary start (header) */
58     const uint32_t * fddictn;   /*!< File depends dictionary count (header) */
59     const rpm_flag_t * vflags;  /*!< File verify flag(s) (from header) */
60
61     rpm_count_t dc;             /*!< No. of directories. */
62     rpm_count_t fc;             /*!< No. of files. */
63
64     rpmfiFlags fiflags;         /*!< file info set control flags */
65     headerGetFlags scareFlags;  /*!< headerGet flags wrt scareMem */
66
67     struct fingerPrint_s * fps; /*!< File fingerprint(s). */
68
69     pgpHashAlgo digestalgo;     /*!< File digest algorithm */
70     unsigned char * digests;    /*!< File digests in binary. */
71
72     char * fn;                  /*!< File name buffer. */
73
74     size_t striplen;
75     rpm_loff_t archiveSize;
76     char ** apath;
77     FSM_t fsm;                  /*!< File state machine data. */
78     rpm_off_t * replacedSizes;  /*!< (TR_ADDED) */
79     int magic;
80     int nrefs;          /*!< Reference count. */
81 };
82
83 RPM_GNUC_INTERNAL
84 int rpmfiDIIndex(rpmfi fi, int dx);
85
86 RPM_GNUC_INTERNAL
87 const char * rpmfiBNIndex(rpmfi fi, int ix);
88
89 RPM_GNUC_INTERNAL
90 const char * rpmfiDNIndex(rpmfi fi, int jx);
91
92 RPM_GNUC_INTERNAL
93 const char * rpmfiFNIndex(rpmfi fi, int ix);
94
95 RPM_GNUC_INTERNAL
96 rpmVerifyAttrs rpmfiVFlagsIndex(rpmfi fi, int ix);
97
98 RPM_GNUC_INTERNAL
99 rpmfileState rpmfiFStateIndex(rpmfi fi, int ix);
100
101 RPM_GNUC_INTERNAL
102 const char * rpmfiFLinkIndex(rpmfi fi, int ix);
103
104 RPM_GNUC_INTERNAL
105 rpm_loff_t rpmfiFSizeIndex(rpmfi fi, int ix);
106
107 RPM_GNUC_INTERNAL
108 rpm_color_t rpmfiFColorIndex(rpmfi fi, int ix);
109
110 RPM_GNUC_INTERNAL
111 const char * rpmfiFClassIndex(rpmfi fi, int ix);
112
113 RPM_GNUC_INTERNAL
114 uint32_t rpmfiFDependsIndex(rpmfi fi, int ix, const uint32_t ** fddictp);
115
116 RPM_GNUC_INTERNAL
117 uint32_t rpmfiFNlinkIndex(rpmfi fi, int ix);
118
119 RPM_GNUC_INTERNAL
120 const char * rpmfiFLangsIndex(rpmfi fi, int ix);
121
122 RPM_GNUC_INTERNAL
123 rpmfileAttrs rpmfiFFlagsIndex(rpmfi fi, int ix);
124
125 RPM_GNUC_INTERNAL
126 rpm_mode_t rpmfiFModeIndex(rpmfi fi, int ix);
127
128 RPM_GNUC_INTERNAL
129 const unsigned char * rpmfiFDigestIndex(rpmfi fi, int ix, pgpHashAlgo *algo, size_t *len);
130
131 RPM_GNUC_INTERNAL
132 rpm_rdev_t rpmfiFRdevIndex(rpmfi fi, int ix);
133
134 RPM_GNUC_INTERNAL
135 rpm_ino_t rpmfiFInodeIndex(rpmfi fi, int ix);
136
137 RPM_GNUC_INTERNAL
138 rpm_time_t rpmfiFMtimeIndex(rpmfi fi, int ix);
139
140 RPM_GNUC_INTERNAL
141 const char * rpmfiFUserIndex(rpmfi fi, int ix);
142
143 RPM_GNUC_INTERNAL
144 const char * rpmfiFGroupIndex(rpmfi fi, int ix);
145
146 RPM_GNUC_INTERNAL
147 const char * rpmfiFCapsIndex(rpmfi fi, int ix);
148
149 RPM_GNUC_INTERNAL
150 struct fingerPrint_s *rpmfiFpsIndex(rpmfi fi, int ix);
151
152 RPM_GNUC_INTERNAL
153 void rpmfiSetFReplacedSize(rpmfi fi, rpm_loff_t newsize);
154
155 RPM_GNUC_INTERNAL
156 rpm_loff_t rpmfiFReplacedSize(rpmfi fi);
157
158 RPM_GNUC_INTERNAL
159 void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc);
160
161 /* XXX can't be internal as build code needs this */
162 FSM_t rpmfiFSM(rpmfi fi);
163 #endif  /* _RPMFI_INTERNAL_H */
164