diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-10-11 20:57:58 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-10-18 15:36:16 +0000 |
commit | 77d82fe944fa1f02c150cc2e0967cca654cd4dae (patch) | |
tree | 68304f5729cad515b63e0c4583ee72eecfb69463 /libcli/nbt | |
parent | 6f2d94b960bb6d23ff8932eff2b44722cf335280 (diff) | |
download | samba-77d82fe944fa1f02c150cc2e0967cca654cd4dae.tar.gz |
libcli/nbt: move nbt_name_register_bcast_send to the top of nbt_name_register_bcast_*
metze
Diffstat (limited to 'libcli/nbt')
-rw-r--r-- | libcli/nbt/nameregister.c | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/libcli/nbt/nameregister.c b/libcli/nbt/nameregister.c index 4d307d9564b..82bc3d2c927 100644 --- a/libcli/nbt/nameregister.c +++ b/libcli/nbt/nameregister.c @@ -156,6 +156,57 @@ struct register_bcast_state { struct nbt_name_request *req; }; +static void name_register_bcast_handler(struct nbt_name_request *req); + +/* + the async send call for a 4 stage name registration +*/ +_PUBLIC_ struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock, + struct nbt_name_register_bcast *io) +{ + struct composite_context *c; + struct register_bcast_state *state; + + c = talloc_zero(nbtsock, struct composite_context); + if (c == NULL) goto failed; + + state = talloc(c, struct register_bcast_state); + if (state == NULL) goto failed; + + state->io = talloc(state, struct nbt_name_register); + if (state->io == NULL) goto failed; + + state->io->in.name = io->in.name; + state->io->in.dest_addr = io->in.dest_addr; + state->io->in.dest_port = io->in.dest_port; + state->io->in.address = io->in.address; + state->io->in.nb_flags = io->in.nb_flags; + state->io->in.register_demand = false; + state->io->in.broadcast = true; + state->io->in.multi_homed = false; + state->io->in.ttl = io->in.ttl; + state->io->in.timeout = 1; + state->io->in.retries = 2; + + state->nbtsock = nbtsock; + + state->req = nbt_name_register_send(nbtsock, state->io); + if (state->req == NULL) goto failed; + + state->req->async.fn = name_register_bcast_handler; + state->req->async.private_data = c; + + c->private_data = state; + c->state = COMPOSITE_STATE_IN_PROGRESS; + c->event_ctx = nbtsock->event_ctx; + + return c; + +failed: + talloc_free(c); + return NULL; +} + /* state handler for 4 stage name registration @@ -207,55 +258,6 @@ done: } /* - the async send call for a 4 stage name registration -*/ -_PUBLIC_ struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock, - struct nbt_name_register_bcast *io) -{ - struct composite_context *c; - struct register_bcast_state *state; - - c = talloc_zero(nbtsock, struct composite_context); - if (c == NULL) goto failed; - - state = talloc(c, struct register_bcast_state); - if (state == NULL) goto failed; - - state->io = talloc(state, struct nbt_name_register); - if (state->io == NULL) goto failed; - - state->io->in.name = io->in.name; - state->io->in.dest_addr = io->in.dest_addr; - state->io->in.dest_port = io->in.dest_port; - state->io->in.address = io->in.address; - state->io->in.nb_flags = io->in.nb_flags; - state->io->in.register_demand = false; - state->io->in.broadcast = true; - state->io->in.multi_homed = false; - state->io->in.ttl = io->in.ttl; - state->io->in.timeout = 1; - state->io->in.retries = 2; - - state->nbtsock = nbtsock; - - state->req = nbt_name_register_send(nbtsock, state->io); - if (state->req == NULL) goto failed; - - state->req->async.fn = name_register_bcast_handler; - state->req->async.private_data = c; - - c->private_data = state; - c->state = COMPOSITE_STATE_IN_PROGRESS; - c->event_ctx = nbtsock->event_ctx; - - return c; - -failed: - talloc_free(c); - return NULL; -} - -/* broadcast 4 part name register - recv */ _PUBLIC_ NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c) |