• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

rpmio/rpmiotypes.h

Go to the documentation of this file.
00001 #ifndef _H_RPMIOTYPES_
00002 #define _H_RPMIOTYPES_
00003 
00011 typedef enum rpmRC_e {
00012     RPMRC_OK            = 0,    
00013     RPMRC_NOTFOUND      = 1,    
00014     RPMRC_FAIL          = 2,    
00015     RPMRC_NOTTRUSTED    = 3,    
00016     RPMRC_NOKEY         = 4     
00017 } rpmRC;
00018 
00022 typedef /*@unsignedintegraltype@*/      unsigned char           rpmuint8_t;
00023 typedef /*@unsignedintegraltype@*/      unsigned short          rpmuint16_t;
00024 typedef /*@unsignedintegraltype@*/      unsigned int            rpmuint32_t;
00025 typedef /*@unsignedintegraltype@*/      unsigned long long      rpmuint64_t;
00026 
00029 typedef /*@signedintegraltype@*/        int                     rpmint32_t;
00030 
00033 typedef /*@refcounted@*/ struct rpmioItem_s * rpmioItem;
00034 struct rpmioItem_s {
00035 /*@null@*/
00036     void *use;                  
00037 /*@kept@*/ /*@null@*/
00038     void *pool;                 
00039 #if defined(__LCLINT__)
00040 /*@refs@*/
00041     int nrefs;                  
00042 #endif
00043 };
00044 
00047 typedef struct rpmioPool_s * rpmioPool;
00048 
00051 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmiob_s * rpmiob;
00052 
00055 /*@unchecked@*/
00056 extern size_t _rpmiob_chunk;
00057 
00060 typedef /*@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
00061 
00064 typedef /*@abstract@*/ struct pgpPkt_s * pgpPkt;
00065 
00068 typedef /*@abstract@*/ /*@refcounted@*/ struct pgpDig_s * pgpDig;
00069 
00072 typedef /*@abstract@*/ struct pgpDigParams_s * pgpDigParams;
00073 
00076 typedef rpmuint8_t pgpKeyID_t[8];
00077 
00080 typedef rpmuint8_t pgpTime_t[4];
00081 
00085 typedef enum pgpVSFlags_e {
00086     RPMVSF_DEFAULT      = 0,
00087     RPMVSF_NOHDRCHK     = (1 <<  0),
00088     RPMVSF_NEEDPAYLOAD  = (1 <<  1),
00089     /* bit(s) 2-7 unused */
00090     RPMVSF_NOSHA1HEADER = (1 <<  8),
00091     RPMVSF_NOMD5HEADER  = (1 <<  9),    /* unimplemented */
00092     RPMVSF_NODSAHEADER  = (1 << 10),
00093     RPMVSF_NORSAHEADER  = (1 << 11),
00094     /* bit(s) 12-15 unused */
00095     RPMVSF_NOSHA1       = (1 << 16),    /* unimplemented */
00096     RPMVSF_NOMD5        = (1 << 17),
00097     RPMVSF_NODSA        = (1 << 18),
00098     RPMVSF_NORSA        = (1 << 19)
00099     /* bit(s) 20-31 unused */
00100 } pgpVSFlags;
00101 
00102 #define _RPMVSF_NODIGESTS       \
00103   ( RPMVSF_NOSHA1HEADER |       \
00104     RPMVSF_NOMD5HEADER |        \
00105     RPMVSF_NOSHA1 |             \
00106     RPMVSF_NOMD5 )
00107 
00108 #define _RPMVSF_NOSIGNATURES    \
00109   ( RPMVSF_NODSAHEADER |        \
00110     RPMVSF_NORSAHEADER |        \
00111     RPMVSF_NODSA |              \
00112     RPMVSF_NORSA )
00113 
00114 #define _RPMVSF_NOHEADER        \
00115   ( RPMVSF_NOSHA1HEADER |       \
00116     RPMVSF_NOMD5HEADER |        \
00117     RPMVSF_NODSAHEADER |        \
00118     RPMVSF_NORSAHEADER )
00119 
00120 #define _RPMVSF_NOPAYLOAD       \
00121   ( RPMVSF_NOSHA1 |             \
00122     RPMVSF_NOMD5 |              \
00123     RPMVSF_NODSA |              \
00124     RPMVSF_NORSA )
00125 
00126 /*@-redef@*/ /* LCL: ??? */
00127 typedef /*@abstract@*/ const void * fnpyKey;
00128 /*@=redef@*/
00129 
00133 typedef enum rpmCallbackType_e {
00134     RPMCALLBACK_UNKNOWN         = 0,
00135     RPMCALLBACK_INST_PROGRESS   = (1 <<  0),
00136     RPMCALLBACK_INST_START      = (1 <<  1),
00137     RPMCALLBACK_INST_OPEN_FILE  = (1 <<  2),
00138     RPMCALLBACK_INST_CLOSE_FILE = (1 <<  3),
00139     RPMCALLBACK_TRANS_PROGRESS  = (1 <<  4),
00140     RPMCALLBACK_TRANS_START     = (1 <<  5),
00141     RPMCALLBACK_TRANS_STOP      = (1 <<  6),
00142     RPMCALLBACK_UNINST_PROGRESS = (1 <<  7),
00143     RPMCALLBACK_UNINST_START    = (1 <<  8),
00144     RPMCALLBACK_UNINST_STOP     = (1 <<  9),
00145     RPMCALLBACK_REPACKAGE_PROGRESS = (1 << 10),
00146     RPMCALLBACK_REPACKAGE_START = (1 << 11),
00147     RPMCALLBACK_REPACKAGE_STOP  = (1 << 12),
00148     RPMCALLBACK_UNPACK_ERROR    = (1 << 13),
00149     RPMCALLBACK_CPIO_ERROR      = (1 << 14),
00150     RPMCALLBACK_SCRIPT_ERROR    = (1 << 15)
00151 } rpmCallbackType;
00152 
00155 typedef void * rpmCallbackData;
00156 
00177 typedef enum pgpHashAlgo_e {
00178     PGPHASHALGO_ERROR           =  -1,
00179     PGPHASHALGO_NONE            =  0,
00180     PGPHASHALGO_MD5             =  1,   
00181     PGPHASHALGO_SHA1            =  2,   
00182     PGPHASHALGO_RIPEMD160       =  3,   
00183     PGPHASHALGO_MD2             =  5,   
00184     PGPHASHALGO_TIGER192        =  6,   
00185     PGPHASHALGO_HAVAL_5_160     =  7,   
00186     PGPHASHALGO_SHA256          =  8,   
00187     PGPHASHALGO_SHA384          =  9,   
00188     PGPHASHALGO_SHA512          = 10,   
00189     PGPHASHALGO_SHA224          = 11,   
00191     PGPHASHALGO_MD4             = 104,  
00192     PGPHASHALGO_RIPEMD128       = 105,  
00193     PGPHASHALGO_CRC32           = 106,  
00194     PGPHASHALGO_ADLER32         = 107,  
00195     PGPHASHALGO_CRC64           = 108,  
00196     PGPHASHALGO_JLU32           = 109,  
00198     PGPHASHALGO_RIPEMD256       = 111,  
00199     PGPHASHALGO_RIPEMD320       = 112,  
00200     PGPHASHALGO_SALSA10         = 113,  
00201     PGPHASHALGO_SALSA20         = 114,  
00203 } pgpHashAlgo;
00204 
00208 typedef enum rpmDigestFlags_e {
00209     RPMDIGEST_NONE      = 0
00210 } rpmDigestFlags;
00211 
00212 
00213 #if defined(_RPMIOB_INTERNAL)
00214 
00216 struct rpmiob_s{
00217     struct rpmioItem_s _item;   
00218     rpmuint8_t * b;             
00219     size_t blen;                
00220     size_t allocated;           
00221 #if defined(__LCLINT__)
00222 /*@refs@*/
00223     int nrefs;                          
00224 #endif
00225 };
00226 #endif
00227 
00228 #ifdef __cplusplus
00229 extern "C" {
00230 #endif
00231 
00237 pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
00238         /*@*/;
00239 
00245 /*@observer@*/
00246 const char * rpmDigestName(DIGEST_CTX ctx)
00247         /*@*/;
00248 
00255 /*@observer@*/ /*@null@*/
00256 const char * rpmDigestASN1(DIGEST_CTX ctx)
00257         /*@*/;
00258 
00264 /*@only@*/
00265 DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
00266         /*@*/;
00267 
00275 /*@only@*/ /*@null@*/
00276 DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
00277         /*@*/;
00278 
00286 int rpmDigestUpdate(/*@null@*/ DIGEST_CTX ctx, const void * data, size_t len)
00287         /*@modifies ctx @*/;
00288 
00300 int rpmDigestFinal(/*@only@*/ /*@null@*/ DIGEST_CTX ctx,
00301         /*@null@*/ /*@out@*/ void * datap,
00302         /*@null@*/ /*@out@*/ size_t * lenp, int asAscii)
00303                 /*@modifies *datap, *lenp @*/;
00304 
00307 typedef void * (*rpmCallbackFunction)
00308                 (/*@null@*/ const void * h,
00309                 const rpmCallbackType what,
00310                 const rpmuint64_t amount,
00311                 const rpmuint64_t total,
00312                 /*@null@*/ fnpyKey key,
00313                 /*@null@*/ rpmCallbackData data)
00314         /*@globals internalState@*/
00315         /*@modifies internalState@*/;
00316 
00317 #if !defined(SWIG)
00318 
00323 #if defined(WITH_DMALLOC)
00324 #define _free(p) ((p) != NULL ? free((void *)(p)) : (void)0, NULL)
00325 #else
00326 /*@unused@*/ static inline /*@null@*/
00327 void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
00328         /*@modifies p @*/
00329 {
00330     if (p != NULL)      free((void *)p);
00331     return NULL;
00332 }
00333 #endif
00334 #endif
00335 
00336 /*@unused@*/ static inline int xislower(int c) /*@*/ {
00337     return (c >= (int)'a' && c <= (int)'z');
00338 }
00339 /*@unused@*/ static inline int xisupper(int c) /*@*/ {
00340     return (c >= (int)'A' && c <= (int)'Z');
00341 }
00342 /*@unused@*/ static inline int xisalpha(int c) /*@*/ {
00343     return (xislower(c) || xisupper(c));
00344 }
00345 /*@unused@*/ static inline int xisdigit(int c) /*@*/ {
00346     return (c >= (int)'0' && c <= (int)'9');
00347 }
00348 /*@unused@*/ static inline int xisalnum(int c) /*@*/ {
00349     return (xisalpha(c) || xisdigit(c));
00350 }
00351 /*@unused@*/ static inline int xisblank(int c) /*@*/ {
00352     return (c == (int)' ' || c == (int)'\t');
00353 }
00354 /*@unused@*/ static inline int xisspace(int c) /*@*/ {
00355     return (xisblank(c) || c == (int)'\n' || c == (int)'\r' || c == (int)'\f' || c == (int)'\v');
00356 }
00357 /*@unused@*/ static inline int xiscntrl(int c) /*@*/ {
00358     return (c < (int)' ');
00359 }
00360 /*@unused@*/ static inline int xisascii(int c) /*@*/ {
00361     return ((c & 0x80) != 0x80);
00362 }
00363 /*@unused@*/ static inline int xisprint(int c) /*@*/ {
00364     return (c >= (int)' ' && xisascii(c));
00365 }
00366 /*@unused@*/ static inline int xisgraph(int c) /*@*/ {
00367     return (c > (int)' ' && xisascii(c));
00368 }
00369 /*@unused@*/ static inline int xispunct(int c) /*@*/ {
00370     return (xisgraph(c) && !xisalnum(c));
00371 }
00372 
00373 /*@unused@*/ static inline int xtolower(int c) /*@*/ {
00374     return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
00375 }
00376 /*@unused@*/ static inline int xtoupper(int c) /*@*/ {
00377     return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
00378 }
00379 
00383 int xstrcasecmp(const char * s1, const char * s2)               /*@*/;
00384 
00388 int xstrncasecmp(const char *s1, const char * s2, size_t n)     /*@*/;
00389 
00393 /*@only@*/ /*@null@*/
00394 const char * xstrtolocale(/*@only@*/ const char *str)
00395         /*@modifies *str @*/;
00396 
00402 /*@unused@*/ /*@null@*/
00403 rpmiob rpmiobUnlink (/*@killref@*/ /*@null@*/ rpmiob iob)
00404         /*@globals fileSystem @*/
00405         /*@modifies iob, fileSystem @*/;
00406 #define rpmiobUnlink(_iob)      \
00407     ((rpmiob)rpmioUnlinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
00408 
00414 /*@unused@*/ /*@newref@*/ /*@null@*/
00415 rpmiob rpmiobLink (/*@null@*/ rpmiob iob)
00416         /*@globals fileSystem @*/
00417         /*@modifies iob, fileSystem @*/;
00418 #define rpmiobLink(_iob)        \
00419     ((rpmiob)rpmioLinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
00420 
00426 /*@null@*/
00427 rpmiob rpmiobFree( /*@killref@*/ rpmiob iob)
00428         /*@globals fileSystem @*/
00429         /*@modifies iob, fileSystem @*/;
00430 #define rpmiobFree(_iob)        \
00431     ((rpmiob)rpmioFreePoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
00432 
00438 /*@newref@*/ /*@null@*/
00439 rpmiob rpmiobNew(size_t len)
00440         /*@globals fileSystem @*/
00441         /*@modifies fileSystem @*/;
00442 
00448 rpmiob rpmiobEmpty(/*@returned@*/ rpmiob iob)
00449         /*@modifies iob @*/;
00450 
00456 rpmiob rpmiobRTrim(/*@returned@*/ rpmiob iob)
00457         /*@modifies iob @*/;
00458 
00466 rpmiob rpmiobAppend(/*@returned@*/ rpmiob iob, const char * s, size_t nl)
00467         /*@modifies iob @*/;
00468 
00474 rpmuint8_t * rpmiobBuf(rpmiob iob)
00475         /*@*/;
00476 
00482 char * rpmiobStr(rpmiob iob)
00483         /*@*/;
00484 
00490 size_t rpmiobLen(rpmiob iob)
00491         /*@*/;
00492 
00493 #if defined(_RPMIOB_INTERNAL)
00494 
00500 int rpmiobSlurp(const char * fn, rpmiob * iobp)
00501         /*@globals h_errno, fileSystem, internalState @*/
00502         /*@modifies *iobp, fileSystem, internalState @*/;
00503 #endif
00504 
00505 #ifdef __cplusplus
00506 }
00507 #endif
00508 
00509 #endif /* _H_RPMIOTYPES_ */

Generated on Fri Dec 3 2010 20:54:34 for rpm by  doxygen 1.7.2