libcli/nbt: move nbt_name_register_bcast_send to the top of nbt_name_register_bcast_*
authorStefan Metzmacher <metze@samba.org>
Mon, 11 Oct 2010 18:57:58 +0000 (20:57 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Oct 2010 15:36:16 +0000 (15:36 +0000)
metze

libcli/nbt/nameregister.c

index 4d307d9564b01d40442e8c5342ca6abe54aac3bd..82bc3d2c9272a25a688899fc2363b9a52a72a06e 100644 (file)
@@ -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
@@ -206,55 +257,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
 */