rpm  5.2.1
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,
14  RPMRC_FAIL = 2,
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 
77 
80 typedef rpmuint8_t pgpTime_t[4];
81 
85 typedef enum pgpVSFlags_e {
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 {
152 
155 typedef void * rpmCallbackData;
156 
177 typedef enum pgpHashAlgo_e {
203 } pgpHashAlgo;
204 
208 typedef enum rpmDigestFlags_e {
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 
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_ */