rpm  5.4.14
rpmiotypes.h
Go to the documentation of this file.
1 #ifndef _H_RPMIOTYPES_
2 #define _H_RPMIOTYPES_
3 
4 #include <stdlib.h> /* XXX NULL typedef */
5 #include <sys/types.h> /* XXX size_t typedef */
6 
14 typedef enum rpmRC_e {
15  RPMRC_OK = 0,
17  RPMRC_FAIL = 2,
21 } rpmRC;
22 
26 typedef /*@unsignedintegraltype@*/ unsigned char rpmuint8_t;
27 typedef /*@unsignedintegraltype@*/ unsigned short rpmuint16_t;
28 typedef /*@unsignedintegraltype@*/ unsigned int rpmuint32_t;
29 typedef /*@unsignedintegraltype@*/ unsigned long long rpmuint64_t;
30 
33 typedef /*@signedintegraltype@*/ int rpmint32_t;
34 
37 typedef struct yarnLock_s * yarnLock;
38 
41 typedef /*@refcounted@*/ struct rpmioItem_s * rpmioItem;
42 struct rpmioItem_s {
43 /*@null@*/
45 /*@kept@*/ /*@null@*/
46  void *pool;
47  void *next;
48 #if defined(__LCLINT__)
49 /*@refs@*/
50  int nrefs;
51 #endif
52 };
53 
56 typedef struct rpmioPool_s * rpmioPool;
57 
60 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmiob_s * rpmiob;
61 
64 /*@unchecked@*/
65 extern size_t _rpmiob_chunk;
66 
69 typedef struct rpmioP_s {
70  char * str;
71  char * next;
72  const char ** av;
73  int ac;
74 } * rpmioP;
75 
78 typedef /*@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
79 
82 typedef /*@abstract@*/ struct pgpPkt_s * pgpPkt;
83 
86 typedef /*@abstract@*/ /*@refcounted@*/ struct pgpDig_s * pgpDig;
87 
90 typedef /*@abstract@*/ struct pgpDigParams_s * pgpDigParams;
91 
95 
98 typedef rpmuint8_t pgpTime_t[4];
99 
103 typedef enum pgpVSFlags_e {
105  RPMVSF_NOHDRCHK = (1 << 0),
106  RPMVSF_NEEDPAYLOAD = (1 << 1),
107  /* bit(s) 2-7 unused */
109  RPMVSF_NOMD5HEADER = (1 << 9), /* unimplemented */
110  RPMVSF_NODSAHEADER = (1 << 10),
111  RPMVSF_NORSAHEADER = (1 << 11),
112  /* bit(s) 12-15 unused */
113  RPMVSF_NOSHA1 = (1 << 16), /* unimplemented */
114  RPMVSF_NOMD5 = (1 << 17),
115  RPMVSF_NODSA = (1 << 18),
116  RPMVSF_NORSA = (1 << 19)
117  /* bit(s) 20-31 unused */
118 } pgpVSFlags;
119 
120 /*@-redef@*/ /* LCL: ??? */
121 typedef /*@abstract@*/ const void * fnpyKey;
122 /*@=redef@*/
123 
127 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_ */
enum rpmDigestFlags_e rpmDigestFlags
Bit(s) to control digest operation.
static int xislower(int c)
Definition: rpmiotypes.h:428
const char ** av
Definition: rpmiotypes.h:72
rpmiob rpmiobRTrim(rpmiob iob)
Trim trailing white space.
Definition: rpmiob.c:67
DIGEST_CTX ctx
Definition: signature.c:785
rpmuint8_t * rpmiobBuf(rpmiob iob)
Return I/O buffer.
Definition: rpmiob.c:102
rpmDigestFlags rpmDigestF(DIGEST_CTX ctx)
Return digest flags.
Definition: digest.c:193
static int xtoupper(int c)
Definition: rpmiotypes.h:468
rpmuint8_t pgpKeyID_t[8]
Definition: rpmiotypes.h:94
rpmRC_e
RPM return codes.
Definition: rpmiotypes.h:14
rpmuint8_t pgpTime_t[4]
Definition: rpmiotypes.h:98
void * next
Definition: rpmiotypes.h:47
static int xisalnum(int c)
Definition: rpmiotypes.h:440
yarnLock use
Definition: rpmiotypes.h:44
size_t rpmiobLen(rpmiob iob)
Return I/O buffer len.
Definition: rpmiob.c:122
* lenp
Definition: header.c:1796
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
static int xisascii(int c)
Definition: rpmiotypes.h:452
struct DIGEST_CTX_s * DIGEST_CTX
Definition: rpmiotypes.h:78
unsigned short rpmuint16_t
Definition: rpmiotypes.h:27
rpmCallbackType_e
Bit(s) to identify progress callbacks.
Definition: rpmiotypes.h:127
void * pool
Definition: rpmiotypes.h:46
static int xisalpha(int c)
Definition: rpmiotypes.h:434
rpmiob rpmiobAppend(rpmiob iob, const char *s, size_t nl)
Append string to I/O buffer.
Definition: rpmiob.c:77
Header h
Definition: spec.c:739
struct rpmioP_s * rpmioP
struct pgpDig_s * pgpDig
Definition: rpmiotypes.h:86
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
Definition: rpmiotypes.h:26
int xstrncasecmp(const char *s1, const char *s2, size_t n)
Locale insensitive strncasecmp(3).
Definition: strcasecmp.c:30
int rpmiobSlurp(const char *fn, rpmiob *iobp)
Definition: rpmiob.c:129
struct rpmiob_s * rpmiob
Definition: rpmiotypes.h:60
pgpVSFlags_e
Bit(s) to control digest and signature verification.
Definition: rpmiotypes.h:103
static int xisgraph(int c)
Definition: rpmiotypes.h:458
rpmioP rpmioPFree(rpmioP P)
Destroy a rpmioP object.
static int xtolower(int c)
Definition: rpmiotypes.h:465
enum rpmRC_e rpmRC
RPM return codes.
Definition: signature.c:616
static int xisprint(int c)
Definition: rpmiotypes.h:455
unsigned int rpmuint32_t
Definition: rpmiotypes.h:28
#define rpmiobLink(_iob)
Definition: rpmiotypes.h:510
char * p
Definition: macro.c:413
enum pgpHashAlgo_e pgpHashAlgo
9.4.
const char * rpmDigestName(DIGEST_CTX ctx)
Return digest name.
Definition: digest.c:198
static int xisspace(int c)
Definition: rpmiotypes.h:446
unsigned long long rpmuint64_t
Definition: rpmiotypes.h:29
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
Update context with next plain text buffer.
Definition: digest.c:907
DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
Duplicate a digest context.
Definition: digest.c:209
char * str
Definition: rpmiotypes.h:70
enum pgpVSFlags_e pgpVSFlags
Bit(s) to control digest and signature verification.
Digest private data.
Definition: digest.c:127
key
Definition: macro.c:383
struct yarnLock_s * yarnLock
Definition: rpmiotypes.h:37
static int xisupper(int c)
Definition: rpmiotypes.h:431
pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
Return digest algorithm identifier.
Definition: digest.c:188
int rpmint32_t
Definition: rpmiotypes.h:33
rpmDigestFlags_e
Bit(s) to control digest operation.
Definition: rpmiotypes.h:303
struct pgpPkt_s * pgpPkt
Definition: rpmiotypes.h:82
DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
Initialize digest.
Definition: digest.c:244
char * next
Definition: rpmiotypes.h:71
static int xiscntrl(int c)
Definition: rpmiotypes.h:449
#define rpmiobFree(_iob)
Definition: rpmiotypes.h:522
struct rpmioItem_s * rpmioItem
Definition: rpmiotypes.h:41
char * n
Definition: macro.c:744
#define rpmiobUnlink(_iob)
Definition: rpmiotypes.h:498
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
Definition: rpmiob.c:44
pgpHashAlgo_e
9.4.
Definition: rpmiotypes.h:171
static const char *char c
Return text between pl and matching pr characters.
Definition: macro.c:470
void * rpmCallbackData
Definition: rpmiotypes.h:149
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
Definition: rpmiob.c:112
static PyObject *rpmds P
Definition: rpmds-py.c:435
const char * s
Definition: poptALL.c:734
static int xisdigit(int c)
Definition: rpmiotypes.h:437
int rpmHmacInit(DIGEST_CTX ctx, const void *key, size_t keylen)
Compute key material and add to digest context.
Definition: digest.c:983
int xstrcasecmp(const char *s1, const char *s2)
Locale insensitive strcasecmp(3).
Definition: strcasecmp.c:9
size_t _rpmiob_chunk
Definition: rpmiob.c:11
const void * fnpyKey
Definition: rpmiotypes.h:121
int flags
Definition: fnmatch.c:282
struct pgpDigParams_s * pgpDigParams
Definition: rpmiotypes.h:90
static int xisblank(int c)
Definition: rpmiotypes.h:443
return NULL
Definition: poptALL.c:613
struct rpmioPool_s * rpmioPool
Definition: rpmiotypes.h:56
rpmiob rpmiobEmpty(rpmiob iob)
Empty an I/O buffer.
Definition: rpmiob.c:57
char * b
Definition: macro.c:746
void rpmDigestFinal(rpmDigestDup(md5ctx),&md5sum,&md5len, 0)
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
Definition: rpmiotypes.h:647
const char * rpmDigestASN1(DIGEST_CTX ctx)
Return digest ASN1 oid string.
Definition: digest.c:203
size_t fn
Definition: macro.c:1698
const char * xstrtolocale(const char *str)
Force encoding of string.
Definition: strtolocale.c:15
int ac
Definition: rpmiotypes.h:73
static int xispunct(int c)
Definition: rpmiotypes.h:461
int len
Definition: rpmdb-py.c:119
rpmRC rpmioParse(rpmioP *Pptr, const char *str)
Parse next command out of a string incrementally.
Definition: poptIO.c:951