Implement some of the stubs in misc python module.
[Samba/ekacnet.git] / source4 / lib / ldb / pyldb.h
blobc71f1afc7281f278db02e2b45221c8ce04381d9d
1 /*
2 Unix SMB/CIFS implementation.
4 Swig interface to ldb.
6 Copyright (C) 2007-2008 Jelmer Vernooij <jelmer@samba.org>
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
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.
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.
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/>.
26 #ifndef _PYLDB_H_
27 #define _PYLDB_H_
29 #include <Python.h>
30 #include <pytalloc.h>
31 #include <ldb.h>
32 #include <ldb_private.h>
33 #include <ldb_errors.h>
35 typedef py_talloc_Object PyLdbObject;
36 PyAPI_DATA(PyTypeObject) PyLdb;
37 PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx);
38 #define PyLdb_AsLdbContext(pyobj) py_talloc_get_type(pyobj, struct ldb_context)
39 #define PyLdb_Check(ob) PyObject_TypeCheck(ob, &PyLdb)
41 typedef py_talloc_Object PyLdbDnObject;
42 PyAPI_DATA(PyTypeObject) PyLdbDn;
43 struct ldb_dn *PyLdbDn_AsDn(PyObject *);
44 PyObject *PyLdbDn_FromDn(struct ldb_dn *);
45 bool PyObject_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, struct ldb_dn **dn);
46 #define PyLdbDn_AsDn(pyobj) py_talloc_get_type(pyobj, struct ldb_dn)
47 #define PyLdbDn_Check(ob) PyObject_TypeCheck(ob, &PyLdbDn)
49 typedef py_talloc_Object PyLdbMessageObject;
50 PyAPI_DATA(PyTypeObject) PyLdbMessage;
51 PyObject *PyLdbMessage_FromMessage(struct ldb_message *message);
52 struct ldb_message *PyLdbMessage_AsMessage(PyObject *obj);
53 #define PyLdbMessage_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessage)
54 #define PyLdbMessage_AsMessage(pyobj) py_talloc_get_type(pyobj, struct ldb_message)
56 typedef py_talloc_Object PyLdbModuleObject;
57 PyAPI_DATA(PyTypeObject) PyLdbModule;
58 PyObject *PyLdbModule_FromModule(struct ldb_module *mod);
59 #define PyLdbModule_AsModule(pyobj) py_talloc_get_type(pyobj, struct ldb_module)
61 typedef py_talloc_Object PyLdbMessageElementObject;
62 PyAPI_DATA(PyTypeObject) PyLdbMessageElement;
63 struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx, PyObject *obj, int flags, const char *name);
64 PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *);
65 #define PyLdbMessageElement_AsMessageElement(pyobj) py_talloc_get_type(pyobj, struct ldb_message_element)
66 #define PyLdbMessageElement_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessageElement)
68 typedef py_talloc_Object PyLdbTreeObject;
69 PyAPI_DATA(PyTypeObject) PyLdbTree;
70 PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *);
71 #define PyLdbTree_AsTree(pyobj) py_talloc_get_type(pyobj, struct ldb_parse_tree)
73 void PyErr_SetLdbError(int ret, struct ldb_context *ldb_ctx);
74 #define PyErr_LDB_ERROR_IS_ERR_RAISE(ret,ldb) \
75 if (ret != LDB_SUCCESS) { \
76 PyErr_SetLdbError(ret, ldb); \
77 return NULL; \
81 #endif /* _PYLDB_H_ */