2 Unix SMB/CIFS implementation.
3 Samba utility functions
4 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
6 ** NOTE! The following LGPL license applies to the talloc
7 ** library. This does NOT imply that all of Samba is released
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 3 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, see <http://www.gnu.org/licenses/>.
32 TALLOC_CTX
*talloc_ctx
;
33 void *ptr
; /* eg the array element */
36 /* Return the PyTypeObject for pytalloc_Object. Returns a borrowed reference. */
37 _PUBLIC_ PyTypeObject
*pytalloc_GetObjectType(void);
39 /* Return the PyTypeObject for pytalloc_BaseObject. Returns a borrowed reference. */
40 _PUBLIC_ PyTypeObject
*pytalloc_GetBaseObjectType(void);
42 /* Check whether a specific object is a talloc Object. */
43 _PUBLIC_
int pytalloc_Check(PyObject
*);
45 _PUBLIC_
int pytalloc_BaseObject_check(PyObject
*);
47 _PUBLIC_
int _pytalloc_check_type(PyObject
*py_obj
, const char *type_name
);
48 #define pytalloc_check_type(py_obj, type) \
49 _pytalloc_check_type((PyObject *)(py_obj), #type)
51 /* Retrieve the pointer for a pytalloc_object. Like talloc_get_type()
52 * but for pytalloc_Objects. */
53 _PUBLIC_
void *_pytalloc_get_type(PyObject
*py_obj
, const char *type_name
);
54 #define pytalloc_get_type(py_obj, type) ((type *)_pytalloc_get_type((PyObject *)(py_obj), #type))
56 _PUBLIC_
void *_pytalloc_get_ptr(PyObject
*py_obj
);
57 #define pytalloc_get_ptr(py_obj) _pytalloc_get_ptr((PyObject *)(py_obj))
58 _PUBLIC_ TALLOC_CTX
*_pytalloc_get_mem_ctx(PyObject
*py_obj
);
59 #define pytalloc_get_mem_ctx(py_obj) _pytalloc_get_mem_ctx((PyObject *)(py_obj))
61 _PUBLIC_
const char *_pytalloc_get_name(PyObject
*py_obj
);
62 #define pytalloc_get_name(py_obj) _pytalloc_get_name((PyObject *)(py_obj))
65 _PUBLIC_ PyObject
*pytalloc_steal_ex(PyTypeObject
*py_type
, TALLOC_CTX
*mem_ctx
, void *ptr
);
66 _PUBLIC_ PyObject
*pytalloc_steal(PyTypeObject
*py_type
, void *ptr
);
67 _PUBLIC_ PyObject
*pytalloc_reference_ex(PyTypeObject
*py_type
, TALLOC_CTX
*mem_ctx
, void *ptr
);
68 #define pytalloc_reference(py_type, talloc_ptr) pytalloc_reference_ex(py_type, talloc_ptr, talloc_ptr)
70 #define pytalloc_new(type, typeobj) pytalloc_steal(typeobj, talloc_zero(NULL, type))
73 * Wrap a generic talloc pointer into a talloc.GenericObject,
74 * this is a subclass of talloc.BaseObject.
76 _PUBLIC_ PyObject
*pytalloc_GenericObject_steal_ex(TALLOC_CTX
*mem_ctx
, void *ptr
);
77 #define pytalloc_GenericObject_steal(talloc_ptr) \
78 pytalloc_GenericObject_steal_ex(talloc_ptr, talloc_ptr)
79 _PUBLIC_ PyObject
*pytalloc_GenericObject_reference_ex(TALLOC_CTX
*mem_ctx
, void *ptr
);
80 #define pytalloc_GenericObject_reference(talloc_ptr) \
81 pytalloc_GenericObject_reference_ex(talloc_ptr, talloc_ptr)
83 _PUBLIC_
size_t pytalloc_BaseObject_size(void);
85 _PUBLIC_
int pytalloc_BaseObject_PyType_Ready(PyTypeObject
*type
);
87 #endif /* _PYTALLOC_H_ */