summaryrefslogtreecommitdiff
path: root/libcli/nbt
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-10-11 20:57:58 +0200
committerStefan Metzmacher <metze@samba.org>2010-10-18 15:36:16 +0000
commit77d82fe944fa1f02c150cc2e0967cca654cd4dae (patch)
tree68304f5729cad515b63e0c4583ee72eecfb69463 /libcli/nbt
parent6f2d94b960bb6d23ff8932eff2b44722cf335280 (diff)
downloadsamba-77d82fe944fa1f02c150cc2e0967cca654cd4dae.tar.gz
samba-77d82fe944fa1f02c150cc2e0967cca654cd4dae.tar.bz2
samba-77d82fe944fa1f02c150cc2e0967cca654cd4dae.zip
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.c100
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)