]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/back-monitor.h
Fix LBER_ERROR vs. -1 confusion.
[openldap] / servers / slapd / back-monitor / back-monitor.h
index 73c360a4092ebea45f3e5ca5105b63cb986502d9..9bc463a1b50ea8723d2e83f2982bb64195771054 100644 (file)
@@ -1,12 +1,9 @@
 /* back-monitor.h - ldap monitor back-end header file */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
- * Copyright 2001 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- * 
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
  * 
  * This work has beed deveolped for the OpenLDAP Foundation 
@@ -51,7 +48,7 @@ LDAP_BEGIN_DECL
  * selection.
  */
 struct monitorcache {
-       char                    *mc_ndn;
+       struct berval           mc_ndn;
        Entry                   *mc_e;
 };
 
@@ -82,7 +79,7 @@ struct monitorinfo {
  * DNs
  */
 #define        SLAPD_MONITOR_LISTENER          0
-#define SLAPD_MONITOR_LISTENER_NAME    "Listener"
+#define SLAPD_MONITOR_LISTENER_NAME    "Listeners"
 #define SLAPD_MONITOR_LISTENER_RDN     \
        "cn=" SLAPD_MONITOR_LISTENER_NAME
 #define SLAPD_MONITOR_LISTENER_DN      \
@@ -144,25 +141,69 @@ struct monitorinfo {
 #define SLAPD_MONITOR_WRITEW_DN        \
        SLAPD_MONITOR_WRITEW_RDN "," SLAPD_MONITOR_DN
 
+#define SLAPD_MONITOR_LOG              9
+#define SLAPD_MONITOR_LOG_NAME         "Log"
+#define SLAPD_MONITOR_LOG_RDN  \
+       "cn=" SLAPD_MONITOR_LOG_NAME
+#define SLAPD_MONITOR_LOG_DN   \
+       SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
+
+#define SLAPD_MONITOR_OPS              10
+#define SLAPD_MONITOR_OPS_NAME         "Operations"
+#define SLAPD_MONITOR_OPS_RDN  \
+       "cn=" SLAPD_MONITOR_OPS_NAME
+#define SLAPD_MONITOR_OPS_DN   \
+       SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
+
+#define SLAPD_MONITOR_SENT             11
+#define SLAPD_MONITOR_SENT_NAME                "Statistics"
+#define SLAPD_MONITOR_SENT_RDN \
+       "cn=" SLAPD_MONITOR_SENT_NAME
+#define SLAPD_MONITOR_SENT_DN  \
+       SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
+
+#define SLAPD_MONITOR_TIME             12
+#define SLAPD_MONITOR_TIME_NAME                "Time"
+#define SLAPD_MONITOR_TIME_RDN  \
+       "cn=" SLAPD_MONITOR_TIME_NAME
+#define SLAPD_MONITOR_TIME_DN   \
+       SLAPD_MONITOR_TIME_RDN "," SLAPD_MONITOR_DN
+
+#define SLAPD_MONITOR_OBJECTCLASSES \
+       "objectClass: top\n" \
+       "objectClass: monitor\n" \
+       "objectClass: extensibleObject\n" \
+       "structuralObjectClass: monitor\n"
+
 struct monitorsubsys {
        int             mss_type;
        char            *mss_name;
-       char            *mss_rdn;
-       char            *mss_dn;
-       char            *mss_ndn;
+       struct berval   mss_rdn;
+       struct berval   mss_dn;
+       struct berval   mss_ndn;
        int             mss_flags;
 
 #define MONITOR_HAS_VOLATILE_CH( mp ) \
        ( ( mp )->mp_flags & MONITOR_F_VOLATILE_CH )
+#define MONITOR_HAS_CHILDREN( mp ) \
+       ( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
 
+       /* initialize entry and subentries */
        int             ( *mss_init )( BackendDB * );
+       /* update existing dynamic entry and subentries */
        int             ( *mss_update )( struct monitorinfo *, Entry * );
-       int             ( *mss_create )( struct monitorinfo *, const char *ndn, Entry *, Entry ** );
+       /* create new dynamic subentries */
+       int             ( *mss_create )( struct monitorinfo *, 
+                               struct berval *ndn, Entry *, Entry ** );
+       /* modify entry and subentries */
+       int             ( *mss_modify )( struct monitorinfo *, Entry *, 
+                               Modifications *modlist );
 };
 
 extern struct monitorsubsys monitor_subsys[];
 
 extern AttributeDescription *monitor_ad_desc;
+extern BackendDB *be_monitor;
 
 /*
  * cache
@@ -171,8 +212,8 @@ extern AttributeDescription *monitor_ad_desc;
 extern int monitor_cache_cmp LDAP_P(( const void *c1, const void *c2 ));
 extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
 extern int monitor_cache_add LDAP_P(( struct monitorinfo *mi, Entry *e ));
-extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, const char *ndn, Entry **ep ));
-extern int monitor_cache_dn2entry LDAP_P(( struct monitorinfo *mi, const char *ndn, Entry **ep ));
+extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep ));
+extern int monitor_cache_dn2entry LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep, Entry **matched ));
 extern int monitor_cache_lock LDAP_P(( Entry *e ));
 extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
 
@@ -181,7 +222,8 @@ extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
  */
 
 extern int monitor_entry_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
-extern int monitor_entry_create LDAP_P(( struct monitorinfo *mi, const char *ndn, Entry *e_parent, Entry **ep ));
+extern int monitor_entry_create LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry *e_parent, Entry **ep ));
+extern int monitor_entry_modify LDAP_P(( struct monitorinfo *mi, Entry *e, Modifications *modlist ));
 
 LDAP_END_DECL