diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-05-26 00:50:07 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-05-26 00:50:07 +0200 |
commit | 68cec4923a28946ab7ddd5a16a2f9442dc362fc6 (patch) | |
tree | 064a452b93784a57ccbede46457c706c91485990 /source4 | |
parent | 22778de5823ce979a2e8d389e2029a78da543490 (diff) | |
download | samba-68cec4923a28946ab7ddd5a16a2f9442dc362fc6.tar.gz samba-68cec4923a28946ab7ddd5a16a2f9442dc362fc6.tar.bz2 samba-68cec4923a28946ab7ddd5a16a2f9442dc362fc6.zip |
Add bindings for irpc_{add,remove}_name.
(This used to be commit a75dbdec15ead785e0105dd61f980627e487fcb0)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/messaging/pyirpc.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source4/lib/messaging/pyirpc.c b/source4/lib/messaging/pyirpc.c index ba3f830531..b43521e990 100644 --- a/source4/lib/messaging/pyirpc.c +++ b/source4/lib/messaging/pyirpc.c @@ -167,12 +167,51 @@ static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject return Py_None; } +static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject *kwargs) +{ + messaging_Object *iface = (messaging_Object *)self; + NTSTATUS status; + char *name; + const char *kwnames[] = { "name", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:send", + discard_const_p(char *, kwnames), &name)) { + return NULL; + } + + status = irpc_add_name(iface->msg_ctx, name); + if (NT_STATUS_IS_ERR(status)) { + PyErr_SetNTSTATUS(status); + return NULL; + } + + return Py_None; +} + + +static PyObject *py_messaging_remove_name(PyObject *self, PyObject *args, PyObject *kwargs) +{ + messaging_Object *iface = (messaging_Object *)self; + char *name; + const char *kwnames[] = { "name", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:send", + discard_const_p(char *, kwnames), &name)) { + return NULL; + } + + irpc_remove_name(iface->msg_ctx, name); + + return Py_None; +} static PyMethodDef py_messaging_methods[] = { { "send", (PyCFunction)py_messaging_send, METH_VARARGS|METH_KEYWORDS, "S.send(target, msg_type, data) -> None\nSend a message" }, { "register", (PyCFunction)py_messaging_register, METH_VARARGS|METH_KEYWORDS, "S.register(msg_type, callback) -> None\nRegister a message handler" }, + { "add_name", (PyCFunction)py_messaging_add_name, METH_VARARGS|METH_KEYWORDS, "S.add_name(name) -> None\nListen on another name" }, + { "remove_name", (PyCFunction)py_messaging_remove_name, METH_VARARGS|METH_KEYWORDS, "S.remove_name(name) -> None\nStop listening on a name" }, { NULL, NULL, 0, NULL } }; |