|
|
2ff057 |
#ifndef _RPMPLUGIN_H
|
|
|
2ff057 |
#define _RPMPLUGIN_H
|
|
|
2ff057 |
|
|
|
2ff057 |
#include <rpm/rpmtypes.h>
|
|
|
2ff057 |
#include <rpm/rpmfi.h>
|
|
|
2ff057 |
|
|
|
2ff057 |
/** \ingroup rpmplugin
|
|
|
2ff057 |
* Rpm plugin API
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
|
|
|
2ff057 |
/* indicates the way the scriptlet is executed */
|
|
|
2ff057 |
typedef enum rpmScriptletExecutionFlow_e {
|
|
|
2ff057 |
RPMSCRIPTLET_NONE = 0,
|
|
|
2ff057 |
RPMSCRIPTLET_FORK = 1 << 0,
|
|
|
2ff057 |
RPMSCRIPTLET_EXEC = 1 << 1
|
|
|
2ff057 |
} rpmScriptletExecutionFlow;
|
|
|
2ff057 |
|
|
|
2ff057 |
|
|
|
2ff057 |
/** \ingroup rpmfi
|
|
|
2ff057 |
* File disposition flags during package install/erase transaction.
|
|
|
2ff057 |
* XXX: Move these to rpmfi.h once things stabilize.
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
enum rpmFileActionFlags_e {
|
|
|
2ff057 |
/* bits 0-15 reserved for actions */
|
|
|
2ff057 |
FAF_UNOWNED = (1 << 31)
|
|
|
2ff057 |
};
|
|
|
2ff057 |
typedef rpmFlags rpmFileActionFlags;
|
|
|
2ff057 |
|
|
|
2ff057 |
/** \ingroup rpmfi
|
|
|
2ff057 |
* File action and associated flags on install/erase
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
typedef rpmFlags rpmFsmOp;
|
|
|
2ff057 |
|
|
|
2ff057 |
#define XFA_MASK 0x0000ffff
|
|
|
2ff057 |
#define XFAF_MASK ~(XFA_MASK)
|
|
|
2ff057 |
#define XFO_ACTION(_a) ((_a) & XFA_MASK) /*!< File op action part */
|
|
|
2ff057 |
#define XFO_FLAGS(_a) ((_a) & XFAF_MASK) /*!< File op flags part */
|
|
|
2ff057 |
|
|
|
2ff057 |
/* plugin hook typedefs */
|
|
|
2ff057 |
typedef rpmRC (*plugin_init_func)(rpmPlugin plugin, rpmts ts);
|
|
|
2ff057 |
typedef void (*plugin_cleanup_func)(rpmPlugin plugin);
|
|
|
2ff057 |
typedef rpmRC (*plugin_tsm_pre_func)(rpmPlugin plugin, rpmts ts);
|
|
|
2ff057 |
typedef rpmRC (*plugin_tsm_post_func)(rpmPlugin plugin, rpmts ts, int res);
|
|
|
2ff057 |
typedef rpmRC (*plugin_psm_pre_func)(rpmPlugin plugin, rpmte te);
|
|
|
2ff057 |
typedef rpmRC (*plugin_psm_post_func)(rpmPlugin plugin, rpmte te, int res);
|
|
|
2ff057 |
typedef rpmRC (*plugin_scriptlet_pre_func)(rpmPlugin plugin,
|
|
|
2ff057 |
const char *s_name, int type);
|
|
|
2ff057 |
typedef rpmRC (*plugin_scriptlet_fork_post_func)(rpmPlugin plugin,
|
|
|
2ff057 |
const char *path, int type);
|
|
|
2ff057 |
typedef rpmRC (*plugin_scriptlet_post_func)(rpmPlugin plugin,
|
|
|
2ff057 |
const char *s_name, int type,
|
|
|
2ff057 |
int res);
|
|
|
2ff057 |
typedef rpmRC (*plugin_fsm_file_pre_func)(rpmPlugin plugin, rpmfi fi,
|
|
|
2ff057 |
const char* path, mode_t file_mode,
|
|
|
2ff057 |
rpmFsmOp op);
|
|
|
2ff057 |
typedef rpmRC (*plugin_fsm_file_post_func)(rpmPlugin plugin, rpmfi fi,
|
|
|
2ff057 |
const char* path, mode_t file_mode,
|
|
|
2ff057 |
rpmFsmOp op, int res);
|
|
|
2ff057 |
typedef rpmRC (*plugin_fsm_file_prepare_func)(rpmPlugin plugin, rpmfi fi,
|
|
|
2ff057 |
const char* path,
|
|
|
2ff057 |
const char *dest,
|
|
|
2ff057 |
mode_t file_mode, rpmFsmOp op);
|
|
|
2ff057 |
|
|
|
2ff057 |
typedef struct rpmPluginHooks_s * rpmPluginHooks;
|
|
|
2ff057 |
struct rpmPluginHooks_s {
|
|
|
2ff057 |
/* plugin constructor and destructor hooks */
|
|
|
2ff057 |
plugin_init_func init;
|
|
|
2ff057 |
plugin_cleanup_func cleanup;
|
|
|
2ff057 |
/* per transaction plugin hooks */
|
|
|
2ff057 |
plugin_tsm_pre_func tsm_pre;
|
|
|
2ff057 |
plugin_tsm_post_func tsm_post;
|
|
|
2ff057 |
/* per transaction element hooks */
|
|
|
2ff057 |
plugin_psm_pre_func psm_pre;
|
|
|
2ff057 |
plugin_psm_post_func psm_post;
|
|
|
2ff057 |
/* per scriptlet hooks */
|
|
|
2ff057 |
plugin_scriptlet_pre_func scriptlet_pre;
|
|
|
2ff057 |
plugin_scriptlet_fork_post_func scriptlet_fork_post;
|
|
|
2ff057 |
plugin_scriptlet_post_func scriptlet_post;
|
|
|
2ff057 |
/* per file hooks */
|
|
|
2ff057 |
plugin_fsm_file_pre_func fsm_file_pre;
|
|
|
2ff057 |
plugin_fsm_file_post_func fsm_file_post;
|
|
|
2ff057 |
plugin_fsm_file_prepare_func fsm_file_prepare;
|
|
|
2ff057 |
};
|
|
|
2ff057 |
|
|
|
2ff057 |
#ifdef __cplusplus
|
|
|
2ff057 |
extern "C" {
|
|
|
2ff057 |
#endif
|
|
|
2ff057 |
|
|
|
2ff057 |
/** \ingroup rpmplugin
|
|
|
2ff057 |
* Return plugin name
|
|
|
2ff057 |
* @param plugin plugin handle
|
|
|
2ff057 |
* @return plugin name string
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
const char *rpmPluginName(rpmPlugin plugin);
|
|
|
2ff057 |
|
|
|
2ff057 |
/** \ingroup rpmplugin
|
|
|
2ff057 |
* Return plugin options
|
|
|
2ff057 |
* @param plugin plugin handle
|
|
|
2ff057 |
* @return plugin options string (or NULL if none)
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
const char *rpmPluginOpts(rpmPlugin plugin);
|
|
|
2ff057 |
|
|
|
2ff057 |
/** \ingroup rpmplugin
|
|
|
2ff057 |
* Set plugin private data
|
|
|
2ff057 |
* @param plugin plugin handle
|
|
|
2ff057 |
* @param data pointer to plugin private data
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
void rpmPluginSetData(rpmPlugin plugin, void *data);
|
|
|
2ff057 |
|
|
|
2ff057 |
/** \ingroup rpmplugin
|
|
|
2ff057 |
* Get plugin private data
|
|
|
2ff057 |
* @param plugin plugin handle
|
|
|
2ff057 |
* @return pointer to plugin private data
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
void * rpmPluginGetData(rpmPlugin plugin);
|
|
|
2ff057 |
|
|
|
2ff057 |
#ifdef __cplusplus
|
|
|
2ff057 |
}
|
|
|
2ff057 |
#endif
|
|
|
2ff057 |
#endif /* _RPMPLUGIN_H */
|