source: vendor/current/lib/ldb/pyldb.h

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 2.9 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3
4 Python 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 <talloc.h>
30
31typedef struct {
32 PyObject_HEAD
33 TALLOC_CTX *mem_ctx;
34 struct ldb_context *ldb_ctx;
35} PyLdbObject;
36
37#define pyldb_Ldb_AsLdbContext(pyobj) ((PyLdbObject *)pyobj)->ldb_ctx
38
39typedef struct {
40 PyObject_HEAD
41 TALLOC_CTX *mem_ctx;
42 struct ldb_dn *dn;
43} PyLdbDnObject;
44
45PyObject *pyldb_Dn_FromDn(struct ldb_dn *);
46bool pyldb_Object_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, struct ldb_dn **dn);
47#define pyldb_Dn_AsDn(pyobj) ((PyLdbDnObject *)pyobj)->dn
48
49typedef struct {
50 PyObject_HEAD
51 TALLOC_CTX *mem_ctx;
52 struct ldb_message *msg;
53} PyLdbMessageObject;
54#define pyldb_Message_AsMessage(pyobj) ((PyLdbMessageObject *)pyobj)->msg
55
56typedef struct {
57 PyObject_HEAD
58 TALLOC_CTX *mem_ctx;
59 struct ldb_module *mod;
60} PyLdbModuleObject;
61#define pyldb_Module_AsModule(pyobj) ((PyLdbModuleObject *)pyobj)->mod
62
63/*
64 * NOTE: el (and so the return value of
65 * pyldb_MessageElement_AsMessageElement()) may not be a valid talloc
66 * context, it could be part of an array
67 */
68
69typedef struct {
70 PyObject_HEAD
71 TALLOC_CTX *mem_ctx;
72 struct ldb_message_element *el;
73} PyLdbMessageElementObject;
74
75#define pyldb_MessageElement_AsMessageElement(pyobj) ((PyLdbMessageElementObject *)pyobj)->el
76
77typedef struct {
78 PyObject_HEAD
79 TALLOC_CTX *mem_ctx;
80 struct ldb_parse_tree *tree;
81} PyLdbTreeObject;
82#define pyldb_Tree_AsTree(pyobj) ((PyLdbTreeObject *)pyobj)->tree
83
84typedef struct {
85 PyObject_HEAD
86 TALLOC_CTX *mem_ctx;
87 PyObject *msgs;
88 PyObject *referals;
89 PyObject *controls;
90} PyLdbResultObject;
91
92typedef struct {
93 PyObject_HEAD
94 TALLOC_CTX *mem_ctx;
95 struct ldb_control *data;
96} PyLdbControlObject;
97
98#define PyErr_LDB_ERROR_IS_ERR_RAISE(err,ret,ldb) \
99 if (ret != LDB_SUCCESS) { \
100 PyErr_SetLdbError(err, ret, ldb); \
101 return NULL; \
102 }
103
104/* Picked out of thin air. To do this properly, we should probably have some part of the
105 * errors in LDB be allocated to bindings ? */
106#define LDB_ERR_PYTHON_EXCEPTION 142
107
108#endif /* _PYLDB_H_ */
Note: See TracBrowser for help on using the repository browser.