1 #ifndef	_RPMTE_INTERNAL_H
2 #define _RPMTE_INTERNAL_H
3 
4 #include <rpm/rpmte.h>
5 #include <rpm/rpmds.h>
6 #include "lib/rpmfs.h"
7 
8 typedef enum pkgGoal_e {
9     PKG_NONE		= 0,
10     /* permit using rpmteType() for install + erase goals */
11     PKG_INSTALL		= TR_ADDED,
12     PKG_ERASE		= TR_REMOVED,
13     /* permit using scriptname for these for now... */
14     PKG_VERIFY		= RPMTAG_VERIFYSCRIPT,
15     PKG_PRETRANS	= RPMTAG_PRETRANS,
16     PKG_POSTTRANS	= RPMTAG_POSTTRANS,
17     PKG_TRANSFILETRIGGERIN	= RPMTAG_TRANSFILETRIGGERIN,
18     PKG_TRANSFILETRIGGERUN	= RPMTAG_TRANSFILETRIGGERUN,
19 } pkgGoal;
20 
21 /** \ingroup rpmte
22  * Transaction element ordering chain linkage.
23  */
24 typedef struct tsortInfo_s *		tsortInfo;
25 
26 enum addOp_e {
27   RPMTE_INSTALL       = 0,
28   RPMTE_UPGRADE       = 1,
29   RPMTE_REINSTALL     = 2,
30 };
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /** \ingroup rpmte
37  * Create a transaction element.
38  * @param ts		transaction set
39  * @param h		header
40  * @param type		TR_ADDED/TR_REMOVED/TR_RPMDB
41  * @param key		(TR_ADDED) package retrieval key (e.g. file name)
42  * @param relocs	(TR_ADDED) package file relocations
43  * @param addop         (TR_ADDED) RPMTE_INSTALL/UPGRADE/REINSTALL
44  * @return		new transaction element
45  */
46 RPM_GNUC_INTERNAL
47 rpmte rpmteNew(rpmts ts, Header h, rpmElementType type, fnpyKey key,
48 	       rpmRelocation * relocs, int addop);
49 
50 /** \ingroup rpmte
51  * Destroy a transaction element.
52  * @param te		transaction element
53  * @return		NULL always
54  */
55 RPM_GNUC_INTERNAL
56 rpmte rpmteFree(rpmte te);
57 
58 RPM_GNUC_INTERNAL
59 void rpmteCleanFiles(rpmte te);
60 
61 RPM_GNUC_INTERNAL
62 FD_t rpmteSetFd(rpmte te, FD_t fd);
63 
64 RPM_GNUC_INTERNAL
65 FD_t rpmtePayload(rpmte te);
66 
67 RPM_GNUC_INTERNAL
68 int rpmteProcess(rpmte te, pkgGoal goal, int num);
69 
70 RPM_GNUC_INTERNAL
71 void rpmteAddProblem(rpmte te, rpmProblemType type,
72                      const char *altNEVR, const char *str, uint64_t number);
73 
74 RPM_GNUC_INTERNAL
75 void rpmteAddDepProblem(rpmte te, const char * pkgNEVR, rpmds ds,
76 		        fnpyKey * suggestedKeys);
77 
78 RPM_GNUC_INTERNAL
79 void rpmteAddRelocProblems(rpmte te);
80 
81 RPM_GNUC_INTERNAL
82 const char * rpmteTypeString(rpmte te);
83 
84 RPM_GNUC_INTERNAL
85 tsortInfo rpmteTSI(rpmte te);
86 
87 RPM_GNUC_INTERNAL
88 void rpmteSetTSI(rpmte te, tsortInfo tsi);
89 
90 RPM_GNUC_INTERNAL
91 int rpmteHaveTransScript(rpmte te, rpmTagVal tag);
92 
93 /* XXX should be internal too but build code needs for now... */
94 rpmfs rpmteGetFileStates(rpmte te);
95 
96 RPM_GNUC_INTERNAL
97 void rpmteSetVerified(rpmte te, int verified);
98 
99 /** \ingroup rpmte
100  * Retrieve size in bytes of package header.
101  * @param te		transaction element
102  * @return		size in bytes of package file.
103  */
104 RPM_GNUC_INTERNAL
105 unsigned int rpmteHeaderSize(rpmte te);
106 
107 /**
108  * Package state machine driver.
109  * @param ts		transaction set
110  * @param te		transaction element
111  * @param goal		state machine goal
112  * @return		0 on success
113  */
114 RPM_GNUC_INTERNAL
115 rpmRC rpmpsmRun(rpmts ts, rpmte te, pkgGoal goal);
116 
117 RPM_GNUC_INTERNAL
118 int rpmteAddOp(rpmte te);
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif	/* _RPMTE_INTERNAL_H */
125 
126