From cdd802af8319e0b0744d8e727cef75526269ece2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 3 May 2011 10:40:33 +1000 Subject: s4-messaging Rename messaging -> imessaging This avoid symbol and structure conflicts between Samba3 and Samba4, and chooses a less generic name. Andrew Bartlett --- source4/auth/auth.h | 10 +- source4/auth/ntlm/auth.c | 4 +- source4/auth/ntlm/auth_simple.c | 2 +- source4/auth/pyauth.c | 14 +-- source4/auth/samba_server_gensec.c | 2 +- source4/cluster/cluster.c | 2 +- source4/cluster/cluster.h | 6 +- source4/cluster/cluster_private.h | 2 +- source4/cluster/local.c | 2 +- source4/dsdb/repl/drepl_ridalloc.c | 2 +- source4/dsdb/repl/drepl_service.c | 2 +- source4/dsdb/samdb/ldb_modules/ridalloc.c | 6 +- source4/dsdb/samdb/ldb_modules/rootdse.c | 6 +- source4/lib/messaging/irpc.h | 14 +-- source4/lib/messaging/messaging.c | 156 +++++++++++++++--------------- source4/lib/messaging/messaging.h | 20 ++-- source4/lib/messaging/pymessaging.c | 96 +++++++++--------- source4/lib/messaging/tests/irpc.c | 10 +- source4/lib/messaging/tests/messaging.c | 34 +++---- source4/libcli/finddcs_nbt.c | 6 +- source4/libcli/wbclient/wbclient.c | 2 +- source4/libcli/wbclient/wbclient.h | 2 +- source4/librpc/rpc/pyrpc_util.c | 4 +- source4/ntvfs/common/brlock.c | 6 +- source4/ntvfs/common/brlock.h | 2 +- source4/ntvfs/common/brlock_tdb.c | 10 +- source4/ntvfs/common/notify.c | 18 ++-- source4/ntvfs/common/opendb.c | 2 +- source4/ntvfs/common/opendb_tdb.c | 12 +-- source4/ntvfs/ntvfs.h | 4 +- source4/ntvfs/ntvfs_base.c | 2 +- source4/ntvfs/posix/pvfs_oplock.c | 10 +- source4/ntvfs/posix/pvfs_wait.c | 10 +- source4/ntvfs/sysdep/sys_lease.c | 2 +- source4/ntvfs/sysdep/sys_lease.h | 8 +- source4/param/param.h | 2 +- source4/param/util.c | 2 +- source4/rpc_server/dcerpc_server.c | 2 +- source4/rpc_server/dcerpc_server.h | 6 +- source4/smbd/server.c | 6 +- source4/smbd/service_stream.c | 8 +- source4/smbd/service_stream.h | 2 +- source4/smbd/service_task.c | 6 +- source4/smbd/service_task.h | 2 +- source4/utils/ntlm_auth.c | 4 +- source4/wrepl_server/wrepl_scavenging.c | 2 +- 46 files changed, 266 insertions(+), 266 deletions(-) (limited to 'source4') diff --git a/source4/auth/auth.h b/source4/auth/auth.h index 9eb3e7db6f..1704b5eaf2 100644 --- a/source4/auth/auth.h +++ b/source4/auth/auth.h @@ -109,7 +109,7 @@ struct auth_context { struct tevent_context *event_ctx; /* the messaging context which can be used by backends */ - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; /* loadparm context */ struct loadparm_context *lp_ctx; @@ -193,7 +193,7 @@ NTSTATUS auth_system_session_info(TALLOC_CTX *parent_ctx, NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods, struct tevent_context *ev, - struct messaging_context *msg, + struct imessaging_context *msg, struct loadparm_context *lp_ctx, struct ldb_context *sam_ctx, struct auth_context **auth_ctx); @@ -201,7 +201,7 @@ const char **auth_methods_from_lp(TALLOC_CTX *mem_ctx, struct loadparm_context * NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct messaging_context *msg, + struct imessaging_context *msg, struct loadparm_context *lp_ctx, struct auth_context **auth_ctx); NTSTATUS auth_context_create_from_ldb(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, struct auth_context **auth_ctx); @@ -215,7 +215,7 @@ NTSTATUS auth_register(const struct auth_operations *ops); NTSTATUS server_service_auth_init(void); NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct messaging_context *msg, + struct imessaging_context *msg, struct loadparm_context *lp_ctx, const char *nt4_domain, const char *nt4_username, @@ -242,7 +242,7 @@ NTSTATUS auth_get_user_info_dc_principal(TALLOC_CTX *mem_ctx, NTSTATUS samba_server_gensec_start(TALLOC_CTX *mem_ctx, struct tevent_context *event_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, struct loadparm_context *lp_ctx, struct cli_credentials *server_credentials, const char *target_service, diff --git a/source4/auth/ntlm/auth.c b/source4/auth/ntlm/auth.c index e2deab78bc..771474c803 100644 --- a/source4/auth/ntlm/auth.c +++ b/source4/auth/ntlm/auth.c @@ -425,7 +425,7 @@ static NTSTATUS auth_generate_session_info_wrapper(TALLOC_CTX *mem_ctx, ***************************************************************************/ _PUBLIC_ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods, struct tevent_context *ev, - struct messaging_context *msg, + struct imessaging_context *msg, struct loadparm_context *lp_ctx, struct ldb_context *sam_ctx, struct auth_context **auth_ctx) @@ -508,7 +508,7 @@ const char **auth_methods_from_lp(TALLOC_CTX *mem_ctx, struct loadparm_context * ***************************************************************************/ _PUBLIC_ NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct messaging_context *msg, + struct imessaging_context *msg, struct loadparm_context *lp_ctx, struct auth_context **auth_ctx) { diff --git a/source4/auth/ntlm/auth_simple.c b/source4/auth/ntlm/auth_simple.c index 75eabe855b..5f86466db9 100644 --- a/source4/auth/ntlm/auth_simple.c +++ b/source4/auth/ntlm/auth_simple.c @@ -30,7 +30,7 @@ */ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct messaging_context *msg, + struct imessaging_context *msg, struct loadparm_context *lp_ctx, const char *nt4_domain, const char *nt4_username, diff --git a/source4/auth/pyauth.c b/source4/auth/pyauth.c index a4ba88c581..6fd68d2070 100644 --- a/source4/auth/pyauth.c +++ b/source4/auth/pyauth.c @@ -214,12 +214,12 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec { PyObject *py_lp_ctx = Py_None; PyObject *py_ldb = Py_None; - PyObject *py_messaging_ctx = Py_None; + PyObject *py_imessaging_ctx = Py_None; PyObject *py_auth_context = Py_None; PyObject *py_methods = Py_None; TALLOC_CTX *mem_ctx; struct auth_context *auth_context; - struct messaging_context *messaging_context = NULL; + struct imessaging_context *imessaging_context = NULL; struct loadparm_context *lp_ctx; struct tevent_context *ev; struct ldb_context *ldb; @@ -230,7 +230,7 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOO", discard_const_p(char *, kwnames), - &py_lp_ctx, &py_messaging_ctx, &py_ldb, &py_methods)) + &py_lp_ctx, &py_imessaging_ctx, &py_ldb, &py_methods)) return NULL; mem_ctx = talloc_new(NULL); @@ -251,12 +251,12 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec return NULL; } - if (py_messaging_ctx != Py_None) { - messaging_context = py_talloc_get_type(py_messaging_ctx, struct messaging_context); + if (py_imessaging_ctx != Py_None) { + imessaging_context = py_talloc_get_type(py_imessaging_ctx, struct imessaging_context); } if (py_methods == Py_None && py_ldb == Py_None) { - nt_status = auth_context_create(mem_ctx, ev, messaging_context, lp_ctx, &auth_context); + nt_status = auth_context_create(mem_ctx, ev, imessaging_context, lp_ctx, &auth_context); } else { if (py_methods != Py_None) { methods = PyList_AsStringList(mem_ctx, py_methods, "methods"); @@ -268,7 +268,7 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec methods = auth_methods_from_lp(mem_ctx, lp_ctx); } nt_status = auth_context_create_methods(mem_ctx, methods, ev, - messaging_context, lp_ctx, + imessaging_context, lp_ctx, ldb, &auth_context); } diff --git a/source4/auth/samba_server_gensec.c b/source4/auth/samba_server_gensec.c index 07b9b15e17..b1b8687708 100644 --- a/source4/auth/samba_server_gensec.c +++ b/source4/auth/samba_server_gensec.c @@ -29,7 +29,7 @@ NTSTATUS samba_server_gensec_start(TALLOC_CTX *mem_ctx, struct tevent_context *event_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, struct loadparm_context *lp_ctx, struct cli_credentials *server_credentials, const char *target_service, diff --git a/source4/cluster/cluster.c b/source4/cluster/cluster.c index 315145afac..441ea96562 100644 --- a/source4/cluster/cluster.c +++ b/source4/cluster/cluster.c @@ -80,7 +80,7 @@ struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_conte /* register a callback function for a messaging endpoint */ -NTSTATUS cluster_message_init(struct messaging_context *msg, struct server_id server, +NTSTATUS cluster_message_init(struct imessaging_context *msg, struct server_id server, cluster_message_fn_t handler) { cluster_init(); diff --git a/source4/cluster/cluster.h b/source4/cluster/cluster.h index ad2f926596..5ed9055d7b 100644 --- a/source4/cluster/cluster.h +++ b/source4/cluster/cluster.h @@ -36,8 +36,8 @@ */ #define cluster_node_equal(id1, id2) ((id1)->vnn == (id2)->vnn) -struct messaging_context; -typedef void (*cluster_message_fn_t)(struct messaging_context *, DATA_BLOB); +struct imessaging_context; +typedef void (*cluster_message_fn_t)(struct imessaging_context *, DATA_BLOB); /* prototypes */ struct server_id cluster_id(uint64_t id, uint32_t id2); @@ -45,7 +45,7 @@ char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id); struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *dbname, int flags); void *cluster_backend_handle(void); -NTSTATUS cluster_message_init(struct messaging_context *msg, struct server_id server, +NTSTATUS cluster_message_init(struct imessaging_context *msg, struct server_id server, cluster_message_fn_t handler); NTSTATUS cluster_message_send(struct server_id server, DATA_BLOB *data); diff --git a/source4/cluster/cluster_private.h b/source4/cluster/cluster_private.h index 3207e6dafe..5f038dd92f 100644 --- a/source4/cluster/cluster_private.h +++ b/source4/cluster/cluster_private.h @@ -32,7 +32,7 @@ struct cluster_ops { const char *, int); void *(*backend_handle)(struct cluster_ops *); NTSTATUS (*message_init)(struct cluster_ops *ops, - struct messaging_context *msg, struct server_id server, + struct imessaging_context *msg, struct server_id server, cluster_message_fn_t handler); NTSTATUS (*message_send)(struct cluster_ops *ops, struct server_id server, DATA_BLOB *data); diff --git a/source4/cluster/local.c b/source4/cluster/local.c index dc9f4f79fb..b6ec7644d3 100644 --- a/source4/cluster/local.c +++ b/source4/cluster/local.c @@ -80,7 +80,7 @@ static void *local_backend_handle(struct cluster_ops *ops) dummy message init function - not needed as all messages are local */ static NTSTATUS local_message_init(struct cluster_ops *ops, - struct messaging_context *msg, + struct imessaging_context *msg, struct server_id server, cluster_message_fn_t handler) { diff --git a/source4/dsdb/repl/drepl_ridalloc.c b/source4/dsdb/repl/drepl_ridalloc.c index 48c208c3cf..53b56b63d2 100644 --- a/source4/dsdb/repl/drepl_ridalloc.c +++ b/source4/dsdb/repl/drepl_ridalloc.c @@ -236,7 +236,7 @@ WERROR dreplsrv_ridalloc_check_rid_pool(struct dreplsrv_service *service) /* called by the samldb ldb module to tell us to ask for a new RID pool */ -void dreplsrv_allocate_rid(struct messaging_context *msg, void *private_data, +void dreplsrv_allocate_rid(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data) { diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 0931a340b1..ec803f6fdb 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -497,7 +497,7 @@ static void dreplsrv_task_init(struct task_server *task) IRPC_REGISTER(task->msg_ctx, drsuapi, DRSUAPI_DSREPLICAMOD, dreplsrv_replica_mod, service); IRPC_REGISTER(task->msg_ctx, irpc, DREPL_TAKEFSMOROLE, drepl_take_FSMO_role, service); IRPC_REGISTER(task->msg_ctx, irpc, DREPL_TRIGGER_REPL_SECRET, drepl_trigger_repl_secret, service); - messaging_register(task->msg_ctx, service, MSG_DREPL_ALLOCATE_RID, dreplsrv_allocate_rid); + imessaging_register(task->msg_ctx, service, MSG_DREPL_ALLOCATE_RID, dreplsrv_allocate_rid); } /* diff --git a/source4/dsdb/samdb/ldb_modules/ridalloc.c b/source4/dsdb/samdb/ldb_modules/ridalloc.c index 5051919672..28fade11b1 100644 --- a/source4/dsdb/samdb/ldb_modules/ridalloc.c +++ b/source4/dsdb/samdb/ldb_modules/ridalloc.c @@ -66,14 +66,14 @@ */ static void ridalloc_poke_rid_manager(struct ldb_module *module) { - struct messaging_context *msg; + struct imessaging_context *msg; struct server_id *server; struct ldb_context *ldb = ldb_module_get_ctx(module); struct loadparm_context *lp_ctx = (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm"); TALLOC_CTX *tmp_ctx = talloc_new(module); - msg = messaging_client_init(tmp_ctx, lpcfg_messaging_path(tmp_ctx, lp_ctx), + msg = imessaging_client_init(tmp_ctx, lpcfg_imessaging_path(tmp_ctx, lp_ctx), ldb_get_event_context(ldb)); if (!msg) { DEBUG(3,(__location__ ": Failed to create messaging context\n")); @@ -88,7 +88,7 @@ static void ridalloc_poke_rid_manager(struct ldb_module *module) return; } - messaging_send(msg, server[0], MSG_DREPL_ALLOCATE_RID, NULL); + imessaging_send(msg, server[0], MSG_DREPL_ALLOCATE_RID, NULL); /* we don't care if the message got through */ talloc_free(tmp_ctx); diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index 0fd65f4795..b718900345 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -1195,7 +1195,7 @@ static int rootdse_become_master(struct ldb_module *module, struct ldb_request *req, enum drepl_role_master role) { - struct messaging_context *msg; + struct imessaging_context *msg; struct ldb_context *ldb = ldb_module_get_ctx(module); TALLOC_CTX *tmp_ctx = talloc_new(req); struct loadparm_context *lp_ctx = ldb_get_opaque(ldb, "loadparm"); @@ -1223,10 +1223,10 @@ static int rootdse_become_master(struct ldb_module *module, "RODC cannot become a role master."); } - msg = messaging_client_init(tmp_ctx, lpcfg_messaging_path(tmp_ctx, lp_ctx), + msg = imessaging_client_init(tmp_ctx, lpcfg_imessaging_path(tmp_ctx, lp_ctx), ldb_get_event_context(ldb)); if (!msg) { - ldb_asprintf_errstring(ldb, "Failed to generate client messaging context in %s", lpcfg_messaging_path(tmp_ctx, lp_ctx)); + ldb_asprintf_errstring(ldb, "Failed to generate client messaging context in %s", lpcfg_imessaging_path(tmp_ctx, lp_ctx)); return LDB_ERR_OPERATIONS_ERROR; } irpc_handle = irpc_binding_handle_by_name(tmp_ctx, msg, diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h index bdb1b8fedb..15f8259e51 100644 --- a/source4/lib/messaging/irpc.h +++ b/source4/lib/messaging/irpc.h @@ -35,7 +35,7 @@ struct irpc_message { struct ndr_pull *ndr; bool defer_reply; bool no_reply; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct irpc_list *irpc; void *data; struct tevent_context *ev; @@ -58,24 +58,24 @@ typedef NTSTATUS (*irpc_function_t)(struct irpc_message *, void *r); struct ndr_interface_table; -NTSTATUS irpc_register(struct messaging_context *msg_ctx, +NTSTATUS irpc_register(struct imessaging_context *msg_ctx, const struct ndr_interface_table *table, int call, irpc_function_t fn, void *private_data); struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, struct server_id server_id, const struct ndr_interface_table *table); struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, const char *dest_task, const struct ndr_interface_table *table); void irpc_binding_handle_add_security_token(struct dcerpc_binding_handle *h, struct security_token *token); -NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name); -struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name); -void irpc_remove_name(struct messaging_context *msg_ctx, const char *name); +NTSTATUS irpc_add_name(struct imessaging_context *msg_ctx, const char *name); +struct server_id *irpc_servers_byname(struct imessaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name); +void irpc_remove_name(struct imessaging_context *msg_ctx, const char *name); NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status); #endif diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 48c9c16fb9..1b0fc1291c 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -36,13 +36,13 @@ #include "../lib/util/tevent_ntstatus.h" /* change the message version with any incompatible changes in the protocol */ -#define MESSAGING_VERSION 1 +#define IMESSAGING_VERSION 1 /* a pending irpc call */ struct irpc_request { - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; int callid; struct { void (*handler)(struct irpc_request *irpc, struct irpc_message *m); @@ -50,7 +50,7 @@ struct irpc_request { } incoming; }; -struct messaging_context { +struct imessaging_context { struct server_id server_id; struct socket_context *sock; const char *base_path; @@ -58,8 +58,8 @@ struct messaging_context { struct dispatch_fn **dispatch; uint32_t num_types; struct idr_context *dispatch_tree; - struct messaging_rec *pending; - struct messaging_rec *retry_queue; + struct imessaging_rec *pending; + struct imessaging_rec *retry_queue; struct irpc_list *irpc; struct idr_context *idr; const char **names; @@ -81,12 +81,12 @@ struct dispatch_fn { }; /* an individual message */ -struct messaging_rec { - struct messaging_rec *next, *prev; - struct messaging_context *msg; +struct imessaging_rec { + struct imessaging_rec *next, *prev; + struct imessaging_context *msg; const char *path; - struct messaging_header { + struct imessaging_header { uint32_t version; uint32_t msg_type; struct server_id from; @@ -99,14 +99,14 @@ struct messaging_rec { }; -static void irpc_handler(struct messaging_context *, void *, +static void irpc_handler(struct imessaging_context *, void *, uint32_t, struct server_id, DATA_BLOB *); /* A useful function for testing the message system. */ -static void ping_message(struct messaging_context *msg, void *private_data, +static void ping_message(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { char *task_id = cluster_id_string(NULL, src); @@ -114,7 +114,7 @@ static void ping_message(struct messaging_context *msg, void *private_data, task_id, (int)data->length, data->data?(const char *)data->data:"")); talloc_free(task_id); - messaging_send(msg, src, MSG_PONG, data); + imessaging_send(msg, src, MSG_PONG, data); } /* @@ -123,7 +123,7 @@ static void ping_message(struct messaging_context *msg, void *private_data, static NTSTATUS irpc_uptime(struct irpc_message *msg, struct irpc_uptime *r) { - struct messaging_context *ctx = talloc_get_type(msg->private_data, struct messaging_context); + struct imessaging_context *ctx = talloc_get_type(msg->private_data, struct imessaging_context); *r->out.start_time = timeval_to_nttime(&ctx->start_time); return NT_STATUS_OK; } @@ -131,7 +131,7 @@ static NTSTATUS irpc_uptime(struct irpc_message *msg, /* return the path to a messaging socket */ -static char *messaging_path(struct messaging_context *msg, struct server_id server_id) +static char *imessaging_path(struct imessaging_context *msg, struct server_id server_id) { TALLOC_CTX *tmp_ctx = talloc_new(msg); const char *id = cluster_id_string(tmp_ctx, server_id); @@ -151,7 +151,7 @@ static char *messaging_path(struct messaging_context *msg, struct server_id serv per message. That allows a single messasging context to register (for example) a debug handler for more than one piece of code */ -static void messaging_dispatch(struct messaging_context *msg, struct messaging_rec *rec) +static void imessaging_dispatch(struct imessaging_context *msg, struct imessaging_rec *rec) { struct dispatch_fn *d, *next; @@ -178,18 +178,18 @@ static void messaging_dispatch(struct messaging_context *msg, struct messaging_r /* handler for messages that arrive from other nodes in the cluster */ -static void cluster_message_handler(struct messaging_context *msg, DATA_BLOB packet) +static void cluster_message_handler(struct imessaging_context *msg, DATA_BLOB packet) { - struct messaging_rec *rec; + struct imessaging_rec *rec; - rec = talloc(msg, struct messaging_rec); + rec = talloc(msg, struct imessaging_rec); if (rec == NULL) { - smb_panic("Unable to allocate messaging_rec"); + smb_panic("Unable to allocate imessaging_rec"); } rec->msg = msg; rec->path = msg->path; - rec->header = (struct messaging_header *)packet.data; + rec->header = (struct imessaging_header *)packet.data; rec->packet = packet; rec->retries = 0; @@ -200,7 +200,7 @@ static void cluster_message_handler(struct messaging_context *msg, DATA_BLOB pac return; } - messaging_dispatch(msg, rec); + imessaging_dispatch(msg, rec); talloc_free(rec); } @@ -209,9 +209,9 @@ static void cluster_message_handler(struct messaging_context *msg, DATA_BLOB pac /* try to send the message */ -static NTSTATUS try_send(struct messaging_rec *rec) +static NTSTATUS try_send(struct imessaging_rec *rec) { - struct messaging_context *msg = rec->msg; + struct imessaging_context *msg = rec->msg; size_t nsent; void *priv; NTSTATUS status; @@ -240,15 +240,15 @@ static NTSTATUS try_send(struct messaging_rec *rec) static void msg_retry_timer(struct tevent_context *ev, struct tevent_timer *te, struct timeval t, void *private_data) { - struct messaging_context *msg = talloc_get_type(private_data, - struct messaging_context); + struct imessaging_context *msg = talloc_get_type(private_data, + struct imessaging_context); msg->retry_te = NULL; /* put the messages back on the main queue */ while (msg->retry_queue) { - struct messaging_rec *rec = msg->retry_queue; + struct imessaging_rec *rec = msg->retry_queue; DLIST_REMOVE(msg->retry_queue, rec); - DLIST_ADD_END(msg->pending, rec, struct messaging_rec *); + DLIST_ADD_END(msg->pending, rec, struct imessaging_rec *); } EVENT_FD_WRITEABLE(msg->event.fde); @@ -257,10 +257,10 @@ static void msg_retry_timer(struct tevent_context *ev, struct tevent_timer *te, /* handle a socket write event */ -static void messaging_send_handler(struct messaging_context *msg) +static void imessaging_send_handler(struct imessaging_context *msg) { while (msg->pending) { - struct messaging_rec *rec = msg->pending; + struct imessaging_rec *rec = msg->pending; NTSTATUS status; status = try_send(rec); if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { @@ -270,7 +270,7 @@ static void messaging_send_handler(struct messaging_context *msg) backoff this record */ DLIST_REMOVE(msg->pending, rec); DLIST_ADD_END(msg->retry_queue, rec, - struct messaging_rec *); + struct imessaging_rec *); if (msg->retry_te == NULL) { msg->retry_te = event_add_timed(msg->event.ev, msg, @@ -301,9 +301,9 @@ static void messaging_send_handler(struct messaging_context *msg) /* handle a new incoming packet */ -static void messaging_recv_handler(struct messaging_context *msg) +static void imessaging_recv_handler(struct imessaging_context *msg) { - struct messaging_rec *rec; + struct imessaging_rec *rec; NTSTATUS status; DATA_BLOB packet; size_t msize; @@ -334,15 +334,15 @@ static void messaging_recv_handler(struct messaging_context *msg) return; } - rec = talloc(msg, struct messaging_rec); + rec = talloc(msg, struct imessaging_rec); if (rec == NULL) { - smb_panic("Unable to allocate messaging_rec"); + smb_panic("Unable to allocate imessaging_rec"); } talloc_steal(rec, packet.data); rec->msg = msg; rec->path = msg->path; - rec->header = (struct messaging_header *)packet.data; + rec->header = (struct imessaging_header *)packet.data; rec->packet = packet; rec->retries = 0; @@ -353,7 +353,7 @@ static void messaging_recv_handler(struct messaging_context *msg) return; } - messaging_dispatch(msg, rec); + imessaging_dispatch(msg, rec); talloc_free(rec); } @@ -361,16 +361,16 @@ static void messaging_recv_handler(struct messaging_context *msg) /* handle a socket event */ -static void messaging_handler(struct tevent_context *ev, struct tevent_fd *fde, +static void imessaging_handler(struct tevent_context *ev, struct tevent_fd *fde, uint16_t flags, void *private_data) { - struct messaging_context *msg = talloc_get_type(private_data, - struct messaging_context); + struct imessaging_context *msg = talloc_get_type(private_data, + struct imessaging_context); if (flags & EVENT_FD_WRITE) { - messaging_send_handler(msg); + imessaging_send_handler(msg); } if (flags & EVENT_FD_READ) { - messaging_recv_handler(msg); + imessaging_recv_handler(msg); } } @@ -378,7 +378,7 @@ static void messaging_handler(struct tevent_context *ev, struct tevent_fd *fde, /* Register a dispatch function for a particular message type. */ -NTSTATUS messaging_register(struct messaging_context *msg, void *private_data, +NTSTATUS imessaging_register(struct imessaging_context *msg, void *private_data, uint32_t msg_type, msg_callback_t fn) { struct dispatch_fn *d; @@ -411,7 +411,7 @@ NTSTATUS messaging_register(struct messaging_context *msg, void *private_data, register a temporary message handler. The msg_type is allocated above MSG_TMP_BASE */ -NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private_data, +NTSTATUS imessaging_register_tmp(struct imessaging_context *msg, void *private_data, msg_callback_t fn, uint32_t *msg_type) { struct dispatch_fn *d; @@ -437,7 +437,7 @@ NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private_dat /* De-register the function for a particular message type. */ -void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void *private_data) +void imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, void *private_data) { struct dispatch_fn *d, *next; @@ -462,14 +462,14 @@ void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void /* Send a message to a particular server */ -NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, +NTSTATUS imessaging_send(struct imessaging_context *msg, struct server_id server, uint32_t msg_type, const DATA_BLOB *data) { - struct messaging_rec *rec; + struct imessaging_rec *rec; NTSTATUS status; size_t dlength = data?data->length:0; - rec = talloc(msg, struct messaging_rec); + rec = talloc(msg, struct imessaging_rec); if (rec == NULL) { return NT_STATUS_NO_MEMORY; } @@ -482,10 +482,10 @@ NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, rec->retries = 0; rec->msg = msg; - rec->header = (struct messaging_header *)rec->packet.data; + rec->header = (struct imessaging_header *)rec->packet.data; /* zero padding */ ZERO_STRUCTP(rec->header); - rec->header->version = MESSAGING_VERSION; + rec->header->version = IMESSAGING_VERSION; rec->header->msg_type = msg_type; rec->header->from = msg->server_id; rec->header->to = server; @@ -503,7 +503,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, return status; } - rec->path = messaging_path(msg, server); + rec->path = imessaging_path(msg, server); talloc_steal(rec, rec->path); if (msg->pending != NULL) { @@ -516,7 +516,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, if (msg->pending == NULL) { EVENT_FD_WRITEABLE(msg->event.fde); } - DLIST_ADD_END(msg->pending, rec, struct messaging_rec *); + DLIST_ADD_END(msg->pending, rec, struct imessaging_rec *); return NT_STATUS_OK; } @@ -528,7 +528,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, /* Send a message to a particular server, with the message containing a single pointer */ -NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id server, +NTSTATUS imessaging_send_ptr(struct imessaging_context *msg, struct server_id server, uint32_t msg_type, void *ptr) { DATA_BLOB blob; @@ -536,14 +536,14 @@ NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id serv blob.data = (uint8_t *)&ptr; blob.length = sizeof(void *); - return messaging_send(msg, server, msg_type, &blob); + return imessaging_send(msg, server, msg_type, &blob); } /* destroy the messaging context */ -static int messaging_destructor(struct messaging_context *msg) +static int imessaging_destructor(struct imessaging_context *msg) { unlink(msg->path); while (msg->names && msg->names[0]) { @@ -555,12 +555,12 @@ static int messaging_destructor(struct messaging_context *msg) /* create the listening socket and setup the dispatcher */ -struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, +struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, const char *dir, struct server_id server_id, struct tevent_context *ev) { - struct messaging_context *msg; + struct imessaging_context *msg; NTSTATUS status; struct socket_address *path; @@ -568,7 +568,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, return NULL; } - msg = talloc_zero(mem_ctx, struct messaging_context); + msg = talloc_zero(mem_ctx, struct imessaging_context); if (msg == NULL) { return NULL; } @@ -584,7 +584,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, mkdir(dir, 0700); msg->base_path = talloc_reference(msg, dir); - msg->path = messaging_path(msg, server_id); + msg->path = imessaging_path(msg, server_id); msg->server_id = server_id; msg->idr = idr_init(msg); msg->dispatch_tree = idr_init(msg); @@ -619,13 +619,13 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, msg->event.ev = ev; msg->event.fde = event_add_fd(ev, msg, socket_get_fd(msg->sock), - EVENT_FD_READ, messaging_handler, msg); + EVENT_FD_READ, imessaging_handler, msg); tevent_fd_set_auto_close(msg->event.fde); - talloc_set_destructor(msg, messaging_destructor); + talloc_set_destructor(msg, imessaging_destructor); - messaging_register(msg, NULL, MSG_PING, ping_message); - messaging_register(msg, NULL, MSG_IRPC, irpc_handler); + imessaging_register(msg, NULL, MSG_PING, ping_message); + imessaging_register(msg, NULL, MSG_IRPC, irpc_handler); IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg); return msg; @@ -634,14 +634,14 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, /* A hack, for the short term until we get 'client only' messaging in place */ -struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx, +struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx, const char *dir, struct tevent_context *ev) { struct server_id id; ZERO_STRUCT(id); id.pid = random() % 0x10000000; - return messaging_init(mem_ctx, dir, id, ev); + return imessaging_init(mem_ctx, dir, id, ev); } /* a list of registered irpc server functions @@ -659,7 +659,7 @@ struct irpc_list { /* register a irpc server function */ -NTSTATUS irpc_register(struct messaging_context *msg_ctx, +NTSTATUS irpc_register(struct imessaging_context *msg_ctx, const struct ndr_interface_table *table, int callnum, irpc_function_t fn, void *private_data) { @@ -690,7 +690,7 @@ NTSTATUS irpc_register(struct messaging_context *msg_ctx, /* handle an incoming irpc reply message */ -static void irpc_handler_reply(struct messaging_context *msg_ctx, struct irpc_message *m) +static void irpc_handler_reply(struct imessaging_context *msg_ctx, struct irpc_message *m) { struct irpc_request *irpc; @@ -736,7 +736,7 @@ NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status) /* send the reply message */ packet = ndr_push_blob(push); - status = messaging_send(m->msg_ctx, m->from, MSG_IRPC, &packet); + status = imessaging_send(m->msg_ctx, m->from, MSG_IRPC, &packet); if (!NT_STATUS_IS_OK(status)) goto failed; failed: @@ -747,7 +747,7 @@ failed: /* handle an incoming irpc request message */ -static void irpc_handler_request(struct messaging_context *msg_ctx, +static void irpc_handler_request(struct imessaging_context *msg_ctx, struct irpc_message *m) { struct irpc_list *i; @@ -811,7 +811,7 @@ failed: /* handle an incoming irpc message */ -static void irpc_handler(struct messaging_context *msg_ctx, void *private_data, +static void irpc_handler(struct imessaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *packet) { struct irpc_message *m; @@ -858,7 +858,7 @@ static int irpc_destructor(struct irpc_request *irpc) /* open the naming database */ -static struct tdb_wrap *irpc_namedb_open(struct messaging_context *msg_ctx) +static struct tdb_wrap *irpc_namedb_open(struct imessaging_context *msg_ctx) { struct tdb_wrap *t; char *path = talloc_asprintf(msg_ctx, "%s/names.tdb", msg_ctx->base_path); @@ -874,7 +874,7 @@ static struct tdb_wrap *irpc_namedb_open(struct messaging_context *msg_ctx) /* add a string name that this irpc server can be called on */ -NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name) +NTSTATUS irpc_add_name(struct imessaging_context *msg_ctx, const char *name) { struct tdb_wrap *t; TDB_DATA rec; @@ -914,7 +914,7 @@ NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name) /* return a list of server ids for a server name */ -struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, +struct server_id *irpc_servers_byname(struct imessaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name) { @@ -959,7 +959,7 @@ struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, /* remove a name from a messaging context */ -void irpc_remove_name(struct messaging_context *msg_ctx, const char *name) +void irpc_remove_name(struct imessaging_context *msg_ctx, const char *name) { struct tdb_wrap *t; TDB_DATA rec; @@ -1007,13 +1007,13 @@ void irpc_remove_name(struct messaging_context *msg_ctx, const char *name) talloc_free(t); } -struct server_id messaging_get_server_id(struct messaging_context *msg_ctx) +struct server_id imessaging_get_server_id(struct imessaging_context *msg_ctx) { return msg_ctx->server_id; } struct irpc_bh_state { - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct server_id server_id; const struct ndr_interface_table *table; uint32_t timeout; @@ -1139,7 +1139,7 @@ static struct tevent_req *irpc_bh_raw_call_send(TALLOC_CTX *mem_ctx, /* and send it */ state->in_packet = ndr_push_blob(ndr); - status = messaging_send(hs->msg_ctx, hs->server_id, + status = imessaging_send(hs->msg_ctx, hs->server_id, MSG_IRPC, &state->in_packet); if (!NT_STATUS_IS_OK(status)) { tevent_req_nterror(req, status); @@ -1272,7 +1272,7 @@ static const struct dcerpc_binding_handle_ops irpc_bh_ops = { /* initialise a irpc binding handle */ struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, struct server_id server_id, const struct ndr_interface_table *table) { @@ -1300,7 +1300,7 @@ struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx, } struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, const char *dest_task, const struct ndr_interface_table *table) { diff --git a/source4/lib/messaging/messaging.h b/source4/lib/messaging/messaging.h index 4bc6d8c509..14a112f878 100644 --- a/source4/lib/messaging/messaging.h +++ b/source4/lib/messaging/messaging.h @@ -23,7 +23,7 @@ #include "librpc/gen_ndr/server_id4.h" -struct messaging_context; +struct imessaging_context; /* general messages */ #define MSG_DEBUG 1 @@ -42,27 +42,27 @@ struct messaging_context; /* taskid for messaging of parent process */ #define SAMBA_PARENT_TASKID 0 -typedef void (*msg_callback_t)(struct messaging_context *msg, void *private_data, +typedef void (*msg_callback_t)(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data); -NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, +NTSTATUS imessaging_send(struct imessaging_context *msg, struct server_id server, uint32_t msg_type, const DATA_BLOB *data); -NTSTATUS messaging_register(struct messaging_context *msg, void *private_data, +NTSTATUS imessaging_register(struct imessaging_context *msg, void *private_data, uint32_t msg_type, msg_callback_t fn); -NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private_data, +NTSTATUS imessaging_register_tmp(struct imessaging_context *msg, void *private_data, msg_callback_t fn, uint32_t *msg_type); -struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, +struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, const char *dir, struct server_id server_id, struct tevent_context *ev); -struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx, +struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx, const char *dir, struct tevent_context *ev); -NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id server, +NTSTATUS imessaging_send_ptr(struct imessaging_context *msg, struct server_id server, uint32_t msg_type, void *ptr); -void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void *private_data); -struct server_id messaging_get_server_id(struct messaging_context *msg_ctx); +void imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, void *private_data); +struct server_id imessaging_get_server_id(struct imessaging_context *msg_ctx); #endif diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c index a58176dc07..f295f42d5f 100644 --- a/source4/lib/messaging/pymessaging.c +++ b/source4/lib/messaging/pymessaging.c @@ -35,7 +35,7 @@ void initmessaging(void); -extern PyTypeObject messaging_Type; +extern PyTypeObject imessaging_Type; static bool server_id_from_py(PyObject *object, struct server_id *server_id) { @@ -58,23 +58,23 @@ static bool server_id_from_py(PyObject *object, struct server_id *server_id) typedef struct { PyObject_HEAD TALLOC_CTX *mem_ctx; - struct messaging_context *msg_ctx; -} messaging_Object; + struct imessaging_context *msg_ctx; +} imessaging_Object; -static PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs) +static PyObject *py_imessaging_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs) { struct tevent_context *ev; const char *kwnames[] = { "own_id", "messaging_path", NULL }; PyObject *own_id = Py_None; - const char *messaging_path = NULL; - messaging_Object *ret; + const char *imessaging_path = NULL; + imessaging_Object *ret; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oz:connect", - discard_const_p(char *, kwnames), &own_id, &messaging_path)) { + discard_const_p(char *, kwnames), &own_id, &imessaging_path)) { return NULL; } - ret = PyObject_New(messaging_Object, &messaging_Type); + ret = PyObject_New(imessaging_Object, &imessaging_Type); if (ret == NULL) return NULL; @@ -82,11 +82,11 @@ static PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObje ev = s4_event_context_init(ret->mem_ctx); - if (messaging_path == NULL) { - messaging_path = lpcfg_messaging_path(ret->mem_ctx, + if (imessaging_path == NULL) { + imessaging_path = lpcfg_imessaging_path(ret->mem_ctx, py_default_loadparm_context(ret->mem_ctx)); } else { - messaging_path = talloc_strdup(ret->mem_ctx, messaging_path); + imessaging_path = talloc_strdup(ret->mem_ctx, imessaging_path); } if (own_id != Py_None) { @@ -95,18 +95,18 @@ static PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObje if (!server_id_from_py(own_id, &server_id)) return NULL; - ret->msg_ctx = messaging_init(ret->mem_ctx, - messaging_path, + ret->msg_ctx = imessaging_init(ret->mem_ctx, + imessaging_path, server_id, ev); } else { - ret->msg_ctx = messaging_client_init(ret->mem_ctx, - messaging_path, + ret->msg_ctx = imessaging_client_init(ret->mem_ctx, + imessaging_path, ev); } if (ret->msg_ctx == NULL) { - PyErr_SetString(PyExc_RuntimeError, "messaging_connect unable to create a messaging context"); + PyErr_SetString(PyExc_RuntimeError, "imessaging_connect unable to create a messaging context"); talloc_free(ret->mem_ctx); return NULL; } @@ -114,16 +114,16 @@ static PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObje return (PyObject *)ret; } -static void py_messaging_dealloc(PyObject *self) +static void py_imessaging_dealloc(PyObject *self) { - messaging_Object *iface = (messaging_Object *)self; + imessaging_Object *iface = (imessaging_Object *)self; talloc_free(iface->msg_ctx); self->ob_type->tp_free(self); } -static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwargs) +static PyObject *py_imessaging_send(PyObject *self, PyObject *args, PyObject *kwargs) { - messaging_Object *iface = (messaging_Object *)self; + imessaging_Object *iface = (imessaging_Object *)self; uint32_t msg_type; DATA_BLOB data; PyObject *target; @@ -143,7 +143,7 @@ static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwa if (!server_id_from_py(target, &server)) return NULL; - status = messaging_send(iface->msg_ctx, server, msg_type, &data); + status = imessaging_send(iface->msg_ctx, server, msg_type, &data); if (NT_STATUS_IS_ERR(status)) { PyErr_SetNTSTATUS(status); return NULL; @@ -152,7 +152,7 @@ static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwa Py_RETURN_NONE; } -static void py_msg_callback_wrapper(struct messaging_context *msg, void *private_data, +static void py_msg_callback_wrapper(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data) { @@ -163,9 +163,9 @@ static void py_msg_callback_wrapper(struct messaging_context *msg, void *private data->data, data->length); } -static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject *kwargs) +static PyObject *py_imessaging_register(PyObject *self, PyObject *args, PyObject *kwargs) { - messaging_Object *iface = (messaging_Object *)self; + imessaging_Object *iface = (imessaging_Object *)self; int msg_type = -1; PyObject *callback; NTSTATUS status; @@ -180,11 +180,11 @@ static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject if (msg_type == -1) { uint32_t msg_type32 = msg_type; - status = messaging_register_tmp(iface->msg_ctx, callback, + status = imessaging_register_tmp(iface->msg_ctx, callback, py_msg_callback_wrapper, &msg_type32); msg_type = msg_type32; } else { - status = messaging_register(iface->msg_ctx, callback, + status = imessaging_register(iface->msg_ctx, callback, msg_type, py_msg_callback_wrapper); } if (NT_STATUS_IS_ERR(status)) { @@ -195,9 +195,9 @@ static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject return PyLong_FromLong(msg_type); } -static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObject *kwargs) +static PyObject *py_imessaging_deregister(PyObject *self, PyObject *args, PyObject *kwargs) { - messaging_Object *iface = (messaging_Object *)self; + imessaging_Object *iface = (imessaging_Object *)self; int msg_type = -1; PyObject *callback; const char *kwnames[] = { "callback", "msg_type", NULL }; @@ -207,49 +207,49 @@ static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObjec return NULL; } - messaging_deregister(iface->msg_ctx, msg_type, callback); + imessaging_deregister(iface->msg_ctx, msg_type, callback); Py_DECREF(callback); Py_RETURN_NONE; } -static PyMethodDef py_messaging_methods[] = { - { "send", (PyCFunction)py_messaging_send, METH_VARARGS|METH_KEYWORDS, +static PyMethodDef py_imessaging_methods[] = { + { "send", (PyCFunction)py_imessaging_send, METH_VARARGS|METH_KEYWORDS, "S.send(target, msg_type, data) -> None\nSend a message" }, - { "register", (PyCFunction)py_messaging_register, METH_VARARGS|METH_KEYWORDS, + { "register", (PyCFunction)py_imessaging_register, METH_VARARGS|METH_KEYWORDS, "S.register(callback, msg_type=None) -> msg_type\nRegister a message handler" }, - { "deregister", (PyCFunction)py_messaging_deregister, METH_VARARGS|METH_KEYWORDS, + { "deregister", (PyCFunction)py_imessaging_deregister, METH_VARARGS|METH_KEYWORDS, "S.deregister(callback, msg_type) -> None\nDeregister a message handler" }, { NULL, NULL, 0, NULL } }; -static PyObject *py_messaging_server_id(PyObject *obj, void *closure) +static PyObject *py_imessaging_server_id(PyObject *obj, void *closure) { - messaging_Object *iface = (messaging_Object *)obj; - struct server_id server_id = messaging_get_server_id(iface->msg_ctx); + imessaging_Object *iface = (imessaging_Object *)obj; + struct server_id server_id = imessaging_get_server_id(iface->msg_ctx); return Py_BuildValue("(iii)", server_id.pid, server_id.id2, server_id.vnn); } -static PyGetSetDef py_messaging_getset[] = { - { discard_const_p(char, "server_id"), py_messaging_server_id, NULL, +static PyGetSetDef py_imessaging_getset[] = { + { discard_const_p(char, "server_id"), py_imessaging_server_id, NULL, discard_const_p(char, "local server id") }, { NULL }, }; -PyTypeObject messaging_Type = { +PyTypeObject imessaging_Type = { PyObject_HEAD_INIT(NULL) 0, .tp_name = "messaging.Messaging", - .tp_basicsize = sizeof(messaging_Object), + .tp_basicsize = sizeof(imessaging_Object), .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, - .tp_new = py_messaging_connect, - .tp_dealloc = py_messaging_dealloc, - .tp_methods = py_messaging_methods, - .tp_getset = py_messaging_getset, - .tp_doc = "Messaging(own_id=None, messaging_path=None)\n" \ + .tp_new = py_imessaging_connect, + .tp_dealloc = py_imessaging_dealloc, + .tp_methods = py_imessaging_methods, + .tp_getset = py_imessaging_getset, + .tp_doc = "Messaging(own_id=None, imessaging_path=None)\n" \ "Create a new object that can be used to communicate with the peers in the specified messaging path.\n" \ "If no path is specified, the default path from smb.conf will be used." }; @@ -258,13 +258,13 @@ void initmessaging(void) { PyObject *mod; - if (PyType_Ready(&messaging_Type) < 0) + if (PyType_Ready(&imessaging_Type) < 0) return; mod = Py_InitModule3("messaging", NULL, "Internal RPC"); if (mod == NULL) return; - Py_INCREF((PyObject *)&messaging_Type); - PyModule_AddObject(mod, "Messaging", (PyObject *)&messaging_Type); + Py_INCREF((PyObject *)&imessaging_Type); + PyModule_AddObject(mod, "Messaging", (PyObject *)&imessaging_Type); } diff --git a/source4/lib/messaging/tests/irpc.c b/source4/lib/messaging/tests/irpc.c index 4d0b6b4378..cfa2bcb91e 100644 --- a/source4/lib/messaging/tests/irpc.c +++ b/source4/lib/messaging/tests/irpc.c @@ -34,7 +34,7 @@ static bool test_debug; struct irpc_test_data { - struct messaging_context *msg_ctx1, *msg_ctx2; + struct imessaging_context *msg_ctx1, *msg_ctx2; struct tevent_context *ev; }; @@ -246,15 +246,15 @@ static bool irpc_setup(struct torture_context *tctx, void **_data) data->ev = tctx->ev; torture_assert(tctx, data->msg_ctx1 = - messaging_init(tctx, - lpcfg_messaging_path(tctx, tctx->lp_ctx), + imessaging_init(tctx, + lpcfg_imessaging_path(tctx, tctx->lp_ctx), cluster_id(0, MSG_ID1), data->ev), "Failed to init first messaging context"); torture_assert(tctx, data->msg_ctx2 = - messaging_init(tctx, - lpcfg_messaging_path(tctx, tctx->lp_ctx), + imessaging_init(tctx, + lpcfg_imessaging_path(tctx, tctx->lp_ctx), cluster_id(0, MSG_ID2), data->ev), "Failed to init second messaging context"); diff --git a/source4/lib/messaging/tests/messaging.c b/source4/lib/messaging/tests/messaging.c index 82fdf2f73e..38c34fc52e 100644 --- a/source4/lib/messaging/tests/messaging.c +++ b/source4/lib/messaging/tests/messaging.c @@ -29,24 +29,24 @@ static uint32_t msg_pong; -static void ping_message(struct messaging_context *msg, void *private_data, +static void ping_message(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { NTSTATUS status; - status = messaging_send(msg, src, msg_pong, data); + status = imessaging_send(msg, src, msg_pong, data); if (!NT_STATUS_IS_OK(status)) { printf("pong failed - %s\n", nt_errstr(status)); } } -static void pong_message(struct messaging_context *msg, void *private_data, +static void pong_message(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { int *count = (int *)private_data; (*count)++; } -static void exit_message(struct messaging_context *msg, void *private_data, +static void exit_message(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { talloc_free(private_data); @@ -59,8 +59,8 @@ static void exit_message(struct messaging_context *msg, void *private_data, static bool test_ping_speed(struct torture_context *tctx) { struct tevent_context *ev; - struct messaging_context *msg_client_ctx; - struct messaging_context *msg_server_ctx; + struct imessaging_context *msg_client_ctx; + struct imessaging_context *msg_server_ctx; int ping_count = 0; int pong_count = 0; struct timeval tv; @@ -71,24 +71,24 @@ static bool test_ping_speed(struct torture_context *tctx) ev = tctx->ev; - msg_server_ctx = messaging_init(tctx, - lpcfg_messaging_path(tctx, tctx->lp_ctx), cluster_id(0, 1), + msg_server_ctx = imessaging_init(tctx, + lpcfg_imessaging_path(tctx, tctx->lp_ctx), cluster_id(0, 1), ev); torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context"); - messaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping); - messaging_register_tmp(msg_server_ctx, tctx, exit_message, &msg_exit); + imessaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping); + imessaging_register_tmp(msg_server_ctx, tctx, exit_message, &msg_exit); - msg_client_ctx = messaging_init(tctx, - lpcfg_messaging_path(tctx, tctx->lp_ctx), + msg_client_ctx = imessaging_init(tctx, + lpcfg_imessaging_path(tctx, tctx->lp_ctx), cluster_id(0, 2), ev); torture_assert(tctx, msg_client_ctx != NULL, - "msg_client_ctx messaging_init() failed"); + "msg_client_ctx imessaging_init() failed"); - messaging_register_tmp(msg_client_ctx, &pong_count, pong_message, &msg_pong); + imessaging_register_tmp(msg_client_ctx, &pong_count, pong_message, &msg_pong); tv = timeval_current(); @@ -100,8 +100,8 @@ static bool test_ping_speed(struct torture_context *tctx) data.data = discard_const_p(uint8_t, "testing"); data.length = strlen((const char *)data.data); - status1 = messaging_send(msg_client_ctx, cluster_id(0, 1), msg_ping, &data); - status2 = messaging_send(msg_client_ctx, cluster_id(0, 1), msg_ping, NULL); + status1 = imessaging_send(msg_client_ctx, cluster_id(0, 1), msg_ping, &data); + status2 = imessaging_send(msg_client_ctx, cluster_id(0, 1), msg_ping, NULL); torture_assert_ntstatus_ok(tctx, status1, "msg1 failed"); ping_count++; @@ -121,7 +121,7 @@ static bool test_ping_speed(struct torture_context *tctx) } torture_comment(tctx, "sending exit\n"); - messaging_send(msg_client_ctx, cluster_id(0, 1), msg_exit, NULL); + imessaging_send(msg_client_ctx, cluster_id(0, 1), msg_exit, NULL); torture_assert_int_equal(tctx, ping_count, pong_count, "ping test failed"); diff --git a/source4/libcli/finddcs_nbt.c b/source4/libcli/finddcs_nbt.c index 12b94f7bab..9579a9e449 100644 --- a/source4/libcli/finddcs_nbt.c +++ b/source4/libcli/finddcs_nbt.c @@ -33,7 +33,7 @@ struct finddcs_nbt_state { struct tevent_context *ev; struct tevent_req *req; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; const char *my_netbios_name; const char *domain_name; @@ -70,7 +70,7 @@ struct tevent_req *finddcs_nbt_send(TALLOC_CTX *mem_ctx, struct dom_sid *domain_sid, struct resolve_context *resolve_ctx, struct tevent_context *event_ctx, - struct messaging_context *msg_ctx) + struct imessaging_context *msg_ctx) { struct finddcs_nbt_state *state; struct nbt_name name; @@ -295,7 +295,7 @@ NTSTATUS finddcs_nbt(TALLOC_CTX *mem_ctx, struct dom_sid *domain_sid, struct resolve_context *resolve_ctx, struct tevent_context *event_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, int *num_dcs, struct nbt_dc_name **dcs) { struct tevent_req *req = finddcs_nbt_send(mem_ctx, diff --git a/source4/libcli/wbclient/wbclient.c b/source4/libcli/wbclient/wbclient.c index 5c4312cc66..4f50c10694 100644 --- a/source4/libcli/wbclient/wbclient.c +++ b/source4/libcli/wbclient/wbclient.c @@ -31,7 +31,7 @@ * \param */ struct wbc_context *wbc_init(TALLOC_CTX *mem_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, struct tevent_context *event_ctx) { struct wbc_context *ctx; diff --git a/source4/libcli/wbclient/wbclient.h b/source4/libcli/wbclient/wbclient.h index e7473e3e7b..1fa2f59c57 100644 --- a/source4/libcli/wbclient/wbclient.h +++ b/source4/libcli/wbclient/wbclient.h @@ -28,7 +28,7 @@ struct wbc_context { }; struct wbc_context *wbc_init(TALLOC_CTX *mem_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, struct tevent_context *event_ctx); struct composite_context *wbc_sids_to_xids_send(struct wbc_context *wbc_ctx, diff --git a/source4/librpc/rpc/pyrpc_util.c b/source4/librpc/rpc/pyrpc_util.c index 3821638fb3..7784c81cef 100644 --- a/source4/librpc/rpc/pyrpc_util.c +++ b/source4/librpc/rpc/pyrpc_util.c @@ -72,9 +72,9 @@ static NTSTATUS pyrpc_irpc_connect(TALLOC_CTX *mem_ctx, const char *irpc_server, struct loadparm_context *lp_ctx, struct dcerpc_binding_handle **binding_handle) { - struct messaging_context *msg; + struct imessaging_context *msg; - msg = messaging_client_init(mem_ctx, lpcfg_messaging_path(mem_ctx, lp_ctx), event_ctx); + msg = imessaging_client_init(mem_ctx, lpcfg_imessaging_path(mem_ctx, lp_ctx), event_ctx); NT_STATUS_HAVE_NO_MEMORY(msg); *binding_handle = irpc_binding_handle_by_name(mem_ctx, msg, irpc_server, table); diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index 94041d2014..efb70226e6 100644 --- a/source4/ntvfs/common/brlock.c +++ b/source4/ntvfs/common/brlock.c @@ -45,16 +45,16 @@ void brl_set_ops(const struct brlock_ops *new_ops) /* Open up the brlock database. Close it down using talloc_free(). We - need the messaging_ctx to allow for pending lock notifications. + need the imessaging_ctx to allow for pending lock notifications. */ struct brl_context *brl_init(TALLOC_CTX *mem_ctx, struct server_id server, struct loadparm_context *lp_ctx, - struct messaging_context *messaging_ctx) + struct imessaging_context *imessaging_ctx) { if (ops == NULL) { brl_tdb_init_ops(); } - return ops->brl_init(mem_ctx, server, lp_ctx, messaging_ctx); + return ops->brl_init(mem_ctx, server, lp_ctx, imessaging_ctx); } struct brl_handle *brl_create_handle(TALLOC_CTX *mem_ctx, struct ntvfs_handle *ntvfs, DATA_BLOB *file_key) diff --git a/source4/ntvfs/common/brlock.h b/source4/ntvfs/common/brlock.h index e5e618d045..7ae3111cc4 100644 --- a/source4/ntvfs/common/brlock.h +++ b/source4/ntvfs/common/brlock.h @@ -24,7 +24,7 @@ struct brlock_ops { struct brl_context *(*brl_init)(TALLOC_CTX *, struct server_id , struct loadparm_context *lp_ctx, - struct messaging_context *); + struct imessaging_context *); struct brl_handle *(*brl_create_handle)(TALLOC_CTX *, struct ntvfs_handle *, DATA_BLOB *); NTSTATUS (*brl_lock)(struct brl_context *, struct brl_handle *, diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c index 35d4c27d0f..630b4072db 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -48,7 +48,7 @@ struct brl_context { struct tdb_wrap *w; struct server_id server; - struct messaging_context *messaging_ctx; + struct imessaging_context *imessaging_ctx; }; /* @@ -89,12 +89,12 @@ static bool brl_invalid_lock_range(uint64_t start, uint64_t size) /* Open up the brlock.tdb database. Close it down using - talloc_free(). We need the messaging_ctx to allow for + talloc_free(). We need the imessaging_ctx to allow for pending lock notifications. */ static struct brl_context *brl_tdb_init(TALLOC_CTX *mem_ctx, struct server_id server, struct loadparm_context *lp_ctx, - struct messaging_context *messaging_ctx) + struct imessaging_context *imessaging_ctx) { struct brl_context *brl; @@ -110,7 +110,7 @@ static struct brl_context *brl_tdb_init(TALLOC_CTX *mem_ctx, struct server_id se } brl->server = server; - brl->messaging_ctx = messaging_ctx; + brl->imessaging_ctx = imessaging_ctx; return brl; } @@ -419,7 +419,7 @@ static void brl_tdb_notify_unlock(struct brl_context *brl, if (locks[i].lock_type == PENDING_WRITE_LOCK) { last_notice = i; } - messaging_send_ptr(brl->messaging_ctx, locks[i].context.server, + imessaging_send_ptr(brl->imessaging_ctx, locks[i].context.server, MSG_BRL_RETRY, locks[i].notify_ptr); } } diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 0b5f91bfe1..d05f04707a 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -41,7 +41,7 @@ struct notify_context { struct tdb_wrap *w; struct server_id server; - struct messaging_context *messaging_ctx; + struct imessaging_context *imessaging_ctx; struct notify_list *list; struct notify_array *array; int seqnum; @@ -63,7 +63,7 @@ struct notify_list { #define NOTIFY_ENABLE_DEFAULT true static NTSTATUS notify_remove_all(struct notify_context *notify); -static void notify_handler(struct messaging_context *msg_ctx, void *private_data, +static void notify_handler(struct imessaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data); /* @@ -71,18 +71,18 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data */ static int notify_destructor(struct notify_context *notify) { - messaging_deregister(notify->messaging_ctx, MSG_PVFS_NOTIFY, notify); + imessaging_deregister(notify->imessaging_ctx, MSG_PVFS_NOTIFY, notify); notify_remove_all(notify); return 0; } /* Open up the notify.tdb database. You should close it down using - talloc_free(). We need the messaging_ctx to allow for notifications + talloc_free(). We need the imessaging_ctx to allow for notifications via internal messages */ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, - struct messaging_context *messaging_ctx, + struct imessaging_context *imessaging_ctx, struct loadparm_context *lp_ctx, struct tevent_context *ev, struct share_config *scfg) @@ -109,7 +109,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, } notify->server = server; - notify->messaging_ctx = messaging_ctx; + notify->imessaging_ctx = imessaging_ctx; notify->list = NULL; notify->array = NULL; notify->seqnum = tdb_get_seqnum(notify->w->tdb); @@ -118,7 +118,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, /* register with the messaging subsystem for the notify message type */ - messaging_register(notify->messaging_ctx, notify, + imessaging_register(notify->imessaging_ctx, notify, MSG_PVFS_NOTIFY, notify_handler); notify->sys_notify_ctx = sys_notify_context_create(scfg, notify, ev); @@ -247,7 +247,7 @@ static NTSTATUS notify_save(struct notify_context *notify) /* handle incoming notify messages */ -static void notify_handler(struct messaging_context *msg_ctx, void *private_data, +static void notify_handler(struct imessaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data) { struct notify_context *notify = talloc_get_type(private_data, struct notify_context); @@ -563,7 +563,7 @@ static void notify_send(struct notify_context *notify, struct notify_entry *e, return; } - status = messaging_send(notify->messaging_ctx, e->server, + status = imessaging_send(notify->imessaging_ctx, e->server, MSG_PVFS_NOTIFY, &data); talloc_free(tmp_ctx); } diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index 12fe7015a7..29081ef7d6 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -55,7 +55,7 @@ void odb_set_ops(const struct opendb_ops *new_ops) /* Open up the openfiles.tdb database. Close it down using - talloc_free(). We need the messaging_ctx to allow for pending open + talloc_free(). We need the imessaging_ctx to allow for pending open notifications. */ struct odb_context *odb_init(TALLOC_CTX *mem_ctx, diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 881fd5b57a..536d17f9c0 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -74,13 +74,13 @@ struct odb_lock { } can_open; }; -static NTSTATUS odb_oplock_break_send(struct messaging_context *msg_ctx, +static NTSTATUS odb_oplock_break_send(struct imessaging_context *msg_ctx, struct opendb_entry *e, uint8_t level); /* Open up the openfiles.tdb database. Close it down using - talloc_free(). We need the messaging_ctx to allow for pending open + talloc_free(). We need the imessaging_ctx to allow for pending open notifications. */ static struct odb_context *odb_tdb_init(TALLOC_CTX *mem_ctx, @@ -294,7 +294,7 @@ static NTSTATUS odb_push_record(struct odb_lock *lck, struct opendb_file *file) /* send an oplock break to a client */ -static NTSTATUS odb_oplock_break_send(struct messaging_context *msg_ctx, +static NTSTATUS odb_oplock_break_send(struct imessaging_context *msg_ctx, struct opendb_entry *e, uint8_t level) { @@ -311,7 +311,7 @@ static NTSTATUS odb_oplock_break_send(struct messaging_context *msg_ctx, blob = data_blob_const(&op_break, sizeof(op_break)); - status = messaging_send(msg_ctx, e->server, + status = imessaging_send(msg_ctx, e->server, MSG_NTVFS_OPLOCK_BREAK, &blob); NT_STATUS_NOT_OK_RETURN(status); @@ -611,7 +611,7 @@ static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle, /* send any pending notifications, removing them once sent */ for (i=0;ifile.num_pending;i++) { - messaging_send_ptr(odb->ntvfs_ctx->msg_ctx, + imessaging_send_ptr(odb->ntvfs_ctx->msg_ctx, lck->file.pending[i].server, MSG_PVFS_RETRY_OPEN, lck->file.pending[i].notify_ptr); @@ -666,7 +666,7 @@ static NTSTATUS odb_tdb_update_oplock(struct odb_lock *lck, void *file_handle, /* send any pending notifications, removing them once sent */ for (i=0;ifile.num_pending;i++) { - messaging_send_ptr(odb->ntvfs_ctx->msg_ctx, + imessaging_send_ptr(odb->ntvfs_ctx->msg_ctx, lck->file.pending[i].server, MSG_PVFS_RETRY_OPEN, lck->file.pending[i].notify_ptr); diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h index 203b588e08..a31e302dfc 100644 --- a/source4/ntvfs/ntvfs.h +++ b/source4/ntvfs/ntvfs.h @@ -201,7 +201,7 @@ struct ntvfs_context { struct server_id server_id; struct loadparm_context *lp_ctx; struct tevent_context *event_ctx; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct { void *private_data; @@ -330,7 +330,7 @@ struct ntvfs_critical_sizes { .sizeof_ntvfs_handle_data = sizeof(struct ntvfs_handle_data), \ } -struct messaging_context; +struct imessaging_context; #include "librpc/gen_ndr/security.h" #include "librpc/gen_ndr/s4_notify.h" #include "ntvfs/ntvfs_proto.h" diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 1b1a53361b..1a83d27843 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -153,7 +153,7 @@ bool ntvfs_interface_differs(const struct ntvfs_critical_sizes *const iface) NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, enum ntvfs_type type, enum protocol_types protocol, uint64_t ntvfs_client_caps, - struct tevent_context *ev, struct messaging_context *msg, + struct tevent_context *ev, struct imessaging_context *msg, struct loadparm_context *lp_ctx, struct server_id server_id, struct ntvfs_context **_ctx) { diff --git a/source4/ntvfs/posix/pvfs_oplock.c b/source4/ntvfs/posix/pvfs_oplock.c index a10188f3eb..5b9f3a318c 100644 --- a/source4/ntvfs/posix/pvfs_oplock.c +++ b/source4/ntvfs/posix/pvfs_oplock.c @@ -32,7 +32,7 @@ struct pvfs_oplock { uint32_t level; struct timeval break_to_level_II; struct timeval break_to_none; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; }; static NTSTATUS pvfs_oplock_release_internal(struct pvfs_file_handle *h, @@ -158,7 +158,7 @@ static void pvfs_oplock_break(struct pvfs_oplock *opl, uint8_t level) } } -static void pvfs_oplock_break_dispatch(struct messaging_context *msg, +static void pvfs_oplock_break_dispatch(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { @@ -169,7 +169,7 @@ static void pvfs_oplock_break_dispatch(struct messaging_context *msg, ZERO_STRUCT(opb); /* we need to check that this one is for us. See - messaging_send_ptr() for the other side of this. + imessaging_send_ptr() for the other side of this. */ if (data->length == sizeof(struct opendb_oplock_break)) { struct opendb_oplock_break *p; @@ -192,7 +192,7 @@ static void pvfs_oplock_break_dispatch(struct messaging_context *msg, static int pvfs_oplock_destructor(struct pvfs_oplock *opl) { - messaging_deregister(opl->msg_ctx, MSG_NTVFS_OPLOCK_BREAK, opl); + imessaging_deregister(opl->msg_ctx, MSG_NTVFS_OPLOCK_BREAK, opl); return 0; } @@ -228,7 +228,7 @@ NTSTATUS pvfs_setup_oplock(struct pvfs_file *f, uint32_t oplock_granted) opl->level = level; opl->msg_ctx = f->pvfs->ntvfs->ctx->msg_ctx; - status = messaging_register(opl->msg_ctx, + status = imessaging_register(opl->msg_ctx, opl, MSG_NTVFS_OPLOCK_BREAK, pvfs_oplock_break_dispatch); diff --git a/source4/ntvfs/posix/pvfs_wait.c b/source4/ntvfs/posix/pvfs_wait.c index 876ce52797..013de69889 100644 --- a/source4/ntvfs/posix/pvfs_wait.c +++ b/source4/ntvfs/posix/pvfs_wait.c @@ -33,7 +33,7 @@ struct pvfs_wait { void (*handler)(void *, enum pvfs_wait_notice); void *private_data; int msg_type; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct tevent_context *ev; struct ntvfs_request *req; enum pvfs_wait_notice reason; @@ -56,7 +56,7 @@ NTSTATUS pvfs_async_setup(struct ntvfs_module_context *ntvfs, /* receive a completion message for a wait */ -static void pvfs_wait_dispatch(struct messaging_context *msg, +static void pvfs_wait_dispatch(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { @@ -66,7 +66,7 @@ static void pvfs_wait_dispatch(struct messaging_context *msg, void *p = NULL; /* we need to check that this one is for us. See - messaging_send_ptr() for the other side of this. + imessaging_send_ptr() for the other side of this. */ if (data->length == sizeof(void *)) { void **pp; @@ -116,7 +116,7 @@ static void pvfs_wait_timeout(struct tevent_context *ev, static int pvfs_wait_destructor(struct pvfs_wait *pwait) { if (pwait->msg_type != -1) { - messaging_deregister(pwait->msg_ctx, pwait->msg_type, pwait); + imessaging_deregister(pwait->msg_ctx, pwait->msg_type, pwait); } DLIST_REMOVE(pwait->pvfs->wait_list, pwait); return 0; @@ -162,7 +162,7 @@ struct pvfs_wait *pvfs_wait_message(struct pvfs_state *pvfs, /* register with the messaging subsystem for this message type */ if (msg_type != -1) { - messaging_register(pwait->msg_ctx, + imessaging_register(pwait->msg_ctx, pwait, msg_type, pvfs_wait_dispatch); diff --git a/source4/ntvfs/sysdep/sys_lease.c b/source4/ntvfs/sysdep/sys_lease.c index 8b0b3a5110..7865f717a4 100644 --- a/source4/ntvfs/sysdep/sys_lease.c +++ b/source4/ntvfs/sysdep/sys_lease.c @@ -40,7 +40,7 @@ static uint32_t num_backends; _PUBLIC_ struct sys_lease_context *sys_lease_context_create(struct share_config *scfg, TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct messaging_context *msg, + struct imessaging_context *msg, sys_lease_send_break_fn break_send) { struct sys_lease_context *ctx; diff --git a/source4/ntvfs/sysdep/sys_lease.h b/source4/ntvfs/sysdep/sys_lease.h index 422797b0b8..57a5e0a35f 100644 --- a/source4/ntvfs/sysdep/sys_lease.h +++ b/source4/ntvfs/sysdep/sys_lease.h @@ -21,10 +21,10 @@ struct sys_lease_context; struct opendb_entry; -struct messaging_context; +struct imessaging_context; struct tevent_context; -typedef NTSTATUS (*sys_lease_send_break_fn)(struct messaging_context *, +typedef NTSTATUS (*sys_lease_send_break_fn)(struct imessaging_context *, struct opendb_entry *, uint8_t level); @@ -41,7 +41,7 @@ struct sys_lease_ops { struct sys_lease_context { struct tevent_context *event_ctx; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; sys_lease_send_break_fn break_send; void *private_data; /* for use of backend */ const struct sys_lease_ops *ops; @@ -53,7 +53,7 @@ NTSTATUS sys_lease_init(void); struct sys_lease_context *sys_lease_context_create(struct share_config *scfg, TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, sys_lease_send_break_fn break_send); NTSTATUS sys_lease_setup(struct sys_lease_context *ctx, diff --git a/source4/param/param.h b/source4/param/param.h index 43077f395b..0f06260e1c 100644 --- a/source4/param/param.h +++ b/source4/param/param.h @@ -332,7 +332,7 @@ bool run_init_functions(init_module_fn *fns); * Will return an array of function pointers to initialization functions */ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *subsystem); -const char *lpcfg_messaging_path(TALLOC_CTX *mem_ctx, +const char *lpcfg_imessaging_path(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx); struct smb_iconv_handle *smb_iconv_handle_reinit_lp(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, diff --git a/source4/param/util.c b/source4/param/util.c index 92bb8b3e17..bcec2bec33 100644 --- a/source4/param/util.c +++ b/source4/param/util.c @@ -292,7 +292,7 @@ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, struct loadparm_context return ret; } -const char *lpcfg_messaging_path(TALLOC_CTX *mem_ctx, +const char *lpcfg_imessaging_path(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) { return smbd_tmp_path(mem_ctx, lp_ctx, "msg"); diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index cd079da5c9..580503d093 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -366,7 +366,7 @@ _PUBLIC_ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint *ep, struct auth_session_info *session_info, struct tevent_context *event_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, struct server_id server_id, uint32_t state_flags, struct dcesrv_connection **_p) diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 024009ab70..069ba6bb5d 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -111,7 +111,7 @@ struct dcesrv_call_state { struct tevent_context *event_ctx; /* the message_context that will be used for async replies */ - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; /* this is the pointer to the allocated function struct */ void *r; @@ -200,7 +200,7 @@ struct dcesrv_connection { struct tevent_context *event_ctx; /* the message_context that will be used for this connection */ - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; /* the server_id that will be used for this connection */ struct server_id server_id; @@ -319,7 +319,7 @@ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint *ep, struct auth_session_info *session_info, struct tevent_context *event_ctx, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, struct server_id server_id, uint32_t state_flags, struct dcesrv_connection **_p); diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 0f2f1bb1bb..81dd78701e 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -221,11 +221,11 @@ static NTSTATUS samba_terminate(struct irpc_message *msg, static NTSTATUS setup_parent_messaging(struct tevent_context *event_ctx, struct loadparm_context *lp_ctx) { - struct messaging_context *msg; + struct imessaging_context *msg; NTSTATUS status; - msg = messaging_init(talloc_autofree_context(), - lpcfg_messaging_path(event_ctx, lp_ctx), + msg = imessaging_init(talloc_autofree_context(), + lpcfg_imessaging_path(event_ctx, lp_ctx), cluster_id(0, SAMBA_PARENT_TASKID), event_ctx); NT_STATUS_HAVE_NO_MEMORY(msg); diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index 916393253b..a0e440f63c 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -122,7 +122,7 @@ NTSTATUS stream_new_connection_merge(struct tevent_context *ev, struct loadparm_context *lp_ctx, const struct model_ops *model_ops, const struct stream_server_ops *stream_ops, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, void *private_data, struct stream_connection **_srv_conn) { @@ -186,11 +186,11 @@ static void stream_new_connection(struct tevent_context *ev, } /* setup to receive internal messages on this connection */ - srv_conn->msg_ctx = messaging_init(srv_conn, - lpcfg_messaging_path(srv_conn, lp_ctx), + srv_conn->msg_ctx = imessaging_init(srv_conn, + lpcfg_imessaging_path(srv_conn, lp_ctx), srv_conn->server_id, ev); if (!srv_conn->msg_ctx) { - stream_terminate_connection(srv_conn, "messaging_init() failed"); + stream_terminate_connection(srv_conn, "imessaging_init() failed"); return; } diff --git a/source4/smbd/service_stream.h b/source4/smbd/service_stream.h index 02ade716d2..6590bc0ea0 100644 --- a/source4/smbd/service_stream.h +++ b/source4/smbd/service_stream.h @@ -47,7 +47,7 @@ struct stream_connection { } event; struct socket_context *socket; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct loadparm_context *lp_ctx; struct tstream_context *tstream; diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c index 1eb8403e3b..32c44cf660 100644 --- a/source4/smbd/service_task.c +++ b/source4/smbd/service_task.c @@ -78,12 +78,12 @@ static void task_server_callback(struct tevent_context *event_ctx, task->server_id = server_id; task->lp_ctx = lp_ctx; - task->msg_ctx = messaging_init(task, - lpcfg_messaging_path(task, task->lp_ctx), + task->msg_ctx = imessaging_init(task, + lpcfg_imessaging_path(task, task->lp_ctx), task->server_id, task->event_ctx); if (!task->msg_ctx) { - task_server_terminate(task, "messaging_init() failed", true); + task_server_terminate(task, "imessaging_init() failed", true); return; } diff --git a/source4/smbd/service_task.h b/source4/smbd/service_task.h index b8954073e5..34b41d9f04 100644 --- a/source4/smbd/service_task.h +++ b/source4/smbd/service_task.h @@ -27,7 +27,7 @@ struct task_server { struct tevent_context *event_ctx; const struct model_ops *model_ops; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct loadparm_context *lp_ctx; struct server_id server_id; void *private_data; diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index a3701f8822..f905089248 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -366,7 +366,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, }; struct gensec_ntlm_state *state; struct tevent_context *ev; - struct messaging_context *msg; + struct imessaging_context *msg; NTSTATUS nt_status; bool first = false; @@ -463,7 +463,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, const char *winbind_method[] = { "winbind", NULL }; struct auth_context *auth_context; - msg = messaging_client_init(state, lpcfg_messaging_path(state, lp_ctx), ev); + msg = imessaging_client_init(state, lpcfg_imessaging_path(state, lp_ctx), ev); if (!msg) { talloc_free(mem_ctx); exit(1); diff --git a/source4/wrepl_server/wrepl_scavenging.c b/source4/wrepl_server/wrepl_scavenging.c index 18d4780c0b..d04064970c 100644 --- a/source4/wrepl_server/wrepl_scavenging.c +++ b/source4/wrepl_server/wrepl_scavenging.c @@ -306,7 +306,7 @@ static NTSTATUS wreplsrv_scavenging_replica_non_active_records(struct wreplsrv_s } struct verify_state { - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct wreplsrv_service *service; struct winsdb_record *rec; struct nbtd_proxy_wins_challenge r; -- cgit