rpm: /srv/include/rpm/rpmfiles.h Source File

rpm 4.20.1 The RPM Package Manager

Loading...
Searching...
No Matches
rpmfiles.h
Go to the documentation of this file.
1#ifndef _RPMFILES_H
2#define _RPMFILES_H
3
8#include <sys/types.h>
9#include <sys/stat.h>
10#include <unistd.h>
11
12#include <rpm/rpmtypes.h>
13
21 typedef enum rpmFileTypes_e {
22 PIPE = 1,
23 CDEV = 2,
24 XDIR = 4,
25 BDEV = 6,
26 REG = 8,
27 LINK = 10,
28 SOCK = 12
29} rpmFileTypes;
30
34 typedef enum rpmfileState_e {
35 RPMFILE_STATE_MISSING = -1, /* used for unavailable data */
36 RPMFILE_STATE_NORMAL = 0,
37 RPMFILE_STATE_REPLACED = 1,
38 RPMFILE_STATE_NOTINSTALLED = 2,
39 RPMFILE_STATE_NETSHARED = 3,
40 RPMFILE_STATE_WRONGCOLOR = 4
41} rpmfileState;
42
43#define RPMFILE_IS_INSTALLED(_x) ((_x) == RPMFILE_STATE_NORMAL || (_x) == RPMFILE_STATE_NETSHARED)
44
48 enum rpmfileAttrs_e {
49 RPMFILE_NONE = 0,
50 RPMFILE_CONFIG = (1 << 0),
51 RPMFILE_DOC = (1 << 1),
52 RPMFILE_ICON = (1 << 2),
53 RPMFILE_MISSINGOK = (1 << 3),
54 RPMFILE_NOREPLACE = (1 << 4),
55 RPMFILE_SPECFILE = (1 << 5),
56 RPMFILE_GHOST = (1 << 6),
57 RPMFILE_LICENSE = (1 << 7),
58 RPMFILE_README = (1 << 8),
59 /* bits 9-10 unused */
60 RPMFILE_PUBKEY = (1 << 11),
61 RPMFILE_ARTIFACT = (1 << 12),
62};
63
64typedef rpmFlags rpmfileAttrs;
65
66#define RPMFILE_ALL ~(RPMFILE_NONE)
67
72 enum rpmVerifyAttrs_e {
73 RPMVERIFY_NONE = 0,
74 RPMVERIFY_MD5 = (1 << 0),
75 RPMVERIFY_FILEDIGEST= (1 << 0),
76 RPMVERIFY_FILESIZE = (1 << 1),
77 RPMVERIFY_LINKTO = (1 << 2),
78 RPMVERIFY_USER = (1 << 3),
79 RPMVERIFY_GROUP = (1 << 4),
80 RPMVERIFY_MTIME = (1 << 5),
81 RPMVERIFY_MODE = (1 << 6),
82 RPMVERIFY_RDEV = (1 << 7),
83 RPMVERIFY_CAPS = (1 << 8),
84 /* bits 9-14 unused, reserved for rpmVerifyAttrs */
85 RPMVERIFY_CONTEXTS = (1 << 15),
86 /* bits 16-22 used in rpmVerifyFlags */
87 /* bits 23-27 used in rpmQueryFlags */
88 RPMVERIFY_READLINKFAIL= (1 << 28),
89 RPMVERIFY_READFAIL = (1 << 29),
90 RPMVERIFY_LSTATFAIL = (1 << 30),
91 RPMVERIFY_LGETFILECONFAIL = (1 << 31)
92};
93
94typedef rpmFlags rpmVerifyAttrs;
95
96#define RPMVERIFY_ALL ~(RPMVERIFY_NONE)
97#define RPMVERIFY_FAILURES \
98 (RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL)
99
103 typedef enum rpmFileAction_e {
104 FA_UNKNOWN = 0,
105 FA_CREATE = 1,
106 FA_COPYIN = 2,
107 FA_COPYOUT = 3,
108 FA_BACKUP = 4,
109 FA_SAVE = 5,
110 FA_SKIP = 6,
111 FA_ALTNAME = 7,
112 FA_ERASE = 8,
113 FA_SKIPNSTATE = 9,
114 FA_SKIPNETSHARED = 10,
115 FA_SKIPCOLOR = 11,
116 FA_TOUCH = 12,
117 /* bits 16-31 reserved */
118} rpmFileAction;
119
120#define XFA_SKIPPING(_a) \
121 ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)
122
123#define XFA_CREATING(_a) \
124 ((_a) == FA_CREATE || (_a) == FA_BACKUP || (_a) == FA_SAVE || (_a) == FA_ALTNAME)
125
129 struct rpmRelocation_s {
130 char * oldPath;
131 char * newPath;
132};
133
134enum rpmfiFlags_e {
135 RPMFI_NOHEADER = 0,
136 RPMFI_KEEPHEADER = (1 << 0),
137 RPMFI_NOFILECLASS = (1 << 1),
138 RPMFI_NOFILEDEPS = (1 << 2),
139 RPMFI_NOFILELANGS = (1 << 3),
140 RPMFI_NOFILEUSER = (1 << 4),
141 RPMFI_NOFILEGROUP = (1 << 5),
142 RPMFI_NOFILEMODES = (1 << 6),
143 RPMFI_NOFILESIZES = (1 << 7),
144 RPMFI_NOFILECAPS = (1 << 8),
145 RPMFI_NOFILELINKTOS = (1 << 9),
146 RPMFI_NOFILEDIGESTS = (1 << 10),
147 RPMFI_NOFILEMTIMES = (1 << 11),
148 RPMFI_NOFILERDEVS = (1 << 12),
149 RPMFI_NOFILEINODES = (1 << 13),
150 RPMFI_NOFILESTATES = (1 << 14),
151 RPMFI_NOFILECOLORS = (1 << 15),
152 RPMFI_NOFILEVERIFYFLAGS = (1 << 16),
153 RPMFI_NOFILEFLAGS = (1 << 17),
154 RPMFI_NOFILESIGNATURES = (1 << 18),
155 RPMFI_NOVERITYSIGNATURES = (1 << 19),
156};
157
158typedef rpmFlags rpmfiFlags;
159
160#define RPMFI_FLAGS_ERASE \
161 (RPMFI_NOFILECLASS | RPMFI_NOFILELANGS | \
162 RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | \
163 RPMFI_NOFILESIGNATURES | RPMFI_NOVERITYSIGNATURES | \
164 RPMFI_NOFILEVERIFYFLAGS)
165
166#define RPMFI_FLAGS_INSTALL \
167 (RPMFI_NOFILECLASS | RPMFI_NOFILEVERIFYFLAGS)
168
169#define RPMFI_FLAGS_VERIFY \
170 (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
171 RPMFI_NOFILECOLORS)
172
173#define RPMFI_FLAGS_QUERY \
174 (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
175 RPMFI_NOFILECOLORS | RPMFI_NOFILEVERIFYFLAGS)
176
177#define RPMFI_FLAGS_FILETRIGGER \
178 (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
179 RPMFI_NOFILEUSER | RPMFI_NOFILEGROUP | RPMFI_NOFILEMODES | \
180 RPMFI_NOFILESIZES | RPMFI_NOFILECAPS | RPMFI_NOFILELINKTOS | \
181 RPMFI_NOFILEDIGESTS | RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | \
182 RPMFI_NOFILEINODES | RPMFI_NOFILECOLORS | \
183 RPMFI_NOFILESIGNATURES | RPMFI_NOVERITYSIGNATURES | \
184 RPMFI_NOFILEVERIFYFLAGS | RPMFI_NOFILEFLAGS)
185
186#define RPMFI_FLAGS_ONLY_FILENAMES \
187 (RPMFI_FLAGS_FILETRIGGER | RPMFI_NOFILESTATES)
188
189typedef enum rpmFileIter_e {
190 RPMFI_ITER_FWD = 0,
191 RPMFI_ITER_BACK = 1,
192 RPMFI_ITER_WRITE_ARCHIVE = 2,
193 RPMFI_ITER_READ_ARCHIVE = 3,
194 RPMFI_ITER_READ_ARCHIVE_CONTENT_FIRST = 4,
195 RPMFI_ITER_READ_ARCHIVE_OMIT_HARDLINKS = 5,
196 RPMFI_ITER_INTERVAL = 6,
197} rpmFileIter;
198
199#define RPMFILEITERMAX 6
200
201#ifdef __cplusplus
202extern "C" {
203#endif
204
213rpmfiles rpmfilesNew(rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags);
214
220rpmfiles rpmfilesLink(rpmfiles fi);
221
227rpmfiles rpmfilesFree(rpmfiles fi);
228
234rpm_count_t rpmfilesFC(rpmfiles fi);
235
241rpm_count_t rpmfilesDC(rpmfiles fi);
242
251 int rpmfilesFindFN(rpmfiles files, const char * fn);
252
261 int rpmfilesFindOFN(rpmfiles files, const char * fn);
262
263rpmfi rpmfilesIter(rpmfiles files, int itype);
264
270 int rpmfilesDigestAlgo(rpmfiles fi);
271
277rpm_color_t rpmfilesColor(rpmfiles files);
278
287 int rpmfilesCompare(rpmfiles afi, int aix, rpmfiles bfi, int bix);
288
295 const char * rpmfilesBN(rpmfiles fi, int ix);
296
308 const char * rpmfilesDN(rpmfiles fi, int jx);
309
316 int rpmfilesDI(rpmfiles fi, int ix);
317
324 char * rpmfilesFN(rpmfiles fi, int ix);
325
332 int rpmfilesODI(rpmfiles fi, int ix);
333
340 const char * rpmfilesOBN(rpmfiles fi, int ix);
341
353 const char * rpmfilesODN(rpmfiles fi, int jx);
354
361 char * rpmfilesOFN(rpmfiles fi, int ix);
362
369rpmVerifyAttrs rpmfilesVFlags(rpmfiles fi, int ix);
370
377 rpmfileState rpmfilesFState(rpmfiles fi, int ix);
378
385 const char * rpmfilesFLink(rpmfiles fi, int ix);
386
393rpm_loff_t rpmfilesFSize(rpmfiles fi, int ix);
394
401rpm_color_t rpmfilesFColor(rpmfiles fi, int ix);
402
409 const char * rpmfilesFClass(rpmfiles fi, int ix);
410
418uint32_t rpmfilesFDepends(rpmfiles fi, int ix, const uint32_t ** fddictp);
419
426uint32_t rpmfilesFNlink(rpmfiles fi, int ix);
427
436uint32_t rpmfilesFLinks(rpmfiles fi, int ix, const int ** files);
437
444 const char * rpmfilesFLangs(rpmfiles fi, int ix);
445
452rpmfileAttrs rpmfilesFFlags(rpmfiles fi, int ix);
453
460rpm_mode_t rpmfilesFMode(rpmfiles fi, int ix);
461
470 const unsigned char * rpmfilesFDigest(rpmfiles fi, int ix, int *algo, size_t *len);
471
479 const unsigned char * rpmfilesFSignature(rpmfiles fi, int ix, size_t *len);
480
489 const unsigned char * rpmfilesVSignature(rpmfiles fi, int ix, size_t *len,
490 uint16_t *algo);
491
498rpm_rdev_t rpmfilesFRdev(rpmfiles fi, int ix);
499
506rpm_ino_t rpmfilesFInode(rpmfiles fi, int ix);
507
514rpm_time_t rpmfilesFMtime(rpmfiles fi, int ix);
515
522 const char * rpmfilesFUser(rpmfiles fi, int ix);
523
530 const char * rpmfilesFGroup(rpmfiles fi, int ix);
531
540 const char * rpmfilesFCaps(rpmfiles fi, int ix);
541
550 int rpmfilesStat(rpmfiles fi, int ix, int flags, struct stat *sb);
551
559rpmVerifyAttrs rpmfilesVerify(rpmfiles fi, int ix, rpmVerifyAttrs omitMask);
560
561#ifdef __cplusplus
562}
563#endif
564
565#endif /* _RPMFILES_H */
rpmfilesStat
int rpmfilesStat(rpmfiles fi, int ix, int flags, struct stat *sb)
rpmfilesDC
rpm_count_t rpmfilesDC(rpmfiles fi)
rpmfilesFSignature
const unsigned char * rpmfilesFSignature(rpmfiles fi, int ix, size_t *len)
rpmfilesVFlags
rpmVerifyAttrs rpmfilesVFlags(rpmfiles fi, int ix)
rpmfilesFLangs
const char * rpmfilesFLangs(rpmfiles fi, int ix)
rpmFileTypes
enum rpmFileTypes_e rpmFileTypes
rpmfilesFMode
rpm_mode_t rpmfilesFMode(rpmfiles fi, int ix)
rpmfilesFClass
const char * rpmfilesFClass(rpmfiles fi, int ix)
rpmfilesFInode
rpm_ino_t rpmfilesFInode(rpmfiles fi, int ix)
rpmfilesFindFN
int rpmfilesFindFN(rpmfiles files, const char *fn)
rpmfilesLink
rpmfiles rpmfilesLink(rpmfiles fi)
rpmfilesNew
rpmfiles rpmfilesNew(rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags)
rpmfilesBN
const char * rpmfilesBN(rpmfiles fi, int ix)
rpmfilesFGroup
const char * rpmfilesFGroup(rpmfiles fi, int ix)
rpmfilesFState
rpmfileState rpmfilesFState(rpmfiles fi, int ix)
rpmfilesOBN
const char * rpmfilesOBN(rpmfiles fi, int ix)
rpmfilesFDigest
const unsigned char * rpmfilesFDigest(rpmfiles fi, int ix, int *algo, size_t *len)
rpmfilesFLinks
uint32_t rpmfilesFLinks(rpmfiles fi, int ix, const int **files)
rpmfilesFColor
rpm_color_t rpmfilesFColor(rpmfiles fi, int ix)
rpmfilesFFlags
rpmfileAttrs rpmfilesFFlags(rpmfiles fi, int ix)
rpmFileAction
enum rpmFileAction_e rpmFileAction
rpmfilesFRdev
rpm_rdev_t rpmfilesFRdev(rpmfiles fi, int ix)
rpmfilesFLink
const char * rpmfilesFLink(rpmfiles fi, int ix)
rpmfilesDI
int rpmfilesDI(rpmfiles fi, int ix)
rpmFileAction_e
rpmFileAction_e
Definition rpmfiles.h:103
rpmfilesCompare
int rpmfilesCompare(rpmfiles afi, int aix, rpmfiles bfi, int bix)
rpmfilesDigestAlgo
int rpmfilesDigestAlgo(rpmfiles fi)
rpmfilesVerify
rpmVerifyAttrs rpmfilesVerify(rpmfiles fi, int ix, rpmVerifyAttrs omitMask)
rpmfilesFSize
rpm_loff_t rpmfilesFSize(rpmfiles fi, int ix)
rpmfilesFindOFN
int rpmfilesFindOFN(rpmfiles files, const char *fn)
rpmfilesFN
char * rpmfilesFN(rpmfiles fi, int ix)
rpmfilesFree
rpmfiles rpmfilesFree(rpmfiles fi)
rpmfilesODI
int rpmfilesODI(rpmfiles fi, int ix)
rpmfilesVSignature
const unsigned char * rpmfilesVSignature(rpmfiles fi, int ix, size_t *len, uint16_t *algo)
rpmFileTypes_e
rpmFileTypes_e
Definition rpmfiles.h:21
rpmfilesDN
const char * rpmfilesDN(rpmfiles fi, int jx)
rpmfilesFC
rpm_count_t rpmfilesFC(rpmfiles fi)
rpmfilesFUser
const char * rpmfilesFUser(rpmfiles fi, int ix)
rpmfilesFNlink
uint32_t rpmfilesFNlink(rpmfiles fi, int ix)
rpmfilesODN
const char * rpmfilesODN(rpmfiles fi, int jx)
rpmfilesFDepends
uint32_t rpmfilesFDepends(rpmfiles fi, int ix, const uint32_t **fddictp)
rpmfilesOFN
char * rpmfilesOFN(rpmfiles fi, int ix)
rpmfilesFMtime
rpm_time_t rpmfilesFMtime(rpmfiles fi, int ix)
rpmfilesFCaps
const char * rpmfilesFCaps(rpmfiles fi, int ix)
rpmfilesColor
rpm_color_t rpmfilesColor(rpmfiles files)
FA_BACKUP
@ FA_BACKUP
Definition rpmfiles.h:108
FA_CREATE
@ FA_CREATE
Definition rpmfiles.h:105
FA_UNKNOWN
@ FA_UNKNOWN
Definition rpmfiles.h:104
FA_COPYIN
@ FA_COPYIN
Definition rpmfiles.h:106
FA_SKIPNSTATE
@ FA_SKIPNSTATE
Definition rpmfiles.h:113
FA_SAVE
@ FA_SAVE
Definition rpmfiles.h:109
FA_COPYOUT
@ FA_COPYOUT
Definition rpmfiles.h:107
FA_SKIP
@ FA_SKIP
Definition rpmfiles.h:110
FA_SKIPCOLOR
@ FA_SKIPCOLOR
Definition rpmfiles.h:115
FA_ALTNAME
@ FA_ALTNAME
Definition rpmfiles.h:111
FA_TOUCH
@ FA_TOUCH
Definition rpmfiles.h:116
FA_ERASE
@ FA_ERASE
Definition rpmfiles.h:112
FA_SKIPNETSHARED
@ FA_SKIPNETSHARED
Definition rpmfiles.h:114
XDIR
@ XDIR
Definition rpmfiles.h:24
CDEV
@ CDEV
Definition rpmfiles.h:23
SOCK
@ SOCK
Definition rpmfiles.h:28
PIPE
@ PIPE
Definition rpmfiles.h:22
REG
@ REG
Definition rpmfiles.h:26
BDEV
@ BDEV
Definition rpmfiles.h:25
LINK
@ LINK
Definition rpmfiles.h:27
Header
struct headerToken_s * Header
Definition rpmtypes.h:24
rpmVerifyAttrs_e
rpmVerifyAttrs_e
Definition rpmfiles.h:72
RPMVERIFY_CAPS
@ RPMVERIFY_CAPS
Definition rpmfiles.h:83
RPMVERIFY_MTIME
@ RPMVERIFY_MTIME
Definition rpmfiles.h:80
RPMVERIFY_MD5
@ RPMVERIFY_MD5
Definition rpmfiles.h:74
RPMVERIFY_LGETFILECONFAIL
@ RPMVERIFY_LGETFILECONFAIL
Definition rpmfiles.h:91
RPMVERIFY_CONTEXTS
@ RPMVERIFY_CONTEXTS
Definition rpmfiles.h:85
RPMVERIFY_RDEV
@ RPMVERIFY_RDEV
Definition rpmfiles.h:82
RPMVERIFY_MODE
@ RPMVERIFY_MODE
Definition rpmfiles.h:81
RPMVERIFY_GROUP
@ RPMVERIFY_GROUP
Definition rpmfiles.h:79
RPMVERIFY_USER
@ RPMVERIFY_USER
Definition rpmfiles.h:78
RPMVERIFY_FILESIZE
@ RPMVERIFY_FILESIZE
Definition rpmfiles.h:76
RPMVERIFY_READFAIL
@ RPMVERIFY_READFAIL
Definition rpmfiles.h:89
RPMVERIFY_READLINKFAIL
@ RPMVERIFY_READLINKFAIL
Definition rpmfiles.h:88
RPMVERIFY_LSTATFAIL
@ RPMVERIFY_LSTATFAIL
Definition rpmfiles.h:90
RPMVERIFY_FILEDIGEST
@ RPMVERIFY_FILEDIGEST
Definition rpmfiles.h:75
RPMVERIFY_LINKTO
@ RPMVERIFY_LINKTO
Definition rpmfiles.h:77
rpmfileAttrs_e
rpmfileAttrs_e
Definition rpmfiles.h:48
RPMFILE_ARTIFACT
@ RPMFILE_ARTIFACT
Definition rpmfiles.h:61
RPMFILE_MISSINGOK
@ RPMFILE_MISSINGOK
Definition rpmfiles.h:53
RPMFILE_ICON
@ RPMFILE_ICON
Definition rpmfiles.h:52
RPMFILE_DOC
@ RPMFILE_DOC
Definition rpmfiles.h:51
RPMFILE_GHOST
@ RPMFILE_GHOST
Definition rpmfiles.h:56
RPMFILE_SPECFILE
@ RPMFILE_SPECFILE
Definition rpmfiles.h:55
RPMFILE_CONFIG
@ RPMFILE_CONFIG
Definition rpmfiles.h:50
RPMFILE_LICENSE
@ RPMFILE_LICENSE
Definition rpmfiles.h:57
RPMFILE_NOREPLACE
@ RPMFILE_NOREPLACE
Definition rpmfiles.h:54
RPMFILE_PUBKEY
@ RPMFILE_PUBKEY
Definition rpmfiles.h:60
RPMFILE_README
@ RPMFILE_README
Definition rpmfiles.h:58
rpmfileState
enum rpmfileState_e rpmfileState
rpmfileState_e
rpmfileState_e
Definition rpmfiles.h:34
rpmtypes.h
rpmRelocation_s
Definition rpmfiles.h:129
rpmRelocation_s::oldPath
char * oldPath
Definition rpmfiles.h:130
rpmRelocation_s::newPath
char * newPath
Definition rpmfiles.h:131