source: vendor/3.6.0/source4/lib/ldb/pyldb.h

Last change on this file was 740, checked in by Silvan Scherrer, 13 years ago

Samba Server: update vendor to 3.6.0

File size: 3.1 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_AsLdbContext(pyobj) ((PyLdbObject *)pyobj)->ldb_ctx
38#define PyLdb_Check(ob) PyObject_TypeCheck(ob, &PyLdb)
39
40typedef struct {
41 PyObject_HEAD
42 TALLOC_CTX *mem_ctx;
43 struct ldb_dn *dn;
44} PyLdbDnObject;
45
46PyObject *PyLdbDn_FromDn(struct ldb_dn *);
47bool PyObject_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, struct ldb_dn **dn);
48#define PyLdbDn_AsDn(pyobj) ((PyLdbDnObject *)pyobj)->dn
49#define PyLdbDn_Check(ob) PyObject_TypeCheck(ob, &PyLdbDn)
50
51typedef struct {
52 PyObject_HEAD
53 TALLOC_CTX *mem_ctx;
54 struct ldb_message *msg;
55} PyLdbMessageObject;
56#define PyLdbMessage_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessage)
57#define PyLdbMessage_AsMessage(pyobj) ((PyLdbMessageObject *)pyobj)->msg
58
59typedef struct {
60 PyObject_HEAD
61 TALLOC_CTX *mem_ctx;
62 struct ldb_module *mod;
63} PyLdbModuleObject;
64#define PyLdbModule_AsModule(pyobj) ((PyLdbModuleObject *)pyobj)->mod
65
66typedef struct {
67 PyObject_HEAD
68 TALLOC_CTX *mem_ctx;
69 struct ldb_message_element *el;
70} PyLdbMessageElementObject;
71#define PyLdbMessageElement_AsMessageElement(pyobj) ((PyLdbMessageElementObject *)pyobj)->el
72#define PyLdbMessageElement_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessageElement)
73
74typedef struct {
75 PyObject_HEAD
76 TALLOC_CTX *mem_ctx;
77 struct ldb_parse_tree *tree;
78} PyLdbTreeObject;
79#define PyLdbTree_AsTree(pyobj) ((PyLdbTreeObject *)pyobj)->tree
80
81typedef struct {
82 PyObject_HEAD
83 TALLOC_CTX *mem_ctx;
84 PyObject *msgs;
85 PyObject *referals;
86 PyObject *controls;
87} PyLdbResultObject;
88
89typedef struct {
90 PyObject_HEAD
91 TALLOC_CTX *mem_ctx;
92 struct ldb_control *data;
93} PyLdbControlObject;
94
95#define PyErr_LDB_ERROR_IS_ERR_RAISE(err,ret,ldb) \
96 if (ret != LDB_SUCCESS) { \
97 PyErr_SetLdbError(err, ret, ldb); \
98 return NULL; \
99 }
100
101/* Picked out of thin air. To do this properly, we should probably have some part of the
102 * errors in LDB be allocated to bindings ? */
103#define LDB_ERR_PYTHON_EXCEPTION 142
104
105#endif /* _PYLDB_H_ */
Note: See TracBrowser for help on using the repository browser.