summaryrefslogtreecommitdiffstats
path: root/src/map.h
blob: f5b0405610b8b5b246cea24c1893e8c165d60a59 (plain)
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
114
115
116
117
118
119
120
121
/*
 * Copyright 2008 Red Hat, Inc.
 *
 * This Program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This Program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this Program; if not, write to the
 *
 *   Free Software Foundation, Inc.
 *   59 Temple Place, Suite 330
 *   Boston, MA 02111-1307 USA
 *
 */

#ifndef map_h
#define map_h
struct plugin_state;
struct slapi_pblock;
/* Functions to pull data out of maps. */
int map_startup(struct plugin_state *state);
int map_init(struct slapi_pblock *pb, struct plugin_state *state);
void map_done(struct plugin_state *state);
int map_master_name(struct plugin_state *state, const char **master);
bool_t map_supports_domain(struct plugin_state *state,
			   const char *domain,
			   bool_t *supported);
bool_t map_supports_map(struct plugin_state *state,
			const char *domain,
			const char *map,
			bool_t *supported,
			bool_t *secure);
bool_t map_match(struct plugin_state *state,
		 const char *domain, const char *map, bool_t *secure,
		 unsigned int key_len, const char *key,
		 unsigned int *value_len, const char **value,
		 const char **id, void **backend_data);
bool_t map_match_id(struct plugin_state *state,
		    const char *domain, const char *map, bool_t *secure,
		    const char *id_in, unsigned int id_index,
		    unsigned int *key_len, const char **key,
		    unsigned int *value_len, const char **value,
		    const char **id, void **backend_data);
bool_t map_first(struct plugin_state *state,
		 const char *domain, const char *map, bool_t *secure,
		 unsigned int *first_key_len, char **first_key,
		 unsigned int *first_value_len, char **first_value,
		 const char **first_id, int *first_key_index);
bool_t map_next(struct plugin_state *state,
		const char *domain, const char *map, bool_t *secure,
		unsigned int prev_len, const char *prev,
		unsigned int *next_key_len, char **next_key,
		unsigned int *next_value_len, char **next_value);
bool_t map_next_id(struct plugin_state *state,
		   const char *domain, const char *map, bool_t *secure,
		   const char *prev_id, int prev_index,
		   unsigned int *next_key_len, char **next_key,
		   unsigned int *next_value_len, char **next_value,
		   const char **next_id, int *next_key_index);
bool_t map_order(struct plugin_state *state,
		 const char *domain, const char *map, bool_t *map_secure,
		 unsigned int *order);
/* Functions to push data into maps. */
void map_data_clear_map(struct plugin_state *state,
			const char *domain_name, const char *map_name);
void map_data_unset_map(struct plugin_state *state,
			const char *domain_name, const char *map_name);
void map_data_set_map(struct plugin_state *state,
		      const char *domain_name, const char *map_name,
		      bool_t secure,
		      void *backend_data, void (*free_backend_data)(void *p));
void map_data_unset_entry(struct plugin_state *state,
			  const char *domain_name, const char *map_name,
			  const char *id);
void map_data_set_entry(struct plugin_state *state,
			const char *domain_name, const char *map_name,
			const char *id,
			unsigned int *key_lengths, char **keys,
			unsigned int *value_lengths, char **values,
			void *backend_data, void (*free_backend_data)(void *p));
bool_t map_data_check_entry(struct plugin_state *state,
			    const char *domain_name, const char *map_name,
			    const char *id);
bool_t map_data_foreach_entry_id(struct plugin_state *state,
				 const char *domain, const char *map,
				 const char *id,
				 bool_t (*fn)(const char *domain,
					      const char *map,
					      bool_t secure,
					      const char *key,
					      unsigned int key_len,
					      const char *value,
					      unsigned int value_len,
					      const char *id, int key_index,
					      void *backend_data,
					      void *cbdata),
				 void *cbdata);
bool_t map_data_foreach_domain(struct plugin_state *state,
			       bool_t (*fn)(const char *domain, void *cbdata),
			       void *cbdata);
bool_t map_data_foreach_map(struct plugin_state *state, const char *domain_name,
			    bool_t (*fn)(const char *domain,
			   		 const char *map,
					 bool_t secure,
					 void *backend_data,
					 void *cbdata),
			    void *cbdata);
int map_data_get_domain_size(struct plugin_state *state,
			     const char *domain_name);
int map_data_get_map_size(struct plugin_state *state,
			  const char *domain_name, const char *map_name);
int map_rdlock(void);
int map_wrlock(void);
int map_unlock(void);
#endif