Sanitize python object -> tag number exception handling
[platform/upstream/rpm.git] / lib / rpmte_internal.h
1 #ifndef _RPMTE_INTERNAL_H
2 #define _RPMTE_INTERNAL_H
3
4 #include <rpm/rpmte.h>
5 #include <rpm/rpmds.h>
6
7 /** \ingroup rpmte
8  * Dependncy ordering information.
9  */
10
11 struct relation_s {
12     rpmte   rel_suc;  // pkg requiring this package
13     rpmsenseFlags rel_flags; // accumulated flags of the requirements
14     struct relation_s * rel_next;
15 };
16
17 typedef struct relation_s * relation;
18
19 struct tsortInfo_s {
20     int      tsi_count;     // #pkgs this pkg requires
21     int      tsi_qcnt;      // #pkgs requiring this package
22     int      tsi_reqx;       // requires Idx/mark as (queued/loop)
23     struct relation_s * tsi_relations;
24     struct relation_s * tsi_forward_relations;
25     rpmte    tsi_suc;        // used for queuing (addQ)
26     int      tsi_SccIdx;     // # of the SCC the node belongs to
27                              // (1 for trivial SCCs)
28     int      tsi_SccLowlink; // used for SCC detection
29 };
30
31 /**
32  */
33 typedef struct sharedFileInfo_s *               sharedFileInfo;
34
35 /** \ingroup rpmte
36  * Transaction element file states.
37  */
38 typedef struct rpmfs_s *                rpmfs;
39
40 /**
41  */
42 struct sharedFileInfo_s {
43     int pkgFileNum;
44     int otherPkg;
45     int otherFileNum;
46 };
47
48 typedef char rpm_fstate_t;
49
50 struct rpmfs_s {
51     unsigned int fc;
52
53     rpm_fstate_t * states;
54     rpmFileAction * actions;    /*!< File disposition(s). */
55
56     sharedFileInfo replaced;    /*!< (TR_ADDED) to be replaced files in the rpmdb */
57     int numReplaced;
58     int allocatedReplaced;
59 };
60
61 /**
62  * Iterator across transaction elements, forward on install, backward on erase.
63  */
64 struct rpmtsi_s {
65     rpmts ts;           /*!< transaction set. */
66     int reverse;        /*!< reversed traversal? */
67     int ocsave;         /*!< last returned iterator index. */
68     int oc;             /*!< iterator index. */
69 };
70
71 RPM_GNUC_INTERNAL
72 rpmfi rpmteSetFI(rpmte te, rpmfi fi);
73
74 RPM_GNUC_INTERNAL
75 FD_t rpmteSetFd(rpmte te, FD_t fd);
76
77 RPM_GNUC_INTERNAL
78 int rpmteOpen(rpmte te, rpmts ts, int reload_fi);
79
80 RPM_GNUC_INTERNAL
81 int rpmteClose(rpmte te, rpmts ts, int reset_fi);
82
83 RPM_GNUC_INTERNAL
84 int rpmteMarkFailed(rpmte te, rpmts ts);
85
86 RPM_GNUC_INTERNAL
87 int rpmteHaveTransScript(rpmte te, rpmTag tag);
88
89 RPM_GNUC_INTERNAL
90 rpmps rpmteProblems(rpmte te);
91
92 //RPM_GNUC_INTERNAL
93 rpmfs rpmteGetFileStates(rpmte te);
94
95 RPM_GNUC_INTERNAL
96 rpmfs rpmfsNew(unsigned int fc, rpmElementType type);
97
98 RPM_GNUC_INTERNAL
99 rpmfs rpmfsFree(rpmfs fs);
100
101 RPM_GNUC_INTERNAL
102 rpm_count_t rpmfsFC(rpmfs fs);
103
104 RPM_GNUC_INTERNAL
105 void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, int otherPkg, int otherFileNum);
106
107 RPM_GNUC_INTERNAL
108 sharedFileInfo rpmfsGetReplaced(rpmfs fs);
109
110 RPM_GNUC_INTERNAL
111 sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced);
112
113 RPM_GNUC_INTERNAL
114 void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state);
115
116 RPM_GNUC_INTERNAL
117 rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix);
118
119 /*
120  * May return NULL
121  */
122 RPM_GNUC_INTERNAL
123 rpm_fstate_t * rpmfsGetStates(rpmfs fs);
124
125 RPM_GNUC_INTERNAL
126 rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix);
127
128 //RPM_GNUC_INTERNAL
129 void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action);
130
131 /* XXX here for now... */
132 /**
133  * Relocate files in header.
134  * @todo multilib file dispositions need to be checked.
135  * @param relocations           relocations
136  * @param numRelocations        number of relocations
137  * @param fs                    file state set
138  * @param h                     package header to relocate
139  */
140 RPM_GNUC_INTERNAL
141 void rpmRelocateFileList(rpmRelocation *relocs, int numRelocations, rpmfs fs, Header h);
142
143 #endif  /* _RPMTE_INTERNAL_H */
144