]> git.sur5r.net Git - openldap/blob - servers/slapd/back-monitor/operational.c
Notice and acknowledgements
[openldap] / servers / slapd / back-monitor / operational.c
1 /* operational.c - monitor backend operational attributes function */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2003 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16 /* ACKNOWLEDGEMENTS:
17  * This work was initially developed by Pierangelo Masarati for inclusion
18  * in OpenLDAP Software.
19  */
20
21 #ifndef _BACK_MONITOR_H_
22 #define _BACK_MONITOR_H_
23
24 #include <ldap_pvt.h>
25 #include <ldap_pvt_thread.h>
26 #include <avl.h>
27 #include <slap.h>
28
29 LDAP_BEGIN_DECL
30
31 /*
32  * The cache maps DNs to Entries.
33
34 #include "portable.h"
35
36 #include <stdio.h>
37
38 #include <ac/string.h>
39 #include <ac/socket.h>
40
41 #include "slap.h"
42 #include "back-monitor.h"
43 #include "proto-back-monitor.h"
44
45 /*
46  * sets the supported operational attributes (if required)
47  */
48
49 int
50 monitor_back_operational(
51         Operation       *op,
52         SlapReply       *rs,
53         int             opattrs,
54         Attribute       **a )
55 {
56         Attribute       **aa = a;
57
58         assert( rs->sr_entry );
59
60         if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates,
61                                 rs->sr_attrs ) ) {
62                 int                     hs;
63                 struct monitorentrypriv *mp;
64
65                 mp = ( struct monitorentrypriv * )rs->sr_entry->e_private;
66
67                 assert( mp );
68
69                 hs = MONITOR_HAS_CHILDREN( mp );
70                 *aa = slap_operational_hasSubordinate( hs );
71                 if ( *aa != NULL ) {
72                         aa = &(*aa)->a_next;
73                 }
74         }
75         
76         return 0;
77 }
78