LCOV - code coverage report
Current view: top level - lib/ldb/modules - skel.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 3 38 7.9 %
Date: 2024-04-21 15:09:00 Functions: 1 12 8.3 %

          Line data    Source code
       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 "replace.h"
      35             : #include "system/filesys.h"
      36             : #include "system/time.h"
      37             : #include "ldb_module.h"
      38             : 
      39             : struct private_data {
      40             : 
      41             :         char *some_private_data;
      42             : };
      43             : 
      44             : /* search */
      45           0 : static int skel_search(struct ldb_module *module, struct ldb_request *req)
      46             : {
      47           0 :         return ldb_next_request(module, req);
      48             : }
      49             : 
      50             : /* add */
      51           0 : static int skel_add(struct ldb_module *module, struct ldb_request *req){
      52           0 :         return ldb_next_request(module, req);
      53             : }
      54             : 
      55             : /* modify */
      56           0 : static int skel_modify(struct ldb_module *module, struct ldb_request *req)
      57             : {
      58           0 :         return ldb_next_request(module, req);
      59             : }
      60             : 
      61             : /* delete */
      62           0 : static int skel_delete(struct ldb_module *module, struct ldb_request *req)
      63             : {
      64           0 :         return ldb_next_request(module, req);
      65             : }
      66             : 
      67             : /* rename */
      68           0 : static int skel_rename(struct ldb_module *module, struct ldb_request *req)
      69             : {
      70           0 :         return ldb_next_request(module, req);
      71             : }
      72             : 
      73             : /* start a transaction */
      74           0 : static int skel_start_trans(struct ldb_module *module)
      75             : {
      76           0 :         return ldb_next_start_trans(module);
      77             : }
      78             : 
      79             : /* end a transaction */
      80           0 : static int skel_end_trans(struct ldb_module *module)
      81             : {
      82           0 :         return ldb_next_end_trans(module);
      83             : }
      84             : 
      85             : /* delete a transaction */
      86           0 : static int skel_del_trans(struct ldb_module *module)
      87             : {
      88           0 :         return ldb_next_del_trans(module);
      89             : }
      90             : 
      91           0 : static int skel_destructor(struct ldb_module *ctx)
      92             : {
      93           0 :         struct private_data *data;
      94             : 
      95           0 :         data = talloc_get_type(ldb_module_get_private(ctx), struct private_data);
      96             : 
      97             :         /* put your clean-up functions here */
      98           0 :         if (data->some_private_data) talloc_free(data->some_private_data);
      99             : 
     100           0 :         return 0;
     101             : }
     102             : 
     103           0 : static int skel_request(struct ldb_module *module, struct ldb_request *req)
     104             : {
     105           0 :         return ldb_next_request(module, req);
     106             : }
     107             : 
     108           0 : static int skel_init(struct ldb_module *module)
     109             : {
     110           0 :         struct ldb_context *ldb;
     111           0 :         struct private_data *data;
     112             : 
     113           0 :         ldb = ldb_module_get_ctx(module);
     114             : 
     115           0 :         data = talloc(module, struct private_data);
     116           0 :         if (data == NULL) {
     117           0 :                 ldb_oom(ldb);
     118           0 :                 return LDB_ERR_OPERATIONS_ERROR;
     119             :         }
     120             : 
     121           0 :         data->some_private_data = NULL;
     122           0 :         ldb_module_set_private(module, data);
     123             : 
     124           0 :         talloc_set_destructor (module, skel_destructor);
     125             : 
     126           0 :         return ldb_next_init(module);
     127             : }
     128             : 
     129             : static const struct ldb_module_ops ldb_skel_module_ops = {
     130             :         .name              = "skel",
     131             :         .init_context      = skel_init,
     132             :         .search            = skel_search,
     133             :         .add               = skel_add,
     134             :         .modify            = skel_modify,
     135             :         .del               = skel_delete,
     136             :         .rename            = skel_rename,
     137             :         .request           = skel_request,
     138             :         .start_transaction = skel_start_trans,
     139             :         .end_transaction   = skel_end_trans,
     140             :         .del_transaction   = skel_del_trans,
     141             : };
     142             : 
     143        6091 : int ldb_skel_init(const char *version)
     144             : {
     145        6091 :         LDB_MODULE_CHECK_VERSION(version);
     146        6091 :         return ldb_register_module(&ldb_skel_module_ops);
     147             : }

Generated by: LCOV version 1.14