~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to source4/lib/ldb/modules/skel.c

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
   ldb database library
 
3
 
 
4
   Copyright (C) Simo Sorce  2004
 
5
 
 
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
 
9
   
 
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.
 
14
 
 
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.
 
19
 
 
20
   You should have received a copy of the GNU Lesser General Public
 
21
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 
22
*/
 
23
 
 
24
/*
 
25
 *  Name: ldb
 
26
 *
 
27
 *  Component: ldb skel module
 
28
 *
 
29
 *  Description: example module
 
30
 *
 
31
 *  Author: Simo Sorce
 
32
 */
 
33
 
 
34
#include "ldb_module.h"
 
35
 
 
36
struct private_data {
 
37
 
 
38
        char *some_private_data;
 
39
};
 
40
 
 
41
/* search */
 
42
static int skel_search(struct ldb_module *module, struct ldb_request *req)
 
43
{
 
44
        return ldb_next_request(module, req);
 
45
}
 
46
 
 
47
/* add */
 
48
static int skel_add(struct ldb_module *module, struct ldb_request *req){
 
49
        return ldb_next_request(module, req);
 
50
}
 
51
 
 
52
/* modify */
 
53
static int skel_modify(struct ldb_module *module, struct ldb_request *req)
 
54
{
 
55
        return ldb_next_request(module, req);
 
56
}
 
57
 
 
58
/* delete */
 
59
static int skel_delete(struct ldb_module *module, struct ldb_request *req)
 
60
{
 
61
        return ldb_next_request(module, req);
 
62
}
 
63
 
 
64
/* rename */
 
65
static int skel_rename(struct ldb_module *module, struct ldb_request *req)
 
66
{
 
67
        return ldb_next_request(module, req);
 
68
}
 
69
 
 
70
/* start a transaction */
 
71
static int skel_start_trans(struct ldb_module *module)
 
72
{
 
73
        return ldb_next_start_trans(module);
 
74
}
 
75
 
 
76
/* end a transaction */
 
77
static int skel_end_trans(struct ldb_module *module)
 
78
{
 
79
        return ldb_next_end_trans(module);
 
80
}
 
81
 
 
82
/* delete a transaction */
 
83
static int skel_del_trans(struct ldb_module *module)
 
84
{
 
85
        return ldb_next_del_trans(module);
 
86
}
 
87
 
 
88
static int skel_destructor(struct ldb_module *ctx)
 
89
{
 
90
        struct private_data *data;
 
91
 
 
92
        data = talloc_get_type(ldb_module_get_private(ctx), struct private_data);
 
93
 
 
94
        /* put your clean-up functions here */
 
95
        if (data->some_private_data) talloc_free(data->some_private_data);
 
96
 
 
97
        return 0;
 
98
}
 
99
 
 
100
static int skel_request(struct ldb_module *module, struct ldb_request *req)
 
101
{
 
102
        return ldb_next_request(module, req);
 
103
}
 
104
 
 
105
static int skel_init(struct ldb_module *module)
 
106
{
 
107
        struct ldb_context *ldb;
 
108
        struct private_data *data;
 
109
 
 
110
        ldb = ldb_module_get_ctx(module);
 
111
 
 
112
        data = talloc(module, struct private_data);
 
113
        if (data == NULL) {
 
114
                ldb_oom(ldb);
 
115
                return LDB_ERR_OPERATIONS_ERROR;
 
116
        }
 
117
 
 
118
        data->some_private_data = NULL;
 
119
        ldb_module_set_private(module, data);
 
120
 
 
121
        talloc_set_destructor (module, skel_destructor);
 
122
 
 
123
        return ldb_next_init(module);
 
124
}
 
125
 
 
126
const struct ldb_module_ops ldb_skel_module_ops = {
 
127
        .name              = "skel",
 
128
        .init_context      = skel_init,
 
129
        .search            = skel_search,
 
130
        .add               = skel_add,
 
131
        .modify            = skel_modify,
 
132
        .del               = skel_delete,
 
133
        .rename            = skel_rename,
 
134
        .request           = skel_request,
 
135
        .start_transaction = skel_start_trans,
 
136
        .end_transaction   = skel_end_trans,
 
137
        .del_transaction   = skel_del_trans,
 
138
};