#include "includes.h"
#include <Python.h>
+#include "scripting/python/modules.h"
#include "libcli/util/pyerrors.h"
#include "librpc/rpc/pyrpc.h"
#include "lib/messaging/irpc.h"
ret->mem_ctx = talloc_new(NULL);
- ev = event_context_init(ret->mem_ctx);
+ ev = s4_event_context_init(ret->mem_ctx);
if (messaging_path == NULL) {
- messaging_path = lp_messaging_path(ret, global_loadparm);
+ messaging_path = lp_messaging_path(ret->mem_ctx, global_loadparm);
} else {
messaging_path = talloc_strdup(ret->mem_ctx, messaging_path);
}
ret->msg_ctx = messaging_init(ret->mem_ctx,
messaging_path,
server_id,
- lp_iconv_convenience(global_loadparm),
+ py_iconv_convenience(ret->mem_ctx),
ev);
} else {
ret->msg_ctx = messaging_client_init(ret->mem_ctx,
messaging_path,
- lp_iconv_convenience(global_loadparm),
+ py_iconv_convenience(ret->mem_ctx),
ev);
}
NTSTATUS status;
struct server_id server;
const char *kwnames[] = { "target", "msg_type", "data", NULL };
+ int length;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#|:send",
- discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &data.length)) {
+ discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &length)) {
return NULL;
}
+ data.length = length;
+
if (!server_id_from_py(target, &server))
return NULL;
static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject *kwargs)
{
messaging_Object *iface = (messaging_Object *)self;
- uint32_t msg_type = -1;
+ int msg_type = -1;
PyObject *callback;
NTSTATUS status;
const char *kwnames[] = { "callback", "msg_type", NULL };
-
+
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:send",
discard_const_p(char *, kwnames), &callback, &msg_type)) {
return NULL;
Py_INCREF(callback);
if (msg_type == -1) {
+ uint32_t msg_type32 = msg_type;
status = messaging_register_tmp(iface->msg_ctx, callback,
- py_msg_callback_wrapper, &msg_type);
+ py_msg_callback_wrapper, &msg_type32);
+ msg_type = msg_type32;
} else {
status = messaging_register(iface->msg_ctx, callback,
msg_type, py_msg_callback_wrapper);
static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObject *kwargs)
{
messaging_Object *iface = (messaging_Object *)self;
- uint32_t msg_type = -1;
+ int msg_type = -1;
PyObject *callback;
const char *kwnames[] = { "callback", "msg_type", NULL };
ret->server_name = server;
- ev = event_context_init(ret->mem_ctx);
+ ev = s4_event_context_init(ret->mem_ctx);
if (messaging_path == NULL) {
- messaging_path = lp_messaging_path(ret, global_loadparm);
+ messaging_path = lp_messaging_path(ret->mem_ctx, global_loadparm);
} else {
messaging_path = talloc_strdup(ret->mem_ctx, messaging_path);
}
ret->msg_ctx = messaging_init(ret->mem_ctx,
messaging_path,
server_id,
- lp_iconv_convenience(global_loadparm),
+ py_iconv_convenience(ret->mem_ctx),
ev);
} else {
ret->msg_ctx = messaging_client_init(ret->mem_ctx,
messaging_path,
- lp_iconv_convenience(global_loadparm),
+ py_iconv_convenience(ret->mem_ctx),
ev);
}