r23790: LGPLv3+ conversion for our LGPLv2+ library code
[Samba.git] / source / lib / ldb / modules / skel.c
blobfbf17e091c588a08209ea190607b47dbbe2c4b22
1 /*
2 ldb database library
4 Copyright (C) Simo Sorce 2004
6 ** NOTE! The following LGPL license applies to the ldb
7 ** library. This does NOT imply that all of Samba is released
8 ** under the LGPL
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 3 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * Name: ldb
28 * Component: ldb skel module
30 * Description: example module
32 * Author: Simo Sorce
35 #include "includes.h"
36 #include "ldb/include/includes.h"
38 struct private_data {
40 char *some_private_data;
43 /* search */
44 static int skel_search(struct ldb_module *module, struct ldb_request *req)
46 return ldb_next_request(module, req);
49 /* add */
50 static int skel_add(struct ldb_module *module, struct ldb_request *req){
51 return ldb_next_request(module, req);
54 /* modify */
55 static int skel_modify(struct ldb_module *module, struct ldb_request *req)
57 return ldb_next_request(module, req);
60 /* delete */
61 static int skel_delete(struct ldb_module *module, struct ldb_request *req)
63 return ldb_next_request(module, req);
66 /* rename */
67 static int skel_rename(struct ldb_module *module, struct ldb_request *req)
69 return ldb_next_request(module, req);
72 /* start a transaction */
73 static int skel_start_trans(struct ldb_module *module)
75 return ldb_next_start_trans(module);
78 /* end a transaction */
79 static int skel_end_trans(struct ldb_module *module)
81 return ldb_next_end_trans(module);
84 /* delete a transaction */
85 static int skel_del_trans(struct ldb_module *module)
87 return ldb_next_del_trans(module);
90 static int skel_destructor(struct ldb_module *ctx)
92 struct private_data *data = talloc_get_type(ctx->private_data, struct private_data);
93 /* put your clean-up functions here */
94 if (data->some_private_data) talloc_free(data->some_private_data);
95 return 0;
98 static int skel_request(struct ldb_module *module, struct ldb_request *req)
100 return ldb_next_request(module, req);
103 static int skel_init(struct ldb_module *ctx)
105 struct private_data *data;
107 data = talloc(ctx, struct private_data);
108 if (data == NULL) {
109 return 1;
112 data->some_private_data = NULL;
113 ctx->private_data = data;
115 talloc_set_destructor (ctx, skel_destructor);
117 return ldb_next_init(ctx);
120 static const struct ldb_module_ops skel_ops = {
121 .name = "skel",
122 .init_context = skel_init,
123 .search = skel_search,
124 .add = skel_add,
125 .modify = skel_modify,
126 .del = skel_delete,
127 .rename = skel_rename,
128 .request = skel_request,
129 .start_transaction = skel_start_trans,
130 .end_transaction = skel_end_trans,
131 .del_transaction = skel_del_trans,
134 int ldb_skel_init(void)
136 return ldb_register_module(&skel_ops);