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 {
146 
149 typedef void * rpmCallbackData;
150 
171 typedef enum pgpHashAlgo_e {
298 } pgpHashAlgo;
299 
303 typedef enum rpmDigestFlags_e {
306 
307 #if defined(_RPMIOB_INTERNAL)
308 
310 struct rpmiob_s {
311  struct rpmioItem_s _item;
312  rpmuint8_t * b;
313  size_t blen;
314  size_t allocated;
315 #if defined(__LCLINT__)
316 /*@refs@*/
317  int nrefs;
318 #endif
319 };
320 #endif
321 
322 #ifdef __cplusplus
323 extern "C" {
324 #endif
325 
331 pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
332  /*@*/;
333 
339 rpmDigestFlags rpmDigestF(DIGEST_CTX ctx)
340  /*@*/;
341 
347 /*@observer@*/
348 const char * rpmDigestName(DIGEST_CTX ctx)
349  /*@*/;
350 
357 /*@observer@*/ /*@null@*/
358 const char * rpmDigestASN1(DIGEST_CTX ctx)
359  /*@*/;
360 
366 /*@only@*/
367 DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
368  /*@*/;
369 
377 /*@only@*/ /*@null@*/
378 DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
379  /*@*/;
380 
388 int rpmDigestUpdate(/*@null@*/ DIGEST_CTX ctx, const void * data, size_t len)
389  /*@modifies ctx @*/;
390 
400 int rpmDigestFinal(/*@only@*/ /*@null@*/ DIGEST_CTX ctx,
401  /*@null@*/ /*@out@*/ void * datap,
402  /*@null@*/ /*@out@*/ size_t * lenp, int asAscii)
403  /*@modifies *datap, *lenp @*/;
404 
413 int rpmHmacInit(DIGEST_CTX ctx, const void * key, size_t keylen)
414  /*@*/;
415 
418 typedef void * (*rpmCallbackFunction)
419  (/*@null@*/ const void * h,
420  const rpmCallbackType what,
421  const rpmuint64_t amount,
422  const rpmuint64_t total,
423  /*@null@*/ fnpyKey key,
424  /*@null@*/ rpmCallbackData data)
425  /*@globals internalState@*/
426  /*@modifies internalState@*/;
427 
428 /*@unused@*/ static inline int xislower(int c) /*@*/ {
429  return (c >= (int)'a' && c <= (int)'z');
430 }
431 /*@unused@*/ static inline int xisupper(int c) /*@*/ {
432  return (c >= (int)'A' && c <= (int)'Z');
433 }
434 /*@unused@*/ static inline int xisalpha(int c) /*@*/ {
435  return (xislower(c) || xisupper(c));
436 }
437 /*@unused@*/ static inline int xisdigit(int c) /*@*/ {
438  return (c >= (int)'0' && c <= (int)'9');
439 }
440 /*@unused@*/ static inline int xisalnum(int c) /*@*/ {
441  return (xisalpha(c) || xisdigit(c));
442 }
443 /*@unused@*/ static inline int xisblank(int c) /*@*/ {
444  return (c == (int)' ' || c == (int)'\t');
445 }
446 /*@unused@*/ static inline int xisspace(int c) /*@*/ {
447  return (xisblank(c) || c == (int)'\n' || c == (int)'\r' || c == (int)'\f' || c == (int)'\v');
448 }
449 /*@unused@*/ static inline int xiscntrl(int c) /*@*/ {
450  return (c < (int)' ');
451 }
452 /*@unused@*/ static inline int xisascii(int c) /*@*/ {
453  return ((c & 0x80) != 0x80);
454 }
455 /*@unused@*/ static inline int xisprint(int c) /*@*/ {
456  return (c >= (int)' ' && xisascii(c));
457 }
458 /*@unused@*/ static inline int xisgraph(int c) /*@*/ {
459  return (c > (int)' ' && xisascii(c));
460 }
461 /*@unused@*/ static inline int xispunct(int c) /*@*/ {
462  return (xisgraph(c) && !xisalnum(c));
463 }
464 
465 /*@unused@*/ static inline int xtolower(int c) /*@*/ {
466  return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
467 }
468 /*@unused@*/ static inline int xtoupper(int c) /*@*/ {
469  return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
470 }
471 
475 int xstrcasecmp(const char * s1, const char * s2) /*@*/;
476 
480 int xstrncasecmp(const char *s1, const char * s2, size_t n) /*@*/;
481 
485 /*@only@*/ /*@null@*/
486 const char * xstrtolocale(/*@only@*/ const char *str)
487  /*@modifies *str @*/;
488 
494 /*@unused@*/ /*@null@*/
495 rpmiob rpmiobUnlink (/*@killref@*/ /*@null@*/ rpmiob iob)
496  /*@globals fileSystem @*/
497  /*@modifies iob, fileSystem @*/;
498 #define rpmiobUnlink(_iob) \
499  ((rpmiob)rpmioUnlinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
500 
506 /*@unused@*/ /*@newref@*/ /*@null@*/
507 rpmiob rpmiobLink (/*@null@*/ rpmiob iob)
508  /*@globals fileSystem @*/
509  /*@modifies iob, fileSystem @*/;
510 #define rpmiobLink(_iob) \
511  ((rpmiob)rpmioLinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
512 
518 /*@null@*/
519 rpmiob rpmiobFree( /*@killref@*/ rpmiob iob)
520  /*@globals fileSystem @*/
521  /*@modifies iob, fileSystem @*/;
522 #define rpmiobFree(_iob) \
523  ((rpmiob)rpmioFreePoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
524 
530 /*@newref@*/ /*@null@*/
531 rpmiob rpmiobNew(size_t len)
532  /*@globals fileSystem @*/
533  /*@modifies fileSystem @*/;
534 
540 rpmiob rpmiobEmpty(/*@returned@*/ rpmiob iob)
541  /*@modifies iob @*/;
542 
548 rpmiob rpmiobRTrim(/*@returned@*/ rpmiob iob)
549  /*@modifies iob @*/;
550 
558 rpmiob rpmiobAppend(/*@returned@*/ rpmiob iob, const char * s, size_t nl)
559  /*@modifies iob @*/;
560 
567  /*@*/;
568 
574 char * rpmiobStr(rpmiob iob)
575  /*@*/;
576 
582 size_t rpmiobLen(rpmiob iob)
583  /*@*/;
584 
585 #if defined(_RPMIOB_INTERNAL)
586 
592 int rpmiobSlurp(const char * fn, rpmiob * iobp)
593  /*@globals h_errno, fileSystem, internalState @*/
594  /*@modifies *iobp, fileSystem, internalState @*/;
595 #endif
596 
602 /*@null@*/
603 rpmioP rpmioPFree(/*@only@*/ /*@null@*/ rpmioP P)
604  /*@modifies P @*/;
605 
612 rpmRC rpmioParse(rpmioP *Pptr, const char * str)
613  /*@modifies *Pptr @*/;
614 
615 #ifdef __cplusplus
616 }
617 #endif
618 
619 #if !defined(SWIG)
620 
625 #if defined(WITH_DMALLOC)
626 #define _free(p) ((p) != NULL ? free((void *)(p)) : (void)0, NULL)
627 #else
628 
629 #ifdef __cplusplus
630 
631 #define GENfree(_t) \
632  static inline _t _free(_t p) { if (p) free((void *)p); return (_t)NULL; }
633 #define GENpair(_t) \
634  GENfree(const _t) \
635  GENfree( _t)
636 
637 GENpair(void *)
638 GENpair(char *)
639 GENpair(char **)
640 GENpair(unsigned char *)
641 GENfree(DIGEST_CTX)
642 GENfree(DIGEST_CTX *)
643 
644 #else /* __cplusplus */
645 
646 /*@unused@*/ static inline /*@null@*/
647 void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
648  /*@modifies p @*/
649 {
650  if (p != NULL) free((void *)p);
651  return NULL;
652 }
653 #endif /* __cplusplus */
654 
655 #endif /* defined(WITH_DMALLOC) */
656 #endif /* !defined(SWIG) */
657 
658 #endif /* _H_RPMIOTYPES_ */
static int xislower(int c)
Definition: rpmiotypes.h:428
const char ** av
Definition: rpmiotypes.h:69
rpmRC_e
RPM return codes.
Definition: rpmiotypes.h:11
rpmiob rpmiobAppend(rpmiob iob, const char *s, size_t nl)
Append string to I/O buffer.
Definition: rpmiob.c:78
const char * xstrtolocale(const char *str)
Force encoding of string.
Definition: strtolocale.c:15
struct rpmioP_s * rpmioP
static int xtoupper(int c)
Definition: rpmiotypes.h:468
void * next
Definition: rpmiotypes.h:44
rpmuint8_t * rpmiobBuf(rpmiob iob)
Return I/O buffer.
Definition: rpmiob.c:103
static int xisalnum(int c)
Definition: rpmiotypes.h:440
yarnLock use
Definition: rpmiotypes.h:41
struct pgpDigParams_s * pgpDigParams
Definition: rpmiotypes.h:87
size_t _rpmiob_chunk
Definition: rpmiob.c:11
int xstrncasecmp(const char *s1, const char *s2, size_t n)
Locale insensitive strncasecmp(3).
Definition: strcasecmp.c:30
enum pgpHashAlgo_e pgpHashAlgo
9.4.
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
Update context with next plain text buffer.
Definition: digest.c:907
rpmDigestFlags rpmDigestF(DIGEST_CTX ctx)
Return digest flags.
Definition: digest.c:193
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
static int xisascii(int c)
Definition: rpmiotypes.h:452
unsigned short rpmuint16_t
Definition: rpmiotypes.h:24
pgpVSFlags_e
Bit(s) to control digest and signature verification.
Definition: rpmiotypes.h:100
rpmCallbackType_e
Bit(s) to identify progress callbacks.
Definition: rpmiotypes.h:124
void * pool
Definition: rpmiotypes.h:43
static int xisalpha(int c)
Definition: rpmiotypes.h:434
enum rpmDigestFlags_e rpmDigestFlags
Bit(s) to control digest operation.
const char * rpmDigestName(DIGEST_CTX ctx)
Return digest name.
Definition: digest.c:198
int rpmiobSlurp(const char *fn, rpmiob *iobp)
Definition: rpmiob.c:130
static int xisgraph(int c)
Definition: rpmiotypes.h:458
int rpmDigestFinal(DIGEST_CTX ctx, void *datap, size_t *lenp, int asAscii)
Return digest and destroy context.
Definition: digest.c:921
rpmioP rpmioPFree(rpmioP P)
Destroy a rpmioP object.
Definition: poptIO.c:941
static int xtolower(int c)
Definition: rpmiotypes.h:465
static int xisprint(int c)
Definition: rpmiotypes.h:455
unsigned int rpmuint32_t
Definition: rpmiotypes.h:25
#define rpmiobLink(_iob)
Definition: rpmiotypes.h:510
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
Definition: rpmiotypes.h:23
struct rpmioPool_s * rpmioPool
Definition: rpmiotypes.h:53
static int xisspace(int c)
Definition: rpmiotypes.h:446
unsigned long long rpmuint64_t
Definition: rpmiotypes.h:26
enum pgpVSFlags_e pgpVSFlags
Bit(s) to control digest and signature verification.
struct pgpPkt_s * pgpPkt
Definition: rpmiotypes.h:79
char * str
Definition: rpmiotypes.h:67
Digest private data.
Definition: digest.c:127
static int xisupper(int c)
Definition: rpmiotypes.h:431
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
Definition: rpmiob.c:113
struct pgpDig_s * pgpDig
Definition: rpmiotypes.h:83
char * next
Definition: rpmiotypes.h:68
int xstrcasecmp(const char *s1, const char *s2)
Locale insensitive strcasecmp(3).
Definition: strcasecmp.c:9
static int xiscntrl(int c)
Definition: rpmiotypes.h:449
#define rpmiobFree(_iob)
Definition: rpmiotypes.h:522
#define rpmiobUnlink(_iob)
Definition: rpmiotypes.h:498
const char * rpmDigestASN1(DIGEST_CTX ctx)
Return digest ASN1 oid string.
Definition: digest.c:203
rpmRC rpmioParse(rpmioP *Pptr, const char *str)
Parse next command out of a string incrementally.
Definition: poptIO.c:951
void * rpmCallbackData
Definition: rpmiotypes.h:149
pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
Return digest algorithm identifier.
Definition: digest.c:188
enum rpmRC_e rpmRC
RPM return codes.
int rpmint32_t
Definition: rpmiotypes.h:30
DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
Duplicate a digest context.
Definition: digest.c:209
static int xisdigit(int c)
Definition: rpmiotypes.h:437
DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
Initialize digest.
Definition: digest.c:244
struct rpmioItem_s * rpmioItem
Definition: rpmiotypes.h:38
rpmiob rpmiobEmpty(rpmiob iob)
Empty an I/O buffer.
Definition: rpmiob.c:57
struct DIGEST_CTX_s * DIGEST_CTX
Definition: rpmiotypes.h:75
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
Definition: rpmiotypes.h:647
struct rpmiob_s * rpmiob
Definition: rpmiotypes.h:57
const void * fnpyKey
Definition: rpmiotypes.h:118
rpmDigestFlags_e
Bit(s) to control digest operation.
Definition: rpmiotypes.h:303
rpmiob rpmiobRTrim(rpmiob iob)
Trim trailing white space.
Definition: rpmiob.c:67
pgpHashAlgo_e
9.4.
Definition: rpmiotypes.h:171
static int xisblank(int c)
Definition: rpmiotypes.h:443
struct yarnLock_s * yarnLock
Definition: rpmiotypes.h:34
rpmuint8_t pgpTime_t[4]
Definition: rpmiotypes.h:95
int rpmHmacInit(DIGEST_CTX ctx, const void *key, size_t keylen)
Compute key material and add to digest context.
Definition: digest.c:983
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
Definition: rpmiob.c:44
rpmuint8_t pgpKeyID_t[8]
Definition: rpmiotypes.h:91
size_t rpmiobLen(rpmiob iob)
Return I/O buffer len.
Definition: rpmiob.c:123
int ac
Definition: rpmiotypes.h:70
static int xispunct(int c)
Definition: rpmiotypes.h:461