s4:pyrpc: add py_dcerpc_syntax_init_helper()
authorStefan Metzmacher <metze@samba.org>
Thu, 27 Mar 2014 13:54:29 +0000 (14:54 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 28 Mar 2014 07:34:25 +0000 (08:34 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/librpc/rpc/pyrpc_util.c
source4/librpc/rpc/pyrpc_util.h

index cec8574319e3771c0fd1a7de98a703556d411570..314ad2cc8d79d566e9d345693fdb122e253131b3 100644 (file)
@@ -304,6 +304,28 @@ bool PyInterface_AddNdrRpcMethods(PyTypeObject *ifacetype, const struct PyNdrRpc
        return true;
 }
 
+PyObject *py_dcerpc_syntax_init_helper(PyTypeObject *type, PyObject *args, PyObject *kwargs,
+                                      const struct ndr_syntax_id *syntax)
+{
+       PyObject *ret;
+       struct ndr_syntax_id *obj;
+       const char *kwnames[] = { NULL };
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":abstract_syntax", discard_const_p(char *, kwnames))) {
+               return NULL;
+       }
+
+       ret = pytalloc_new(struct ndr_syntax_id, type);
+       if (ret == NULL) {
+               return NULL;
+       }
+
+       obj = (struct ndr_syntax_id *)pytalloc_get_ptr(ret);
+       *obj = *syntax;
+
+       return ret;
+}
+
 void PyErr_SetDCERPCStatus(struct dcerpc_pipe *p, NTSTATUS status)
 {
        if (p && NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
index 837a33be16968d066e3cc6ec769da9486ea206bf..21454cae15be6d68bf3a040843a7267d32264ed4 100644 (file)
@@ -50,6 +50,10 @@ bool py_check_dcerpc_type(PyObject *obj, const char *module, const char *type_na
 bool PyInterface_AddNdrRpcMethods(PyTypeObject *object, const struct PyNdrRpcMethodDef *mds);
 PyObject *py_dcerpc_interface_init_helper(PyTypeObject *type, PyObject *args, PyObject *kwargs, const struct ndr_interface_table *table);
 
+struct ndr_syntax_id;
+PyObject *py_dcerpc_syntax_init_helper(PyTypeObject *type, PyObject *args, PyObject *kwargs,
+                                      const struct ndr_syntax_id *syntax);
+
 PyObject *py_return_ndr_struct(const char *module_name, const char *type_name,
                               TALLOC_CTX *r_ctx, void *r);