root/source4/lib/ldb/pyldb.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. PyAPI_DATA
  2. PyAPI_DATA
  3. PyAPI_DATA
  4. PyAPI_DATA
  5. PyAPI_DATA

   1 /*
   2    Unix SMB/CIFS implementation.
   3 
   4    Swig interface to ldb.
   5 
   6    Copyright (C) 2007-2008 Jelmer Vernooij <jelmer@samba.org>
   7 
   8      ** NOTE! The following LGPL license applies to the ldb
   9      ** library. This does NOT imply that all of Samba is released
  10      ** under the LGPL
  11    
  12    This library is free software; you can redistribute it and/or
  13    modify it under the terms of the GNU Lesser General Public
  14    License as published by the Free Software Foundation; either
  15    version 3 of the License, or (at your option) any later version.
  16 
  17    This library is distributed in the hope that it will be useful,
  18    but WITHOUT ANY WARRANTY; without even the implied warranty of
  19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20    Lesser General Public License for more details.
  21 
  22    You should have received a copy of the GNU Lesser General Public
  23    License along with this library; if not, see <http://www.gnu.org/licenses/>.
  24 */
  25 
  26 #ifndef _PYLDB_H_
  27 #define _PYLDB_H_
  28 
  29 #include <Python.h>
  30 
  31 typedef struct {
  32         PyObject_HEAD
  33         struct ldb_context *ldb_ctx;
  34         TALLOC_CTX *mem_ctx;
  35 } PyLdbObject;
  36 
  37 PyAPI_DATA(PyTypeObject) PyLdb;
     /* [<][>][^][v][top][bottom][index][help] */
  38 PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx);
  39 #define PyLdb_AsLdbContext(pyobj) ((PyLdbObject *)pyobj)->ldb_ctx
  40 #define PyLdb_Check(ob) PyObject_TypeCheck(ob, &PyLdb)
  41 
  42 typedef struct {
  43         PyObject_HEAD
  44         struct ldb_dn *dn;
  45         TALLOC_CTX *mem_ctx;
  46 } PyLdbDnObject;
  47 
  48 PyAPI_DATA(PyTypeObject) PyLdbDn;
     /* [<][>][^][v][top][bottom][index][help] */
  49 PyObject *PyLdbDn_FromDn(struct ldb_dn *);
  50 bool PyObject_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, struct ldb_dn **dn);
  51 #define PyLdbDn_AsDn(pyobj) ((PyLdbDnObject *)pyobj)->dn
  52 #define PyLdbDn_Check(ob) PyObject_TypeCheck(ob, &PyLdbDn)
  53 
  54 typedef struct {
  55         PyObject_HEAD
  56         struct ldb_message *msg;
  57         TALLOC_CTX *mem_ctx;
  58 } PyLdbMessageObject;
  59 PyAPI_DATA(PyTypeObject) PyLdbMessage;
     /* [<][>][^][v][top][bottom][index][help] */
  60 PyObject *PyLdbMessage_FromMessage(struct ldb_message *message);
  61 #define PyLdbMessage_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessage)
  62 #define PyLdbMessage_AsMessage(pyobj) ((PyLdbMessageObject *)pyobj)->msg
  63 
  64 typedef struct {
  65         PyObject_HEAD
  66         struct ldb_module *mod;
  67         TALLOC_CTX *mem_ctx;
  68 } PyLdbModuleObject;
  69 PyAPI_DATA(PyTypeObject) PyLdbModule;
     /* [<][>][^][v][top][bottom][index][help] */
  70 PyObject *PyLdbModule_FromModule(struct ldb_module *mod);
  71 #define PyLdbModule_AsModule(pyobj) ((PyLdbModuleObject *)pyobj)->mod
  72 
  73 typedef struct {
  74         PyObject_HEAD   
  75         struct ldb_message_element *el;
  76         TALLOC_CTX *mem_ctx;
  77 } PyLdbMessageElementObject;
  78 PyAPI_DATA(PyTypeObject) PyLdbMessageElement;
     /* [<][>][^][v][top][bottom][index][help] */
  79 struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx, PyObject *obj, int flags, const char *name);
  80 PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *, TALLOC_CTX *mem_ctx);
  81 #define PyLdbMessageElement_AsMessageElement(pyobj) ((PyLdbMessageElementObject *)pyobj)->el
  82 #define PyLdbMessageElement_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessageElement)
  83 
  84 typedef struct {
  85         PyObject_HEAD
  86         struct ldb_parse_tree *tree;
  87         TALLOC_CTX *mem_ctx;
  88 } PyLdbTreeObject;
  89 PyAPI_DATA(PyTypeObject) PyLdbTree;
  90 PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *);
  91 #define PyLdbTree_AsTree(pyobj) ((PyLdbTreeObject *)pyobj)->tree
  92 
  93 void PyErr_SetLdbError(int ret, struct ldb_context *ldb_ctx);
  94 #define PyErr_LDB_ERROR_IS_ERR_RAISE(ret,ldb) \
  95         if (ret != LDB_SUCCESS) { \
  96                 PyErr_SetLdbError(ret, ldb); \
  97                 return NULL; \
  98         }
  99 
 100 
 101 #endif /* _PYLDB_H_ */

/* [<][>][^][v][top][bottom][index][help] */