*/
#include "includes.h"
-#include <Python.h>
+#include "../lib/util/python_util.h"
#include "scripting/python/modules.h"
#include "libcli/util/pyerrors.h"
#include "librpc/rpc/pyrpc.h"
#include "lib/events/events.h"
#include "cluster/cluster.h"
#include "param/param.h"
-#include "librpc/gen_ndr/py_irpc.h"
PyAPI_DATA(PyTypeObject) messaging_Type;
PyAPI_DATA(PyTypeObject) irpc_ClientConnectionType;
/* FIXME: This prototype should be in param/pyparam.h */
struct loadparm_context *py_default_loadparm_context(TALLOC_CTX *mem_ctx);
+/* FIXME: This prototype should be in py_irpc.h, or shared otherwise */
+extern const struct PyNdrRpcMethodDef py_ndr_irpc_methods[];
+
static bool server_id_from_py(PyObject *object, struct server_id *server_id)
{
if (!PyTuple_Check(object)) {
PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs)
{
- struct event_context *ev;
+ struct tevent_context *ev;
const char *kwnames[] = { "own_id", "messaging_path", NULL };
PyObject *own_id = Py_None;
const char *messaging_path = NULL;
return NULL;
}
- return Py_None;
+ Py_RETURN_NONE;
}
static void py_msg_callback_wrapper(struct messaging_context *msg, void *private,
Py_DECREF(callback);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject *kwargs)
return NULL;
}
- return Py_None;
+ Py_RETURN_NONE;
}
irpc_remove_name(iface->msg_ctx, name);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef py_messaging_methods[] = {
PyObject *py_irpc_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs)
{
- struct event_context *ev;
+ struct tevent_context *ev;
const char *kwnames[] = { "server", "own_id", "messaging_path", NULL };
char *server;
const char *messaging_path = NULL;
void initmessaging(void)
{
- extern void initirpc(void);
PyObject *mod;
+ PyObject *dep_irpc;
+
+ dep_irpc = PyImport_ImportModule("samba.dcerpc.irpc");
+ if (dep_irpc == NULL)
+ return;
if (PyType_Ready(&irpc_ClientConnectionType) < 0)
return;
if (mod == NULL)
return;
- initirpc();
-
Py_INCREF((PyObject *)&irpc_ClientConnectionType);
PyModule_AddObject(mod, "ClientConnection", (PyObject *)&irpc_ClientConnectionType);