summaryrefslogtreecommitdiff
path: root/lib/rpmgi.h
blob: 53a9f3f7b75af606fa785e6f4d1811f3e0340e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#ifndef	H_RPMGI
#define	H_RPMGI

/** \ingroup rpmio
 * \file rpmio/rpmgi.h
 */

#include <rpmlib.h>
#include <rpmts.h>
#include <fts.h>
#include <argv.h>

/**
 */
/*@-exportlocal@*/
/*@unchecked@*/
extern int _rpmgi_debug;
/*@=exportlocal@*/

/**
 */
typedef /*@abstract@*/ struct rpmgi_s * rpmgi;

/**
 */
typedef enum rpmgiTag_e {
    RPMGI_RPMDB		= RPMDBI_PACKAGES,
    RPMGI_HDLIST	= 6,	/* XXX next after RPMDBI_AVAILABLE */
    RPMGI_ARGLIST	= 7,
    RPMGI_FTSWALK	= 8
} rpmgiTag;

#if defined(_RPMGI_INTERNAL)
/** \ingroup rpmio
 */
struct rpmgi_s {
/*@refcounted@*/
    rpmts ts;
    int tag;
    int i;

/*@dependent@*/
    rpmdbMatchIterator mi;

/*@refcounted@*/
    FD_t fd;

/*@only@*/
    const char * queryFormat;

/*@dependent@*/
    ARGV_t argv;
    int argc;
    int ftsOpts;
/*@dependent@*/
    FTS * ftsp;
/*@dependent@*/
    FTSENT * fts;

/*@refs@*/
    int nrefs;
};
#endif

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Unreference a generalized iterator instance.
 * @param gi		generalized iterator
 * @param msg
 * @return		NULL always
 */
/*@unused@*/ /*@null@*/
rpmgi rpmgiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi,
		/*@null@*/ const char * msg)
	/*@modifies gi @*/;

/** @todo Remove debugging entry from the ABI. */
/*@-exportlocal@*/
/*@null@*/
rpmgi XrpmgiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi,
		/*@null@*/ const char * msg, const char * fn, unsigned ln)
	/*@modifies gi @*/;
/*@=exportlocal@*/
#define	rpmgiUnlink(_gi, _msg)	XrpmgiUnlink(_gi, _msg, __FILE__, __LINE__)

/**
 * Reference a generalized iterator instance.
 * @param gi		generalized iterator
 * @param msg
 * @return		new generalized iterator reference
 */
/*@unused@*/ /*@newref@*/ /*@null@*/
rpmgi rpmgiLink (/*@null@*/ rpmgi gi, /*@null@*/ const char * msg)
	/*@modifies gi @*/;

/** @todo Remove debugging entry from the ABI. */
/*@newref@*/ /*@null@*/
rpmgi XrpmgiLink (/*@null@*/ rpmgi gi, /*@null@*/ const char * msg,
		const char * fn, unsigned ln)
        /*@modifies gi @*/;
#define	rpmgiLink(_gi, _msg)	XrpmgiLink(_gi, _msg, __FILE__, __LINE__)

/** Destroy a generalized iterator.
 * @param gi		generalized iterator
 * @return		NULL always
 */
/*@only@*/
rpmgi rpmgiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi)
	/*@modifies gi @*/;

/** Create a generalized iterator.
 * @param argv		iterator argv array
 * @param flags		iterator flags
 * @return		new general iterator
 */
/*@only@*/
rpmgi rpmgiNew(rpmts ts, int tag, /*@only@*/ void *const keyp, size_t keylen)
	/*@*/;

const char * rpmgiNext(/*@null@*/ rpmgi gi)
        /*@modifies gi @*/;

int rpmgiSetQueryFormat(rpmgi gi, const char * queryFormat)
	/*@modifies gi @*/;

#ifdef __cplusplus
}
#endif

#endif	/* H_RPMGI */