1 #ifndef H_RPMIO_INTERNAL
2 #define H_RPMIO_INTERNAL
13 #define _RPMPGP_INTERNAL
62 #define RPMIO_DEBUG_IO 0x40000000
63 #define RPMIO_DEBUG_REFS 0x20000000
65 #define FDMAGIC 0x04463138
106 #if defined(__LCLINT__)
113 #define FDSANE(fd) assert(fd != NULL && fd->magic == FDMAGIC)
115 #define DBG(_f, _m, _x) \
117 if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x \
120 #if defined(__LCLINT__XXX)
121 #define DBGIO(_f, _x)
122 #define DBGREFS(_f, _x)
124 #define DBGIO(_f, _x) DBG((_f), RPMIO_DEBUG_IO, _x)
125 #define DBGREFS(_f, _x) DBG((_f), RPMIO_DEBUG_REFS, _x)
158 int ftpCmd(
const char * cmd,
const char * url,
const char * arg2)
176 free((
void *)fd->
opath);
362 if (fd->
nfps >= (
int)(
sizeof(fd->
fps)/
sizeof(fd->
fps[0]) - 1))
377 if (fd->
nfps < 0)
return;
393 op = fd->
stats->ops + opx;
404 if (fd ==
NULL)
return;
416 if (fd ==
NULL)
return;
439 static int usec_scale = (1000*1000);
443 for (opx = 0; opx < 4; opx++) {
445 if (op->
count <= 0)
continue;
449 fprintf(fp,
"%8d reads, %8lu total bytes in %d.%06d secs\n",
451 (
int)(op->
usecs/usec_scale), (
int)(op->
usecs%usec_scale));
455 fprintf(fp,
"%8d writes, %8lu total bytes in %d.%06d secs\n",
457 (
int)(op->
usecs/usec_scale), (
int)(op->
usecs%usec_scale));
566 #pragma omp parallel for if (fd->ndigests > 1)
568 for (i = fd->
ndigests - 1; i >= 0; i--) {
592 for (i = fd->
ndigests - 1; i >= 0; i--) {
605 if (datap !=
NULL) *(
void **)datap =
NULL;
606 if (lenp !=
NULL) *lenp = 0;
620 for (i = fd->
ndigests - 1; i >= 0; i--) {
658 if (cookie ==
NULL)
return -2;
Structure(s)and methods for a XAR archive wrapper format.
static void fdInitDigest(FD_t fd, pgpHashAlgo hashalgo, int _flags)
Attach digest to fd.
enum rpmDigestFlags_e rpmDigestFlags
Bit(s) to control digest operation.
static void fdPop(FD_t fd)
static int fdGetOFlags(FD_t fd)
static void fdSetIo(FD_t fd, FDIO_t io)
static void fdSetXAR(FD_t fd, rpmxar xar)
static void fdPush(FD_t fd, FDIO_t io, void *fp, int fdno)
int ftpCmd(const char *cmd, const char *url, const char *arg2)
OpenPGP constants and structures from RFC-2440.
static unsigned long long fdGetCpioPos(FD_t fd)
char * xstrdup(const char *str)
static int fdGetRdTimeoutSecs(FD_t fd)
static void fdSetContentLength(FD_t fd, ssize_t contentLength)
static void fdSetOpen(FD_t fd, const char *path, int flags, mode_t mode)
FD_t ftpOpen(const char *url, int flags, mode_t mode, urlinfo *uret)
struct _FDSTACK_s FDSTACK_t
enum fdOpX_e fdOpX
Identify per-desciptor I/O operation statistics.
static void fdSetCpioPos(FD_t fd, long int cpioPos)
int ufdClose(void *cookie)
static PyObject *char * mode
struct _FDDIGEST_s * FDDIGEST_t
Yet Another syslog(3) API clone.
assert(key->size==sizeof(hdrNum))
struct rpmop_s ops[FDSTAT_MAX]
static void fdSetFdno(FD_t fd, int fdno)
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
static rpmxar fdGetXAR(FD_t fd)
static void fdSetFp(FD_t fd, void *fp)
enum pgpHashAlgo_e pgpHashAlgo
9.4.
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
Update context with next plain text buffer.
const char * fdbg(FD_t fd)
pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
Return digest algorithm identifier.
static void fdInitHmac(FD_t fd, const void *key, size_t keylen)
Attach digest to fd.
The FD_t File Handle data structure.
pgpDig pgpDigFree(pgpDig dig)
Destroy a container for parsed OpenPGP packates.
static int fdFileno(void *cookie)
DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
Initialize digest.
pgpDig pgpDigLink(pgpDig dig)
Reference a signature parameters instance.
static void fdSetDig(FD_t fd, pgpDig dig)
static void fdstat_enter(FD_t fd, int opx)
static int fdGetFdno(FD_t fd)
struct @6 * FDSTAT_t
Cumulative statistics for a descriptor.
Cumulative statistics for an operation.
static FDIO_t fdGetIo(FD_t fd)
static void fdstat_exit(FD_t fd, int opx, ssize_t rc)
unsigned long long fd_cpioPos
int fdFgets(FD_t fd, char *buf, size_t len)
int rpmHmacInit(DIGEST_CTX ctx, const void *key, size_t keylen)
Compute key material and add to digest context.
fdOpX_e
Identify per-desciptor I/O operation statistics.
static FILE * fdGetFILE(FD_t fd)
static void fdStealDigest(FD_t fd, pgpDig dig)
static void fdUpdateDigests(FD_t fd, const unsigned char *buf, ssize_t buflen)
Update digest(s) attached to fd.
const char * contentDisposition
static FD_t c2f(void *cookie)
static const char * fdGetOPath(FD_t fd)
static void * fdGetFp(FD_t fd)
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
static mode_t fdGetOMode(FD_t fd)
static void fdFiniDigest(FD_t fd, pgpHashAlgo hashalgo, void *datap, size_t *lenp, int asAscii)
char * buf
Parse (and execute) macro undefinition.
static rpmop fdstat_op(FD_t fd, fdOpX opx)
void rpmDigestFinal(rpmDigestDup(md5ctx),&md5sum,&md5len, 0)
int ftpReq(FD_t data, const char *ftpCmd, const char *ftpArg)
static pgpDig fdGetDig(FD_t fd)
rpmxar rpmxarLink(rpmxar xar, const char *msg)
Reference a xar archive instance.
static void fdstat_print(FD_t fd, const char *msg, FILE *fp)
static void fdSetSyserrno(FD_t fd, int syserrno, const void *errcookie)