summaryrefslogtreecommitdiff
path: root/lib/ldb/pyldb.h
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-07-05 10:01:32 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-07-05 17:24:47 +1000
commit8420a36dc7fe72fb665e065b8673fa44ff1bbf21 (patch)
tree5350041c1de4cdc73a813949f7cd154c423b3ec5 /lib/ldb/pyldb.h
parentc9a6dd56e42beafd297f4aefeb4e00ef9a09073a (diff)
downloadsamba-8420a36dc7fe72fb665e065b8673fa44ff1bbf21.tar.gz
samba-8420a36dc7fe72fb665e065b8673fa44ff1bbf21.tar.bz2
samba-8420a36dc7fe72fb665e065b8673fa44ff1bbf21.zip
ldb: make ldb a top level library for Samba 4.0
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'lib/ldb/pyldb.h')
-rw-r--r--lib/ldb/pyldb.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/lib/ldb/pyldb.h b/lib/ldb/pyldb.h
new file mode 100644
index 0000000000..04d8ff856c
--- /dev/null
+++ b/lib/ldb/pyldb.h
@@ -0,0 +1,105 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Python 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 <talloc.h>
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *mem_ctx;
+ struct ldb_context *ldb_ctx;
+} PyLdbObject;
+
+#define PyLdb_AsLdbContext(pyobj) ((PyLdbObject *)pyobj)->ldb_ctx
+#define PyLdb_Check(ob) PyObject_TypeCheck(ob, &PyLdb)
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *mem_ctx;
+ struct ldb_dn *dn;
+} PyLdbDnObject;
+
+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) ((PyLdbDnObject *)pyobj)->dn
+#define PyLdbDn_Check(ob) PyObject_TypeCheck(ob, &PyLdbDn)
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *mem_ctx;
+ struct ldb_message *msg;
+} PyLdbMessageObject;
+#define PyLdbMessage_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessage)
+#define PyLdbMessage_AsMessage(pyobj) ((PyLdbMessageObject *)pyobj)->msg
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *mem_ctx;
+ struct ldb_module *mod;
+} PyLdbModuleObject;
+#define PyLdbModule_AsModule(pyobj) ((PyLdbModuleObject *)pyobj)->mod
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *mem_ctx;
+ struct ldb_message_element *el;
+} PyLdbMessageElementObject;
+#define PyLdbMessageElement_AsMessageElement(pyobj) ((PyLdbMessageElementObject *)pyobj)->el
+#define PyLdbMessageElement_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessageElement)
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *mem_ctx;
+ struct ldb_parse_tree *tree;
+} PyLdbTreeObject;
+#define PyLdbTree_AsTree(pyobj) ((PyLdbTreeObject *)pyobj)->tree
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *mem_ctx;
+ PyObject *msgs;
+ PyObject *referals;
+ PyObject *controls;
+} PyLdbResultObject;
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *mem_ctx;
+ struct ldb_control *data;
+} PyLdbControlObject;
+
+#define PyErr_LDB_ERROR_IS_ERR_RAISE(err,ret,ldb) \
+ if (ret != LDB_SUCCESS) { \
+ PyErr_SetLdbError(err, ret, ldb); \
+ return NULL; \
+ }
+
+/* Picked out of thin air. To do this properly, we should probably have some part of the
+ * errors in LDB be allocated to bindings ? */
+#define LDB_ERR_PYTHON_EXCEPTION 142
+
+#endif /* _PYLDB_H_ */