X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-monitor%2Fback-monitor.h;h=cd0189d165de6238ecfc1566f0e99be15afa643c;hb=966cef8c9a3238efe0c482ad0ee08fd98944d112;hp=1554de07c0b64e6ecd91359476c22ecbe2a7bae2;hpb=c8fd4a203bc16a7cdc18aefc0cfd53b17eb84ae2;p=openldap diff --git a/servers/slapd/back-monitor/back-monitor.h b/servers/slapd/back-monitor/back-monitor.h index 1554de07c0..cd0189d165 100644 --- a/servers/slapd/back-monitor/back-monitor.h +++ b/servers/slapd/back-monitor/back-monitor.h @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2001-2004 The OpenLDAP Foundation. + * Copyright 2001-2011 The OpenLDAP Foundation. * Portions Copyright 2001-2003 Pierangelo Masarati. * All rights reserved. * @@ -29,43 +29,54 @@ LDAP_BEGIN_DECL -/* - * The cache maps DNs to Entries. - * Each entry, on turn, holds the list of its children in the e_private field. - * This is used by search operation to perform onelevel and subtree candidate - * selection. - */ -struct monitorcache { - struct berval mc_ndn; - Entry *mc_e; -}; +/* define if si_ad_labeledURI is removed from slap_schema */ +#undef MONITOR_DEFINE_LABELEDURI + +typedef struct monitor_callback_t { + int (*mc_update)( Operation *op, SlapReply *rs, Entry *e, void *priv ); + /* update callback + for user-defined entries */ + int (*mc_modify)( Operation *op, SlapReply *rs, Entry *e, void *priv ); + /* modify callback + for user-defined entries */ + int (*mc_free)( Entry *e, void **priv ); + /* delete callback + for user-defined entries */ + void (*mc_dispose)( void **priv ); + /* dispose callback + to dispose of the callback + private data itself */ + void *mc_private; /* opaque pointer to + private data */ + struct monitor_callback_t *mc_next; +} monitor_callback_t; -struct monitorentrypriv { + +typedef struct monitor_entry_t { ldap_pvt_thread_mutex_t mp_mutex; /* entry mutex */ Entry *mp_next; /* pointer to next sibling */ Entry *mp_children; /* pointer to first child */ - struct monitorsubsys *mp_info; /* subsystem info */ + struct monitor_subsys_t *mp_info; /* subsystem info */ #define mp_type mp_info->mss_type unsigned long mp_flags; /* flags */ -#define MONITOR_F_NONE 0x00U -#define MONITOR_F_SUB 0x01U /* subentry of subsystem */ -#define MONITOR_F_PERSISTENT 0x10U /* persistent entry */ -#define MONITOR_F_PERSISTENT_CH 0x20U /* subsystem generates +#define MONITOR_F_NONE 0x0000U +#define MONITOR_F_SUB 0x0001U /* subentry of subsystem */ +#define MONITOR_F_PERSISTENT 0x0010U /* persistent entry */ +#define MONITOR_F_PERSISTENT_CH 0x0020U /* subsystem generates persistent entries */ -#define MONITOR_F_VOLATILE 0x40U /* volatile entry */ -#define MONITOR_F_VOLATILE_CH 0x80U /* subsystem generates +#define MONITOR_F_VOLATILE 0x0040U /* volatile entry */ +#define MONITOR_F_VOLATILE_CH 0x0080U /* subsystem generates volatile entries */ +#define MONITOR_F_EXTERNAL 0x0100U /* externally added - don't free */ /* NOTE: flags with 0xF0000000U mask are reserved for subsystem internals */ - int (*mp_update)( Operation *op, Entry *e ); - /* update callback - for user-defined entries */ - void *mp_private; /* opaque pointer to - private data */ -}; + struct monitor_callback_t *mp_cb; /* callback sequence */ +} monitor_entry_t; + +struct entry_limbo_t; /* in init.c */ -struct monitorinfo { +typedef struct monitor_info_t { /* * Internal data @@ -76,44 +87,59 @@ struct monitorinfo { /* * Config parameters */ - struct berval mi_l; struct berval mi_startTime; /* don't free it! */ struct berval mi_creatorsName; /* don't free it! */ + struct berval mi_ncreatorsName; /* don't free it! */ /* * Specific schema entities */ - ObjectClass *mi_oc_monitor; - ObjectClass *mi_oc_monitorServer; - ObjectClass *mi_oc_monitorContainer; - ObjectClass *mi_oc_monitorCounterObject; - ObjectClass *mi_oc_monitorOperation; - ObjectClass *mi_oc_monitorConnection; - ObjectClass *mi_oc_managedObject; - ObjectClass *mi_oc_monitoredObject; - - AttributeDescription *mi_ad_monitoredInfo; - AttributeDescription *mi_ad_managedInfo; - AttributeDescription *mi_ad_monitorCounter; - AttributeDescription *mi_ad_monitorOpCompleted; - AttributeDescription *mi_ad_monitorOpInitiated; - AttributeDescription *mi_ad_monitorConnectionNumber; - AttributeDescription *mi_ad_monitorConnectionAuthzDN; - AttributeDescription *mi_ad_monitorConnectionLocalAddress; - AttributeDescription *mi_ad_monitorConnectionPeerAddress; - AttributeDescription *mi_ad_monitorTimestamp; - AttributeDescription *mi_ad_monitorOverlay; + ObjectClass *mi_oc_monitor; + ObjectClass *mi_oc_monitorServer; + ObjectClass *mi_oc_monitorContainer; + ObjectClass *mi_oc_monitorCounterObject; + ObjectClass *mi_oc_monitorOperation; + ObjectClass *mi_oc_monitorConnection; + ObjectClass *mi_oc_managedObject; + ObjectClass *mi_oc_monitoredObject; + + AttributeDescription *mi_ad_monitoredInfo; + AttributeDescription *mi_ad_managedInfo; + AttributeDescription *mi_ad_monitorCounter; + AttributeDescription *mi_ad_monitorOpCompleted; + AttributeDescription *mi_ad_monitorOpInitiated; + AttributeDescription *mi_ad_monitorConnectionNumber; + AttributeDescription *mi_ad_monitorConnectionAuthzDN; + AttributeDescription *mi_ad_monitorConnectionLocalAddress; + AttributeDescription *mi_ad_monitorConnectionPeerAddress; + AttributeDescription *mi_ad_monitorTimestamp; + AttributeDescription *mi_ad_monitorOverlay; + AttributeDescription *mi_ad_monitorConnectionProtocol; + AttributeDescription *mi_ad_monitorConnectionOpsReceived; + AttributeDescription *mi_ad_monitorConnectionOpsExecuting; + AttributeDescription *mi_ad_monitorConnectionOpsPending; + AttributeDescription *mi_ad_monitorConnectionOpsCompleted; + AttributeDescription *mi_ad_monitorConnectionGet; + AttributeDescription *mi_ad_monitorConnectionRead; + AttributeDescription *mi_ad_monitorConnectionWrite; + AttributeDescription *mi_ad_monitorConnectionMask; + AttributeDescription *mi_ad_monitorConnectionListener; + AttributeDescription *mi_ad_monitorConnectionPeerDomain; + AttributeDescription *mi_ad_monitorConnectionStartTime; + AttributeDescription *mi_ad_monitorConnectionActivityTime; + AttributeDescription *mi_ad_monitorIsShadow; + AttributeDescription *mi_ad_monitorUpdateRef; + AttributeDescription *mi_ad_monitorRuntimeConfig; + AttributeDescription *mi_ad_monitorSuperiorDN; /* * Generic description attribute */ - AttributeDescription *mi_ad_description; - AttributeDescription *mi_ad_seeAlso; - AttributeDescription *mi_ad_l; - AttributeDescription *mi_ad_labeledURI; - AttributeDescription *mi_ad_readOnly; - AttributeDescription *mi_ad_restrictedOperation; -}; + AttributeDescription *mi_ad_readOnly; + AttributeDescription *mi_ad_restrictedOperation; + + struct entry_limbo_t *mi_entry_limbo; +} monitor_info_t; /* * DNs @@ -175,7 +201,7 @@ enum { #define SLAPD_MONITOR_OPS_DN \ SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN -#define SLAPD_MONITOR_OVERLAY_NAME "Overlay" +#define SLAPD_MONITOR_OVERLAY_NAME "Overlays" #define SLAPD_MONITOR_OVERLAY_RDN \ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OVERLAY_NAME #define SLAPD_MONITOR_OVERLAY_DN \ @@ -217,11 +243,12 @@ enum { #define SLAPD_MONITOR_RWW_DN \ SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN -typedef struct monitorsubsys { +typedef struct monitor_subsys_t { char *mss_name; struct berval mss_rdn; struct berval mss_dn; struct berval mss_ndn; + struct berval mss_desc[ 3 ]; int mss_flags; #define MONITOR_F_OPENED 0x10000000U @@ -231,20 +258,53 @@ typedef struct monitorsubsys { ( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) ) /* initialize entry and subentries */ - int ( *mss_open )( BackendDB *, struct monitorsubsys *ms ); + int ( *mss_open )( BackendDB *, struct monitor_subsys_t *ms ); + /* destroy structure */ + int ( *mss_destroy )( BackendDB *, struct monitor_subsys_t *ms ); /* update existing dynamic entry and subentries */ - int ( *mss_update )( Operation *, Entry * ); + int ( *mss_update )( Operation *, SlapReply *, Entry * ); /* create new dynamic subentries */ - int ( *mss_create )( Operation *, + int ( *mss_create )( Operation *, SlapReply *, struct berval *ndn, Entry *, Entry ** ); /* modify entry and subentries */ - int ( *mss_modify )( Operation *, Entry * ); -} monitorsubsys; + int ( *mss_modify )( Operation *, SlapReply *, Entry * ); +} monitor_subsys_t; extern BackendDB *be_monitor; /* increase this bufsize if entries in string form get too big */ -#define BACKMONITOR_BUFSIZE 1024 +#define BACKMONITOR_BUFSIZE 8192 + +typedef int (monitor_cbfunc)( struct berval *ndn, monitor_callback_t *cb, + struct berval *base, int scope, struct berval *filter ); + +typedef int (monitor_cbafunc)( struct berval *ndn, Attribute *a, + monitor_callback_t *cb, + struct berval *base, int scope, struct berval *filter ); + +typedef struct monitor_extra_t { + int (*is_configured)(void); + monitor_subsys_t * (*get_subsys)( const char *name ); + monitor_subsys_t * (*get_subsys_by_dn)( struct berval *ndn, int sub ); + + int (*register_subsys)( monitor_subsys_t *ms ); + int (*register_backend)( BackendInfo *bi ); + int (*register_database)( BackendDB *be, struct berval *ndn_out ); + int (*register_overlay_info)( slap_overinst *on ); + int (*register_overlay)( BackendDB *be, slap_overinst *on, struct berval *ndn_out ); + int (*register_entry)( Entry *e, monitor_callback_t *cb, + monitor_subsys_t *ms, unsigned long flags ); + int (*register_entry_parent)( Entry *e, monitor_callback_t *cb, + monitor_subsys_t *ms, unsigned long flags, + struct berval *base, int scope, struct berval *filter ); + monitor_cbafunc *register_entry_attrs; + monitor_cbfunc *register_entry_callback; + + int (*unregister_entry)( struct berval *ndn ); + monitor_cbfunc *unregister_entry_parent; + monitor_cbafunc *unregister_entry_attrs; + monitor_cbfunc *unregister_entry_callback; +} monitor_extra_t; LDAP_END_DECL