diff options
| -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 4d307d9564..82bc3d2c92 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)  | 
