summaryrefslogtreecommitdiffstats
path: root/ldb/pyldb.h
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-12-22 15:54:56 -0500
committerSimo Sorce <idra@samba.org>2008-12-22 18:52:48 -0500
commit41718e315ea78998fab0893fd5f148a49d8faab8 (patch)
treeecbc13fb3abce56481ba04e13d9aa1b69b19783b /ldb/pyldb.h
parenta93a69380dc6718c49879af628ed69f8e2b70797 (diff)
downloadsssd-41718e315ea78998fab0893fd5f148a49d8faab8.tar.gz
sssd-41718e315ea78998fab0893fd5f148a49d8faab8.tar.xz
sssd-41718e315ea78998fab0893fd5f148a49d8faab8.zip
Rebase ldb code with all changes in samba master
Diffstat (limited to 'ldb/pyldb.h')
-rw-r--r--ldb/pyldb.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/ldb/pyldb.h b/ldb/pyldb.h
new file mode 100644
index 000000000..b55bb6840
--- /dev/null
+++ b/ldb/pyldb.h
@@ -0,0 +1,81 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Swig interface to ldb.
+
+ Copyright (C) 2007-2008 Jelmer Vernooij <jelmer@samba.org>
+
+ ** NOTE! The following LGPL license applies to the ldb
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _PYLDB_H_
+#define _PYLDB_H_
+
+#include <Python.h>
+#include <pytalloc.h>
+#include <ldb.h>
+#include <ldb_private.h>
+#include <ldb_errors.h>
+
+typedef py_talloc_Object PyLdbObject;
+PyAPI_DATA(PyTypeObject) PyLdb;
+PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx);
+#define PyLdb_AsLdbContext(pyobj) py_talloc_get_type(pyobj, struct ldb_context)
+#define PyLdb_Check(ob) PyObject_TypeCheck(ob, &PyLdb)
+
+typedef py_talloc_Object PyLdbDnObject;
+PyAPI_DATA(PyTypeObject) PyLdbDn;
+struct ldb_dn *PyLdbDn_AsDn(PyObject *);
+PyObject *PyLdbDn_FromDn(struct ldb_dn *);
+bool PyObject_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, struct ldb_dn **dn);
+#define PyLdbDn_AsDn(pyobj) py_talloc_get_type(pyobj, struct ldb_dn)
+#define PyLdbDn_Check(ob) PyObject_TypeCheck(ob, &PyLdbDn)
+
+typedef py_talloc_Object PyLdbMessageObject;
+PyAPI_DATA(PyTypeObject) PyLdbMessage;
+PyObject *PyLdbMessage_FromMessage(struct ldb_message *message);
+struct ldb_message *PyLdbMessage_AsMessage(PyObject *obj);
+#define PyLdbMessage_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessage)
+#define PyLdbMessage_AsMessage(pyobj) py_talloc_get_type(pyobj, struct ldb_message)
+
+typedef py_talloc_Object PyLdbModuleObject;
+PyAPI_DATA(PyTypeObject) PyLdbModule;
+PyObject *PyLdbModule_FromModule(struct ldb_module *mod);
+#define PyLdbModule_AsModule(pyobj) ((struct ldb_module *)py_talloc_get_ptr(pyobj))
+
+typedef py_talloc_Object PyLdbMessageElementObject;
+PyAPI_DATA(PyTypeObject) PyLdbMessageElement;
+struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx, PyObject *obj, int flags, const char *name);
+PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *, TALLOC_CTX *mem_ctx);
+#define PyLdbMessageElement_AsMessageElement(pyobj) ((struct ldb_message_element *)py_talloc_get_ptr(pyobj))
+#define PyLdbMessageElement_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessageElement)
+
+typedef py_talloc_Object PyLdbTreeObject;
+PyAPI_DATA(PyTypeObject) PyLdbTree;
+PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *);
+#define PyLdbTree_AsTree(pyobj) py_talloc_get_type(pyobj, struct ldb_parse_tree)
+
+void PyErr_SetLdbError(int ret, struct ldb_context *ldb_ctx);
+#define PyErr_LDB_ERROR_IS_ERR_RAISE(ret,ldb) \
+ if (ret != LDB_SUCCESS) { \
+ PyErr_SetLdbError(ret, ldb); \
+ return NULL; \
+ }
+
+
+#endif /* _PYLDB_H_ */