From ab4d635b92b116b02b88843b4ec4f5b7517bab1a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 26 Sep 2005 11:47:55 +0000 Subject: r10504: - seperate implementation specific stuff, from the generic composite stuff. - don't use SMBCLI_REQUEST_* state's in the genreic composite stuff - move monitor_fn to libnet. NOTE: I have maybe found some bugs, in code that is dirrectly in DONE or ERROR state in the _send() function. I haven't fixed this bugs in this commit! We may need some composite_trigger_*() functions or so. And maybe some other generic helper functions... metze (This used to be commit 4527815a0a9b96e460f301cb1f0c0b3964c166fc) --- source4/nbt_server/register.c | 21 ++++++++++----------- source4/nbt_server/wins/winsclient.c | 21 ++++++++++----------- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'source4/nbt_server') diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c index 0d0526b94e..4ff95b8887 100644 --- a/source4/nbt_server/register.c +++ b/source4/nbt_server/register.c @@ -25,7 +25,6 @@ #include "dlinklist.h" #include "nbt_server/nbt_server.h" #include "smbd/service_task.h" -#include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" #include "librpc/gen_ndr/ndr_samr.h" @@ -77,9 +76,9 @@ static void refresh_completion_handler(struct nbt_name_request *req) handle name refresh timer events */ static void name_refresh_handler(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct nbtd_iface_name *iname = talloc_get_type(private, struct nbtd_iface_name); + struct nbtd_iface_name *iname = talloc_get_type(private_data, struct nbtd_iface_name); struct nbtd_interface *iface = iname->iface; struct nbt_name_register io; struct nbt_name_request *req; @@ -130,14 +129,14 @@ static void nbtd_start_refresh_timer(struct nbtd_iface_name *iname) /* a name registration has completed */ -static void nbtd_register_handler(struct composite_context *req) +static void nbtd_register_handler(struct composite_context *creq) { - struct nbtd_iface_name *iname = talloc_get_type(req->async.private, + struct nbtd_iface_name *iname = talloc_get_type(creq->async.private_data, struct nbtd_iface_name); NTSTATUS status; TALLOC_CTX *tmp_ctx = talloc_new(iname); - status = nbt_name_register_bcast_recv(req); + status = nbt_name_register_bcast_recv(creq); if (NT_STATUS_IS_OK(status)) { /* good - nobody complained about our registration */ iname->nb_flags |= NBT_NM_ACTIVE; @@ -170,7 +169,7 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface, struct nbtd_iface_name *iname; const char *scope = lp_netbios_scope(); struct nbt_name_register_bcast io; - struct composite_context *req; + struct composite_context *creq; struct nbtd_server *nbtsrv = iface->nbtsrv; iname = talloc(iface, struct nbtd_iface_name); @@ -213,11 +212,11 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface, io.in.ttl = iname->ttl; nbtsrv->stats.total_sent++; - req = nbt_name_register_bcast_send(iface->nbtsock, &io); - if (req == NULL) return; + creq = nbt_name_register_bcast_send(iface->nbtsock, &io); + if (creq == NULL) return; - req->async.fn = nbtd_register_handler; - req->async.private = iname; + creq->async.fn = nbtd_register_handler; + creq->async.private_data = iname; } diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index cfb68a3aaf..fdfdc8f0ed 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -22,7 +22,6 @@ #include "includes.h" #include "nbt_server/nbt_server.h" -#include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" #include "lib/events/events.h" #include "smbd/service_task.h" @@ -38,15 +37,15 @@ static struct nbt_name_socket *wins_socket(struct nbtd_interface *iface) static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private); + struct timeval t, void *private_data); /* retry a WINS name registration */ static void nbtd_wins_register_retry(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct nbtd_iface_name *iname = talloc_get_type(private, struct nbtd_iface_name); + struct nbtd_iface_name *iname = talloc_get_type(private_data, struct nbtd_iface_name); nbtd_winsclient_register(iname); } @@ -58,7 +57,7 @@ static void nbtd_wins_refresh_handler(struct composite_context *c) { NTSTATUS status; struct nbt_name_refresh_wins io; - struct nbtd_iface_name *iname = talloc_get_type(c->async.private, + struct nbtd_iface_name *iname = talloc_get_type(c->async.private_data, struct nbtd_iface_name); TALLOC_CTX *tmp_ctx = talloc_new(iname); @@ -78,7 +77,7 @@ static void nbtd_wins_refresh_handler(struct composite_context *c) nbt_name_string(tmp_ctx, &iname->name), nt_errstr(status))); talloc_free(tmp_ctx); return; - } + } if (io.out.rcode != 0) { DEBUG(1,("WINS server %s rejected name refresh of %s - %s\n", @@ -113,9 +112,9 @@ static void nbtd_wins_refresh_handler(struct composite_context *c) refresh a WINS name registration */ static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct nbtd_iface_name *iname = talloc_get_type(private, struct nbtd_iface_name); + struct nbtd_iface_name *iname = talloc_get_type(private_data, struct nbtd_iface_name); struct nbtd_interface *iface = iname->iface; struct nbt_name_refresh_wins io; struct composite_context *c; @@ -136,7 +135,7 @@ static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, talloc_steal(c, io.in.addresses); c->async.fn = nbtd_wins_refresh_handler; - c->async.private = iname; + c->async.private_data = iname; talloc_free(tmp_ctx); } @@ -149,7 +148,7 @@ static void nbtd_wins_register_handler(struct composite_context *c) { NTSTATUS status; struct nbt_name_register_wins io; - struct nbtd_iface_name *iname = talloc_get_type(c->async.private, + struct nbtd_iface_name *iname = talloc_get_type(c->async.private_data, struct nbtd_iface_name); TALLOC_CTX *tmp_ctx = talloc_new(iname); @@ -227,5 +226,5 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname) talloc_steal(c, io.in.addresses); c->async.fn = nbtd_wins_register_handler; - c->async.private = iname; + c->async.private_data = iname; } -- cgit