struct idr_context *dispatch_tree;
struct messaging_rec *pending;
struct messaging_rec *retry_queue;
+ struct smb_iconv_convenience *iconv_convenience;
struct irpc_list *irpc;
struct idr_context *idr;
const char **names;
*/
static char *messaging_path(struct messaging_context *msg, struct server_id server_id)
{
- return talloc_asprintf(msg, "%s/msg.%u.%u", msg->base_path,
- (unsigned)server_id.node, (unsigned)server_id.id);
+ return talloc_asprintf(msg, "%s/msg.%s", msg->base_path,
+ cluster_id_string(msg, server_id));
}
/*
}
rec->retries = 0;
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1,("messaging: Lost message from %u to %u of type %u - %s\n",
- rec->header->from.id, rec->header->to.id, rec->header->msg_type,
+ DEBUG(1,("messaging: Lost message from %s to %s of type %u - %s\n",
+ cluster_id_string(debug_ctx(), rec->header->from),
+ cluster_id_string(debug_ctx(), rec->header->to),
+ rec->header->msg_type,
nt_errstr(status)));
}
DLIST_REMOVE(msg->pending, rec);
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
const char *dir,
struct server_id server_id,
+ struct smb_iconv_convenience *iconv_convenience,
struct event_context *ev)
{
struct messaging_context *msg;
msg->base_path = talloc_reference(msg, dir);
msg->path = messaging_path(msg, server_id);
msg->server_id = server_id;
+ msg->iconv_convenience = iconv_convenience;
msg->idr = idr_init(msg);
msg->dispatch_tree = idr_init(msg);
msg->start_time = timeval_current();
*/
struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
const char *dir,
+ struct smb_iconv_convenience *iconv_convenience,
struct event_context *ev)
{
struct server_id id;
ZERO_STRUCT(id);
id.id = random() % 0x10000000;
- return messaging_init(mem_ctx, dir, id, ev);
+ return messaging_init(mem_ctx, dir, id, iconv_convenience, ev);
}
/*
a list of registered irpc server functions
m->header.status = status;
/* setup the reply */
- push = ndr_push_init_ctx(m->ndr);
+ push = ndr_push_init_ctx(m->ndr, m->msg_ctx->iconv_convenience);
if (push == NULL) {
status = NT_STATUS_NO_MEMORY;
goto failed;
m->from = src;
- m->ndr = ndr_pull_init_blob(packet, m);
+ m->ndr = ndr_pull_init_blob(packet, m, msg_ctx->iconv_convenience);
if (m->ndr == NULL) goto failed;
m->ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
header.status = NT_STATUS_OK;
/* construct the irpc packet */
- ndr = ndr_push_init_ctx(irpc);
+ ndr = ndr_push_init_ctx(irpc, msg_ctx->iconv_convenience);
if (ndr == NULL) goto failed;
ndr_err = ndr_push_irpc_header(ndr, NDR_SCALARS|NDR_BUFFERS, &header);
for (i=0;i<count;i++) {
ret[i] = ((struct server_id *)rec.dptr)[i];
}
- ret[i] = cluster_id(0);
+ ret[i] = cluster_id(0, 0);
free(rec.dptr);
tdb_unlock_bystring(t->tdb, name);
talloc_free(t);