summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-06-21 20:22:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:40 -0500
commitcc98a92bb0396845ec1dcb75ac412df9db9652d9 (patch)
tree0f11a92a8139db40f5f14dcf0c3387b5b107a26e /source4/libnet
parent49417aaed7a9e2cc841cad2f418f7f84765cce36 (diff)
downloadsamba-cc98a92bb0396845ec1dcb75ac412df9db9652d9.tar.gz
samba-cc98a92bb0396845ec1dcb75ac412df9db9652d9.tar.bz2
samba-cc98a92bb0396845ec1dcb75ac412df9db9652d9.zip
r7816: Implementation of "shortcut" function for those (probably many) who
don't like to bother with netbios type names when looking for common types: hosts (servers) and domain controllers. Also, apropriate tests rafal (This used to be commit 50cd94be0f876a3463aa58b7e0898e6b3340c4c2)
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/libnet_lookup.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c
index c517213652..8892ae0e49 100644
--- a/source4/libnet/libnet_lookup.c
+++ b/source4/libnet/libnet_lookup.c
@@ -39,6 +39,12 @@ struct lookup_state {
};
+/**
+ * Sends asynchronous Lookup request
+ *
+ * @param io arguments and result of the call
+ */
+
struct composite_context *libnet_Lookup_send(struct libnet_Lookup *io)
{
struct composite_context *c;
@@ -77,6 +83,15 @@ failed:
}
+/**
+ * Waits for and receives results of asynchronous Lookup call
+ *
+ * @param c composite context returned by asynchronous Lookup call
+ * @param mem_ctx memory context of the call
+ * @param io pointer to results (and arguments) of the call
+ * @return nt status code of execution
+ */
+
NTSTATUS libnet_Lookup_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
struct libnet_Lookup *io)
{
@@ -90,8 +105,63 @@ NTSTATUS libnet_Lookup_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
}
+/**
+ * Synchronous version of Lookup call
+ *
+ * @param mem_ctx memory context for the call
+ * @param io arguments and results of the call
+ * @return nt status code of execution
+ */
+
NTSTATUS libnet_Lookup(TALLOC_CTX *mem_ctx, struct libnet_Lookup *io)
{
struct composite_context *c = libnet_Lookup_send(io);
return libnet_Lookup_recv(c, mem_ctx, io);
}
+
+
+/*
+ * Shortcut functions to find common types of name
+ * (and skip nbt name type argument)
+ */
+
+
+/**
+ * Sends asynchronous LookupHost request
+ */
+struct composite_context* libnet_LookupHost_send(struct libnet_Lookup *io)
+{
+ io->in.type = NBT_NAME_SERVER;
+ return libnet_Lookup_send(io);
+}
+
+
+
+/**
+ * Synchronous version of LookupHost call
+ */
+NTSTATUS libnet_LookupHost(TALLOC_CTX *mem_ctx, struct libnet_Lookup *io)
+{
+ struct composite_context *c = libnet_LookupHost_send(io);
+ return libnet_Lookup_recv(c, mem_ctx, io);
+}
+
+
+/**
+ * Sends asynchronous LookupPdc request
+ */
+struct composite_context* libnet_LookupPdc_send(struct libnet_Lookup *io)
+{
+ io->in.type = NBT_NAME_PDC;
+ return libnet_Lookup_send(io);
+}
+
+
+/**
+ * Synchronous version of LookupPdc
+ */
+NTSTATUS libnet_LookupPdc(TALLOC_CTX *mem_ctx, struct libnet_Lookup *io)
+{
+ struct composite_context *c = libnet_LookupPdc_send(io);
+ return libnet_Lookup_recv(c, mem_ctx, io);
+}