rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

rpmiotypes.h
Go to the documentation of this file.
1 #ifndef _H_RPMIOTYPES_
2 #define _H_RPMIOTYPES_
3
11 typedef enum rpmRC_e {
12 RPMRC_OK = 0,
13 RPMRC_NOTFOUND = 1,
14 RPMRC_FAIL = 2,
15 RPMRC_NOTTRUSTED = 3,
16 RPMRC_NOKEY = 4
17 } rpmRC;
18
22 typedef /*@unsignedintegraltype@*/ unsigned char rpmuint8_t;
23 typedef /*@unsignedintegraltype@*/ unsigned short rpmuint16_t;
24 typedef /*@unsignedintegraltype@*/ unsigned int rpmuint32_t;
25 typedef /*@unsignedintegraltype@*/ unsigned long long rpmuint64_t;
26
29 typedef /*@signedintegraltype@*/ int rpmint32_t;
30
33 typedef /*@refcounted@*/ struct rpmioItem_s * rpmioItem;
34 struct rpmioItem_s {
35 /*@null@*/
36 void *use;
37 /*@kept@*/ /*@null@*/
38 void *pool;
39 #if defined(__LCLINT__)
40 /*@refs@*/
41 int nrefs;
42 #endif
43 };
44
47 typedef struct rpmioPool_s * rpmioPool;
48
51 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmiob_s * rpmiob;
52
55 /*@unchecked@*/
56 extern size_t _rpmiob_chunk;
57
60 typedef /*@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
61
64 typedef /*@abstract@*/ struct pgpPkt_s * pgpPkt;
65
68 typedef /*@abstract@*/ /*@refcounted@*/ struct pgpDig_s * pgpDig;
69
72 typedef /*@abstract@*/ struct pgpDigParams_s * pgpDigParams;
73
76 typedef rpmuint8_t pgpKeyID_t[8];
77
80 typedef rpmuint8_t pgpTime_t[4];
81
85 typedef enum pgpVSFlags_e {
86 RPMVSF_DEFAULT = 0,
87 RPMVSF_NOHDRCHK = (1 << 0),
88 RPMVSF_NEEDPAYLOAD = (1 << 1),
89 /* bit(s) 2-7 unused */
90 RPMVSF_NOSHA1HEADER = (1 << 8),
91 RPMVSF_NOMD5HEADER = (1 << 9), /* unimplemented */
92 RPMVSF_NODSAHEADER = (1 << 10),
93 RPMVSF_NORSAHEADER = (1 << 11),
94 /* bit(s) 12-15 unused */
95 RPMVSF_NOSHA1 = (1 << 16), /* unimplemented */
96 RPMVSF_NOMD5 = (1 << 17),
97 RPMVSF_NODSA = (1 << 18),
98 RPMVSF_NORSA = (1 << 19)
99 /* bit(s) 20-31 unused */
100 } pgpVSFlags;
101
102 #define _RPMVSF_NODIGESTS \
103 ( RPMVSF_NOSHA1HEADER | \
104 RPMVSF_NOMD5HEADER | \
105 RPMVSF_NOSHA1 | \
106 RPMVSF_NOMD5 )
107
108 #define _RPMVSF_NOSIGNATURES \
109 ( RPMVSF_NODSAHEADER | \
110 RPMVSF_NORSAHEADER | \
111 RPMVSF_NODSA | \
112 RPMVSF_NORSA )
113
114 #define _RPMVSF_NOHEADER \
115 ( RPMVSF_NOSHA1HEADER | \
116 RPMVSF_NOMD5HEADER | \
117 RPMVSF_NODSAHEADER | \
118 RPMVSF_NORSAHEADER )
119
120 #define _RPMVSF_NOPAYLOAD \
121 ( RPMVSF_NOSHA1 | \
122 RPMVSF_NOMD5 | \
123 RPMVSF_NODSA | \
124 RPMVSF_NORSA )
125
126 /*@-redef@*/ /* LCL: ??? */
127 typedef /*@abstract@*/ const void * fnpyKey;
128 /*@=redef@*/
129
133 typedef enum rpmCallbackType_e {
134 RPMCALLBACK_UNKNOWN = 0,
135 RPMCALLBACK_INST_PROGRESS = (1 << 0),
136 RPMCALLBACK_INST_START = (1 << 1),
137 RPMCALLBACK_INST_OPEN_FILE = (1 << 2),
138 RPMCALLBACK_INST_CLOSE_FILE = (1 << 3),
139 RPMCALLBACK_TRANS_PROGRESS = (1 << 4),
140 RPMCALLBACK_TRANS_START = (1 << 5),
141 RPMCALLBACK_TRANS_STOP = (1 << 6),
142 RPMCALLBACK_UNINST_PROGRESS = (1 << 7),
143 RPMCALLBACK_UNINST_START = (1 << 8),
144 RPMCALLBACK_UNINST_STOP = (1 << 9),
145 RPMCALLBACK_REPACKAGE_PROGRESS = (1 << 10),
146 RPMCALLBACK_REPACKAGE_START = (1 << 11),
147 RPMCALLBACK_REPACKAGE_STOP = (1 << 12),
148 RPMCALLBACK_UNPACK_ERROR = (1 << 13),
149 RPMCALLBACK_CPIO_ERROR = (1 << 14),
150 RPMCALLBACK_SCRIPT_ERROR = (1 << 15)
151 } rpmCallbackType;
152
155 typedef void * rpmCallbackData;
156
177 typedef enum pgpHashAlgo_e {
178 PGPHASHALGO_ERROR = -1,
179 PGPHASHALGO_NONE = 0,
180 PGPHASHALGO_MD5 = 1,
181 PGPHASHALGO_SHA1 = 2,
182 PGPHASHALGO_RIPEMD160 = 3,
183 PGPHASHALGO_MD2 = 5,
184 PGPHASHALGO_TIGER192 = 6,
185 PGPHASHALGO_HAVAL_5_160 = 7,
186 PGPHASHALGO_SHA256 = 8,
187 PGPHASHALGO_SHA384 = 9,
188 PGPHASHALGO_SHA512 = 10,
189 PGPHASHALGO_SHA224 = 11,
191 PGPHASHALGO_MD4 = 104,
192 PGPHASHALGO_RIPEMD128 = 105,
193 PGPHASHALGO_CRC32 = 106,
194 PGPHASHALGO_ADLER32 = 107,
195 PGPHASHALGO_CRC64 = 108,
196 PGPHASHALGO_JLU32 = 109,
198 PGPHASHALGO_RIPEMD256 = 111,
199 PGPHASHALGO_RIPEMD320 = 112,
200 PGPHASHALGO_SALSA10 = 113,
201 PGPHASHALGO_SALSA20 = 114,
203 } pgpHashAlgo;
204
208 typedef enum rpmDigestFlags_e {
209 RPMDIGEST_NONE = 0
210 } rpmDigestFlags;
211
212
213 #if defined(_RPMIOB_INTERNAL)
214
216 struct rpmiob_s{
217 struct rpmioItem_s _item;
218 rpmuint8_t * b;
219 size_t blen;
220 size_t allocated;
221 #if defined(__LCLINT__)
222 /*@refs@*/
223 int nrefs;
224 #endif
225 };
226 #endif
227
228 #ifdef __cplusplus
229 extern "C" {
230 #endif
231
237 pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
238 /*@*/;
239
245 /*@observer@*/
246 const char * rpmDigestName(DIGEST_CTX ctx)
247 /*@*/;
248
255 /*@observer@*/ /*@null@*/
256 const char * rpmDigestASN1(DIGEST_CTX ctx)
257 /*@*/;
258
264 /*@only@*/
265 DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
266 /*@*/;
267
275 /*@only@*/ /*@null@*/
276 DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
277 /*@*/;
278
286 int rpmDigestUpdate(/*@null@*/ DIGEST_CTX ctx, const void * data, size_t len)
287 /*@modifies ctx @*/;
288
300 int rpmDigestFinal(/*@only@*/ /*@null@*/ DIGEST_CTX ctx,
301 /*@null@*/ /*@out@*/ void * datap,
302 /*@null@*/ /*@out@*/ size_t * lenp, int asAscii)
303 /*@modifies *datap, *lenp @*/;
304
307 typedef void * (*rpmCallbackFunction)
308 (/*@null@*/ const void * h,
309 const rpmCallbackType what,
310 const rpmuint64_t amount,
311 const rpmuint64_t total,
312 /*@null@*/ fnpyKey key,
313 /*@null@*/ rpmCallbackData data)
314 /*@globals internalState@*/
315 /*@modifies internalState@*/;
316
317 #if !defined(SWIG)
318
323 #if defined(WITH_DMALLOC)
324 #define _free(p) ((p) != NULL ? free((void *)(p)) : (void)0, NULL)
325 #else
326 /*@unused@*/ static inline /*@null@*/
327 void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
328 /*@modifies p @*/
329 {
330 if (p != NULL) free((void *)p);
331 return NULL;
332 }
333 #endif
334 #endif
335
336 /*@unused@*/ static inline int xislower(int c) /*@*/ {
337 return (c >= (int)'a' && c <= (int)'z');
338 }
339 /*@unused@*/ static inline int xisupper(int c) /*@*/ {
340 return (c >= (int)'A' && c <= (int)'Z');
341 }
342 /*@unused@*/ static inline int xisalpha(int c) /*@*/ {
343 return (xislower(c) || xisupper(c));
344 }
345 /*@unused@*/ static inline int xisdigit(int c) /*@*/ {
346 return (c >= (int)'0' && c <= (int)'9');
347 }
348 /*@unused@*/ static inline int xisalnum(int c) /*@*/ {
349 return (xisalpha(c) || xisdigit(c));
350 }
351 /*@unused@*/ static inline int xisblank(int c) /*@*/ {
352 return (c == (int)' ' || c == (int)'\t');
353 }
354 /*@unused@*/ static inline int xisspace(int c) /*@*/ {
355 return (xisblank(c) || c == (int)'\n' || c == (int)'\r' || c == (int)'\f' || c == (int)'\v');
356 }
357 /*@unused@*/ static inline int xiscntrl(int c) /*@*/ {
358 return (c < (int)' ');
359 }
360 /*@unused@*/ static inline int xisascii(int c) /*@*/ {
361 return ((c & 0x80) != 0x80);
362 }
363 /*@unused@*/ static inline int xisprint(int c) /*@*/ {
364 return (c >= (int)' ' && xisascii(c));
365 }
366 /*@unused@*/ static inline int xisgraph(int c) /*@*/ {
367 return (c > (int)' ' && xisascii(c));
368 }
369 /*@unused@*/ static inline int xispunct(int c) /*@*/ {
370 return (xisgraph(c) && !xisalnum(c));
371 }
372
373 /*@unused@*/ static inline int xtolower(int c) /*@*/ {
374 return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
375 }
376 /*@unused@*/ static inline int xtoupper(int c) /*@*/ {
377 return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
378 }
379
383 int xstrcasecmp(const char * s1, const char * s2) /*@*/;
384
388 int xstrncasecmp(const char *s1, const char * s2, size_t n) /*@*/;
389
393 /*@only@*/ /*@null@*/
394 const char * xstrtolocale(/*@only@*/ const char *str)
395 /*@modifies *str @*/;
396
402 /*@unused@*/ /*@null@*/
403 rpmiob rpmiobUnlink (/*@killref@*/ /*@null@*/ rpmiob iob)
404 /*@globals fileSystem @*/
405 /*@modifies iob, fileSystem @*/;
406 #define rpmiobUnlink(_iob) \
407 ((rpmiob)rpmioUnlinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
408
414 /*@unused@*/ /*@newref@*/ /*@null@*/
415 rpmiob rpmiobLink (/*@null@*/ rpmiob iob)
416 /*@globals fileSystem @*/
417 /*@modifies iob, fileSystem @*/;
418 #define rpmiobLink(_iob) \
419 ((rpmiob)rpmioLinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
420
426 /*@null@*/
427 rpmiob rpmiobFree( /*@killref@*/ rpmiob iob)
428 /*@globals fileSystem @*/
429 /*@modifies iob, fileSystem @*/;
430 #define rpmiobFree(_iob) \
431 ((rpmiob)rpmioFreePoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
432
438 /*@newref@*/ /*@null@*/
439 rpmiob rpmiobNew(size_t len)
440 /*@globals fileSystem @*/
441 /*@modifies fileSystem @*/;
442
448 rpmiob rpmiobEmpty(/*@returned@*/ rpmiob iob)
449 /*@modifies iob @*/;
450
456 rpmiob rpmiobRTrim(/*@returned@*/ rpmiob iob)
457 /*@modifies iob @*/;
458
466 rpmiob rpmiobAppend(/*@returned@*/ rpmiob iob, const char * s, size_t nl)
467 /*@modifies iob @*/;
468
474 rpmuint8_t * rpmiobBuf(rpmiob iob)
475 /*@*/;
476
482 char * rpmiobStr(rpmiob iob)
483 /*@*/;
484
490 size_t rpmiobLen(rpmiob iob)
491 /*@*/;
492
493 #if defined(_RPMIOB_INTERNAL)
494
500 int rpmiobSlurp(const char * fn, rpmiob * iobp)
501 /*@globals h_errno, fileSystem, internalState @*/
502 /*@modifies *iobp, fileSystem, internalState @*/;
503 #endif
504
505 #ifdef __cplusplus
506 }
507 #endif
508
509 #endif /* _H_RPMIOTYPES_ */