rpmiotypes.h
Go to the documentation of this file.
#ifndef _H_RPMIOTYPES_
#define _H_RPMIOTYPES_
typedef enum rpmRC_e {
RPMRC_OK = 0,
RPMRC_NOTFOUND = 1,
RPMRC_FAIL = 2,
RPMRC_NOTTRUSTED = 3,
RPMRC_NOKEY = 4
} rpmRC;
typedef /*@unsignedintegraltype@*/ unsigned char rpmuint8_t;
typedef /*@unsignedintegraltype@*/ unsigned short rpmuint16_t;
typedef /*@unsignedintegraltype@*/ unsigned int rpmuint32_t;
typedef /*@unsignedintegraltype@*/ unsigned long long rpmuint64_t;
typedef /*@signedintegraltype@*/ int rpmint32_t;
typedef /*@refcounted@*/ struct rpmioItem_s * rpmioItem;
struct rpmioItem_s {
/*@null@*/
void *use;
/*@kept@*/ /*@null@*/
void *pool;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
typedef struct rpmioPool_s * rpmioPool;
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmiob_s * rpmiob;
/*@unchecked@*/
extern size_t _rpmiob_chunk;
typedef /*@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
typedef /*@abstract@*/ struct pgpPkt_s * pgpPkt;
typedef /*@abstract@*/ /*@refcounted@*/ struct pgpDig_s * pgpDig;
typedef /*@abstract@*/ struct pgpDigParams_s * pgpDigParams;
typedef rpmuint8_t pgpKeyID_t[8];
typedef rpmuint8_t pgpTime_t[4];
typedef enum pgpVSFlags_e {
RPMVSF_DEFAULT = 0,
RPMVSF_NOHDRCHK = (1 << 0),
RPMVSF_NEEDPAYLOAD = (1 << 1),
/* bit(s) 2-7 unused */
RPMVSF_NOSHA1HEADER = (1 << 8),
RPMVSF_NOMD5HEADER = (1 << 9), /* unimplemented */
RPMVSF_NODSAHEADER = (1 << 10),
RPMVSF_NORSAHEADER = (1 << 11),
/* bit(s) 12-15 unused */
RPMVSF_NOSHA1 = (1 << 16), /* unimplemented */
RPMVSF_NOMD5 = (1 << 17),
RPMVSF_NODSA = (1 << 18),
RPMVSF_NORSA = (1 << 19)
/* bit(s) 20-31 unused */
} pgpVSFlags;
#define _RPMVSF_NODIGESTS \
( RPMVSF_NOSHA1HEADER | \
RPMVSF_NOMD5HEADER | \
RPMVSF_NOSHA1 | \
RPMVSF_NOMD5 )
#define _RPMVSF_NOSIGNATURES \
( RPMVSF_NODSAHEADER | \
RPMVSF_NORSAHEADER | \
RPMVSF_NODSA | \
RPMVSF_NORSA )
#define _RPMVSF_NOHEADER \
( RPMVSF_NOSHA1HEADER | \
RPMVSF_NOMD5HEADER | \
RPMVSF_NODSAHEADER | \
RPMVSF_NORSAHEADER )
#define _RPMVSF_NOPAYLOAD \
( RPMVSF_NOSHA1 | \
RPMVSF_NOMD5 | \
RPMVSF_NODSA | \
RPMVSF_NORSA )
/*@-redef@*/ /* LCL: ??? */
typedef /*@abstract@*/ const void * fnpyKey;
/*@=redef@*/
typedef enum rpmCallbackType_e {
RPMCALLBACK_UNKNOWN = 0,
RPMCALLBACK_INST_PROGRESS = (1 << 0),
RPMCALLBACK_INST_START = (1 << 1),
RPMCALLBACK_INST_OPEN_FILE = (1 << 2),
RPMCALLBACK_INST_CLOSE_FILE = (1 << 3),
RPMCALLBACK_TRANS_PROGRESS = (1 << 4),
RPMCALLBACK_TRANS_START = (1 << 5),
RPMCALLBACK_TRANS_STOP = (1 << 6),
RPMCALLBACK_UNINST_PROGRESS = (1 << 7),
RPMCALLBACK_UNINST_START = (1 << 8),
RPMCALLBACK_UNINST_STOP = (1 << 9),
RPMCALLBACK_REPACKAGE_PROGRESS = (1 << 10),
RPMCALLBACK_REPACKAGE_START = (1 << 11),
RPMCALLBACK_REPACKAGE_STOP = (1 << 12),
RPMCALLBACK_UNPACK_ERROR = (1 << 13),
RPMCALLBACK_CPIO_ERROR = (1 << 14),
RPMCALLBACK_SCRIPT_ERROR = (1 << 15)
} rpmCallbackType;
typedef void * rpmCallbackData;
typedef enum pgpHashAlgo_e {
PGPHASHALGO_ERROR = -1,
PGPHASHALGO_NONE = 0,
PGPHASHALGO_MD5 = 1,
PGPHASHALGO_SHA1 = 2,
PGPHASHALGO_RIPEMD160 = 3,
PGPHASHALGO_MD2 = 5,
PGPHASHALGO_TIGER192 = 6,
PGPHASHALGO_HAVAL_5_160 = 7,
PGPHASHALGO_SHA256 = 8,
PGPHASHALGO_SHA384 = 9,
PGPHASHALGO_SHA512 = 10,
PGPHASHALGO_SHA224 = 11,
PGPHASHALGO_MD4 = 104,
PGPHASHALGO_RIPEMD128 = 105,
PGPHASHALGO_CRC32 = 106,
PGPHASHALGO_ADLER32 = 107,
PGPHASHALGO_CRC64 = 108,
PGPHASHALGO_JLU32 = 109,
PGPHASHALGO_RIPEMD256 = 111,
PGPHASHALGO_RIPEMD320 = 112,
PGPHASHALGO_SALSA10 = 113,
PGPHASHALGO_SALSA20 = 114,
} pgpHashAlgo;
typedef enum rpmDigestFlags_e {
RPMDIGEST_NONE = 0
} rpmDigestFlags;
#if defined(_RPMIOB_INTERNAL)
struct rpmiob_s{
struct rpmioItem_s _item;
rpmuint8_t * b;
size_t blen;
size_t allocated;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
#endif
#ifdef __cplusplus
extern "C" {
#endif
pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
/*@*/;
/*@observer@*/
const char * rpmDigestName(DIGEST_CTX ctx)
/*@*/;
/*@observer@*/ /*@null@*/
const char * rpmDigestASN1(DIGEST_CTX ctx)
/*@*/;
/*@only@*/
DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
/*@*/;
/*@only@*/ /*@null@*/
DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
/*@*/;
int rpmDigestUpdate(/*@null@*/ DIGEST_CTX ctx, const void * data, size_t len)
/*@modifies ctx @*/;
int rpmDigestFinal(/*@only@*/ /*@null@*/ DIGEST_CTX ctx,
/*@null@*/ /*@out@*/ void * datap,
/*@null@*/ /*@out@*/ size_t * lenp, int asAscii)
/*@modifies *datap, *lenp @*/;
typedef void * (*rpmCallbackFunction)
(/*@null@*/ const void * h,
const rpmCallbackType what,
const rpmuint64_t amount,
const rpmuint64_t total,
/*@null@*/ fnpyKey key,
/*@null@*/ rpmCallbackData data)
/*@globals internalState@*/
/*@modifies internalState@*/;
#if !defined(SWIG)
#if defined(WITH_DMALLOC)
#define _free(p) ((p) != NULL ? free((void *)(p)) : (void)0, NULL)
#else
/*@unused@*/ static inline /*@null@*/
void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
/*@modifies p @*/
{
if (p != NULL) free((void *)p);
return NULL;
}
#endif
#endif
/*@unused@*/ static inline int xislower(int c) /*@*/ {
return (c >= (int)'a' && c <= (int)'z');
}
/*@unused@*/ static inline int xisupper(int c) /*@*/ {
return (c >= (int)'A' && c <= (int)'Z');
}
/*@unused@*/ static inline int xisalpha(int c) /*@*/ {
return (xislower(c) || xisupper(c));
}
/*@unused@*/ static inline int xisdigit(int c) /*@*/ {
return (c >= (int)'0' && c <= (int)'9');
}
/*@unused@*/ static inline int xisalnum(int c) /*@*/ {
return (xisalpha(c) || xisdigit(c));
}
/*@unused@*/ static inline int xisblank(int c) /*@*/ {
return (c == (int)' ' || c == (int)'\t');
}
/*@unused@*/ static inline int xisspace(int c) /*@*/ {
return (xisblank(c) || c == (int)'\n' || c == (int)'\r' || c == (int)'\f' || c == (int)'\v');
}
/*@unused@*/ static inline int xiscntrl(int c) /*@*/ {
return (c < (int)' ');
}
/*@unused@*/ static inline int xisascii(int c) /*@*/ {
return ((c & 0x80) != 0x80);
}
/*@unused@*/ static inline int xisprint(int c) /*@*/ {
return (c >= (int)' ' && xisascii(c));
}
/*@unused@*/ static inline int xisgraph(int c) /*@*/ {
return (c > (int)' ' && xisascii(c));
}
/*@unused@*/ static inline int xispunct(int c) /*@*/ {
return (xisgraph(c) && !xisalnum(c));
}
/*@unused@*/ static inline int xtolower(int c) /*@*/ {
return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
}
/*@unused@*/ static inline int xtoupper(int c) /*@*/ {
return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
}
int xstrcasecmp(const char * s1, const char * s2) /*@*/;
int xstrncasecmp(const char *s1, const char * s2, size_t n) /*@*/;
/*@only@*/ /*@null@*/
const char * xstrtolocale(/*@only@*/ const char *str)
/*@modifies *str @*/;
/*@unused@*/ /*@null@*/
rpmiob rpmiobUnlink (/*@killref@*/ /*@null@*/ rpmiob iob)
/*@globals fileSystem @*/
/*@modifies iob, fileSystem @*/;
#define rpmiobUnlink(_iob) \
((rpmiob)rpmioUnlinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
/*@unused@*/ /*@newref@*/ /*@null@*/
rpmiob rpmiobLink (/*@null@*/ rpmiob iob)
/*@globals fileSystem @*/
/*@modifies iob, fileSystem @*/;
#define rpmiobLink(_iob) \
((rpmiob)rpmioLinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
/*@null@*/
rpmiob rpmiobFree( /*@killref@*/ rpmiob iob)
/*@globals fileSystem @*/
/*@modifies iob, fileSystem @*/;
#define rpmiobFree(_iob) \
((rpmiob)rpmioFreePoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, __LINE__))
/*@newref@*/ /*@null@*/
rpmiob rpmiobNew(size_t len)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
rpmiob rpmiobEmpty(/*@returned@*/ rpmiob iob)
/*@modifies iob @*/;
rpmiob rpmiobRTrim(/*@returned@*/ rpmiob iob)
/*@modifies iob @*/;
rpmiob rpmiobAppend(/*@returned@*/ rpmiob iob, const char * s, size_t nl)
/*@modifies iob @*/;
rpmuint8_t * rpmiobBuf(rpmiob iob)
/*@*/;
char * rpmiobStr(rpmiob iob)
/*@*/;
size_t rpmiobLen(rpmiob iob)
/*@*/;
#if defined(_RPMIOB_INTERNAL)
int rpmiobSlurp(const char * fn, rpmiob * iobp)
/*@globals h_errno, fileSystem, internalState @*/
/*@modifies *iobp, fileSystem, internalState @*/;
#endif
#ifdef __cplusplus
}
#endif
#endif /* _H_RPMIOTYPES_ */