1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/** BEGIN COPYRIGHT BLOCK
* Copyright 2001 Sun Microsystems, Inc.
* Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
* All rights reserved.
* END COPYRIGHT BLOCK **/
/* repl_ext.c - manages operation extensions created by the
* replication system
*/
#include "repl.h"
/* structure with information for each extension */
typedef struct repl_ext
{
char *object_name; /* name of the object extended */
int object_type; /* handle to the extended object */
int handle; /* extension handle */
} repl_ext;
/* ----------------------------- Supplier ----------------------------- */
static repl_ext repl_sup_ext_list [REPL_EXT_ALL];
/* initializes replication extensions */
void repl_sup_init_ext ()
{
int rc;
/* populate the extension list */
repl_sup_ext_list[REPL_SUP_EXT_OP].object_name = SLAPI_EXT_OPERATION;
rc = slapi_register_object_extension(repl_plugin_name,
SLAPI_EXT_OPERATION,
supplier_operation_extension_constructor,
supplier_operation_extension_destructor,
&repl_sup_ext_list[REPL_SUP_EXT_OP].object_type,
&repl_sup_ext_list[REPL_SUP_EXT_OP].handle);
if(rc!=0)
{
PR_ASSERT(0); /* JCMREPL Argh */
}
}
void* repl_sup_get_ext (ext_type type, void *object)
{
/* find the requested extension */
repl_ext ext = repl_sup_ext_list [type];
void* data = slapi_get_object_extension(ext.object_type, object, ext.handle);
return data;
}
/* ----------------------------- Consumer ----------------------------- */
static repl_ext repl_con_ext_list [REPL_EXT_ALL];
/* initializes replication extensions */
void repl_con_init_ext ()
{
int rc;
/* populate the extension list */
repl_con_ext_list[REPL_CON_EXT_OP].object_name = SLAPI_EXT_OPERATION;
rc = slapi_register_object_extension(repl_plugin_name,
SLAPI_EXT_OPERATION,
consumer_operation_extension_constructor,
consumer_operation_extension_destructor,
&repl_con_ext_list[REPL_CON_EXT_OP].object_type,
&repl_con_ext_list[REPL_CON_EXT_OP].handle);
if(rc!=0)
{
PR_ASSERT(0); /* JCMREPL Argh */
}
repl_con_ext_list[REPL_CON_EXT_CONN].object_name = SLAPI_EXT_CONNECTION;
rc = slapi_register_object_extension(repl_plugin_name,
SLAPI_EXT_CONNECTION,
consumer_connection_extension_constructor,
consumer_connection_extension_destructor,
&repl_con_ext_list[REPL_CON_EXT_CONN].object_type,
&repl_con_ext_list[REPL_CON_EXT_CONN].handle);
if(rc!=0)
{
PR_ASSERT(0); /* JCMREPL Argh */
}
repl_con_ext_list[REPL_CON_EXT_MTNODE].object_name = SLAPI_EXT_MTNODE;
rc = slapi_register_object_extension(repl_plugin_name,
SLAPI_EXT_MTNODE,
multimaster_mtnode_extension_constructor,
multimaster_mtnode_extension_destructor,
&repl_con_ext_list[REPL_CON_EXT_MTNODE].object_type,
&repl_con_ext_list[REPL_CON_EXT_MTNODE].handle);
if(rc!=0)
{
PR_ASSERT(0); /* JCMREPL Argh */
}
}
void* repl_con_get_ext (ext_type type, void *object)
{
/* find the requested extension */
repl_ext ext = repl_con_ext_list [type];
void* data = slapi_get_object_extension(ext.object_type, object, ext.handle);
return data;
}
|