rpm  5.4.10
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,
18 } rpmRC;
19 
23 typedef /*@unsignedintegraltype@*/ unsigned char rpmuint8_t;
24 typedef /*@unsignedintegraltype@*/ unsigned short rpmuint16_t;
25 typedef /*@unsignedintegraltype@*/ unsigned int rpmuint32_t;
26 typedef /*@unsignedintegraltype@*/ unsigned long long rpmuint64_t;
27 
30 typedef /*@signedintegraltype@*/ int rpmint32_t;
31 
34 typedef struct yarnLock_s * yarnLock;
35 
38 typedef /*@refcounted@*/ struct rpmioItem_s * rpmioItem;
39 struct rpmioItem_s {
40 /*@null@*/
42 /*@kept@*/ /*@null@*/
43  void *pool;
44  void *next;
45 #if defined(__LCLINT__)
46 /*@refs@*/
47  int nrefs;
48 #endif
49 };
50 
53 typedef struct rpmioPool_s * rpmioPool;
54 
57 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmiob_s * rpmiob;
58 
61 /*@unchecked@*/
62 extern size_t _rpmiob_chunk;
63 
66 typedef struct rpmioP_s {
67  char * str;
68  char * next;
69  const char ** av;
70  int ac;
71 } * rpmioP;
72 
75 typedef /*@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
76 
79 typedef /*@abstract@*/ struct pgpPkt_s * pgpPkt;
80 
83 typedef /*@abstract@*/ /*@refcounted@*/ struct pgpDig_s * pgpDig;
84 
87 typedef /*@abstract@*/ struct pgpDigParams_s * pgpDigParams;
88 
92 
95 typedef rpmuint8_t pgpTime_t[4];
96 
100 typedef enum pgpVSFlags_e {
102  RPMVSF_NOHDRCHK = (1 << 0),
103  RPMVSF_NEEDPAYLOAD = (1 << 1),
104  /* bit(s) 2-7 unused */
106  RPMVSF_NOMD5HEADER = (1 << 9), /* unimplemented */
107  RPMVSF_NODSAHEADER = (1 << 10),
108  RPMVSF_NORSAHEADER = (1 << 11),
109  /* bit(s) 12-15 unused */
110  RPMVSF_NOSHA1 = (1 << 16), /* unimplemented */
111  RPMVSF_NOMD5 = (1 << 17),
112  RPMVSF_NODSA = (1 << 18),
113  RPMVSF_NORSA = (1 << 19)
114  /* bit(s) 20-31 unused */
115 } pgpVSFlags;
116 
117 /*@-redef@*/ /* LCL: ??? */
118 typedef /*@abstract@*/ const void * fnpyKey;
119 /*@=redef@*/
120 
124 typedef enum rpmCallbackType_e {
143 
146 typedef void * rpmCallbackData;
147 
168 typedef enum pgpHashAlgo_e {
295 } pgpHashAlgo;
296 
300 typedef enum rpmDigestFlags_e {
303 
304 #if defined(_RPMIOB_INTERNAL)
305 
307 struct rpmiob_s {
308  struct rpmioItem_s _item;
309  rpmuint8_t * b;
310  size_t blen;
311  size_t allocated;
312 #if defined(__LCLINT__)
313 /*@refs@*/
314  int nrefs;
315 #endif
316 };
317 #endif
318 
319 #ifdef __cplusplus
320 extern "C" {
321 #endif
322 
328 pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
329  /*@*/;
330 
336 rpmDigestFlags rpmDigestF(DIGEST_CTX ctx)
337  /*@*/;
338 
344 /*@observer@*/
345 const char * rpmDigestName(DIGEST_CTX ctx)
346  /*@*/;
347 
354 /*@observer@*/ /*@null@*/
355 const char * rpmDigestASN1(DIGEST_CTX ctx)
356  /*@*/;
357 
363 /*@only@*/
364 DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
365  /*@*/;
366 
374 /*@only@*/ /*@null@*/
375 DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
376  /*@*/;
377 
385 int rpmDigestUpdate(/*@null@*/ DIGEST_CTX ctx, const void * data, size_t len)
386  /*@modifies ctx @*/;
387 
397 int rpmDigestFinal(/*@only@*/ /*@null@*/ DIGEST_CTX ctx,
398  /*@null@*/ /*@out@*/ void * datap,
399  /*@null@*/ /*@out@*/ size_t * lenp, int asAscii)
400  /*@modifies *datap, *lenp @*/;
401 
410 int rpmHmacInit(DIGEST_CTX ctx, const void * key, size_t keylen)
411  /*@*/;
412 
415 typedef void * (*rpmCallbackFunction)
416  (/*@null@*/ const void * h,
417  const rpmCallbackType what,
418  const rpmuint64_t amount,
419  const rpmuint64_t total,
420  /*@null@*/ fnpyKey key,
421  /*@null@*/ rpmCallbackData data)
422  /*@globals internalState@*/
423  /*@modifies internalState@*/;
424 
425 /*@unused@*/ static inline int xislower(int c) /*@*/ {
426  return (c >= (int)'a' && c <= (int)'z');
427 }
428 /*@unused@*/ static inline int xisupper(int c) /*@*/ {
429  return (c >= (int)'A' && c <= (int)'Z');
430 }
431 /*@unused@*/ static inline int xisalpha(int c) /*@*/ {
432  return (xislower(c) || xisupper(c));
433 }
434 /*@unused@*/ static inline int xisdigit(int c) /*@*/ {
435  return (c >= (int)'0' && c <= (int)'9');
436 }
437 /*@unused@*/ static inline int xisalnum(int c) /*@*/ {
438  return (xisalpha(c) || xisdigit(c));
439 }
440 /*@unused@*/ static inline int xisblank(int c) /*@*/ {
441  return (c == (int)' ' || c == (int)'\t');
442 }
443 /*@unused@*/ static inline int xisspace(int c) /*@*/ {
444  return (xisblank(c) || c == (int)'\n' || c == (int)'\r' || c == (int)'\f' || c == (int)'\v');
445 }
446 /*@unused@*/ static inline int xiscntrl(int c) /*@*/ {
447  return (c < (int)' ');
448 }
449 /*@unused@*/ static inline int xisascii(int c) /*@*/ {
450  return ((c & 0x80) != 0x80);
451 }
452 /*@unused@*/ static inline int xisprint(int c) /*@*/ {
453  return (c >= (int)' ' && xisascii(c));
454 }
455 /*@unused@*/ static inline int xisgraph(int c) /*@*/ {
456  return (c > (int)' ' && xisascii(c));
457 }
458 /*@unused@*/ static inline int xispunct(int c) /*@*/ {
459  return (xisgraph(c) && !xisalnum(c));
460 }
461 
462 /*@unused@*/ static inline int xtolower(int c) /*@*/ {
463  return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
464 }
465 /*@unused@*/ static inline int xtoupper(int c) /*@*/ {
466  return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
467 }
468 
472 int xstrcasecmp(const char * s1, const char * s2) /*@*/;
473 
477 int xstrncasecmp(const char *s1, const char * s2, size_t n) /*@*/;
478 
482 /*@only@*/ /*@null@*/
483 const char * xstrtolocale(/*@only@*/ const char *str)
484  /*@modifies *str @*/;
485 
491 /*@unused@*/ /*@null@*/
492 rpmiob rpmiobUnlink (/*@killref@*/ /*@null@*/ rpmiob iob)
493  /*@globals fileSystem @*/
494  /*@modifies iob, fileSystem @*/;
495 #define rpmiobUnlink(_iob) \
496  ((rpmiob)rpmioUnlinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
497 
503 /*@unused@*/ /*@newref@*/ /*@null@*/
504 rpmiob rpmiobLink (/*@null@*/ rpmiob iob)
505  /*@globals fileSystem @*/
506  /*@modifies iob, fileSystem @*/;
507 #define rpmiobLink(_iob) \
508  ((rpmiob)rpmioLinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
509 
515 /*@null@*/
516 rpmiob rpmiobFree( /*@killref@*/ rpmiob iob)
517  /*@globals fileSystem @*/
518  /*@modifies iob, fileSystem @*/;
519 #define rpmiobFree(_iob) \
520  ((rpmiob)rpmioFreePoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
521 
527 /*@newref@*/ /*@null@*/
528 rpmiob rpmiobNew(size_t len)
529  /*@globals fileSystem @*/
530  /*@modifies fileSystem @*/;
531 
537 rpmiob rpmiobEmpty(/*@returned@*/ rpmiob iob)
538  /*@modifies iob @*/;
539 
545 rpmiob rpmiobRTrim(/*@returned@*/ rpmiob iob)
546  /*@modifies iob @*/;
547 
555 rpmiob rpmiobAppend(/*@returned@*/ rpmiob iob, const char * s, size_t nl)
556  /*@modifies iob @*/;
557 
564  /*@*/;
565 
571 char * rpmiobStr(rpmiob iob)
572  /*@*/;
573 
579 size_t rpmiobLen(rpmiob iob)
580  /*@*/;
581 
582 #if defined(_RPMIOB_INTERNAL)
583 
589 int rpmiobSlurp(const char * fn, rpmiob * iobp)
590  /*@globals h_errno, fileSystem, internalState @*/
591  /*@modifies *iobp, fileSystem, internalState @*/;
592 #endif
593 
599 /*@null@*/
600 rpmioP rpmioPFree(/*@only@*/ /*@null@*/ rpmioP P)
601  /*@modifies P @*/;
602 
609 rpmRC rpmioParse(rpmioP *Pptr, const char * str)
610  /*@modifies *Pptr @*/;
611 
612 #ifdef __cplusplus
613 }
614 #endif
615 
616 #if !defined(SWIG)
617 
622 #if defined(WITH_DMALLOC)
623 #define _free(p) ((p) != NULL ? free((void *)(p)) : (void)0, NULL)
624 #else
625 
626 #ifdef __cplusplus
627 
628 #define GENfree(_t) \
629  static inline _t _free(_t p) { if (p) free((void *)p); return (_t)NULL; }
630 #define GENpair(_t) \
631  GENfree(const _t) \
632  GENfree( _t)
633 
634 GENpair(void *)
635 GENpair(char *)
636 GENpair(char **)
637 GENpair(unsigned char *)
638 GENfree(DIGEST_CTX)
639 GENfree(DIGEST_CTX *)
640 
641 #else /* __cplusplus */
642 
643 /*@unused@*/ static inline /*@null@*/
644 void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
645  /*@modifies p @*/
646 {
647  if (p != NULL) free((void *)p);
648  return NULL;
649 }
650 #endif /* __cplusplus */
651 
652 #endif /* defined(WITH_DMALLOC) */
653 #endif /* !defined(SWIG) */
654 
655 #endif /* _H_RPMIOTYPES_ */