summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-17 18:15:24 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-19 07:05:27 +0100
commit26c48098e6c387cc76b123a78d50f23518d734cf (patch)
tree19c0c0060de0dcbec8f4cbb50d6f625f7d112116 /libcli
parentc97df0d892d71462dfd631cf5e93f04641afaab3 (diff)
downloadsamba-26c48098e6c387cc76b123a78d50f23518d734cf.tar.gz
samba-26c48098e6c387cc76b123a78d50f23518d734cf.tar.bz2
samba-26c48098e6c387cc76b123a78d50f23518d734cf.zip
libcli/nbt: add nbt_set_unexpected_handler()
metze (from samba4wins tree 74232901d1e7ea9ebcb3bd8d584dda36fac37223)
Diffstat (limited to 'libcli')
-rw-r--r--libcli/nbt/libnbt.h4
-rw-r--r--libcli/nbt/nbtsocket.c13
2 files changed, 17 insertions, 0 deletions
diff --git a/libcli/nbt/libnbt.h b/libcli/nbt/libnbt.h
index f5191656ed..87183c2c13 100644
--- a/libcli/nbt/libnbt.h
+++ b/libcli/nbt/libnbt.h
@@ -324,6 +324,10 @@ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
struct socket_address *),
void *private_data);
+NTSTATUS nbt_set_unexpected_handler(struct nbt_name_socket *nbtsock,
+ void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
+ struct socket_address *),
+ void *private);
NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
struct socket_address *dest,
struct nbt_name_packet *request);
diff --git a/libcli/nbt/nbtsocket.c b/libcli/nbt/nbtsocket.c
index 68c5d89db6..4816b816fe 100644
--- a/libcli/nbt/nbtsocket.c
+++ b/libcli/nbt/nbtsocket.c
@@ -509,6 +509,19 @@ _PUBLIC_ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
return NT_STATUS_OK;
}
+/*
+ setup a handler for unexpected requests
+*/
+NTSTATUS nbt_set_unexpected_handler(struct nbt_name_socket *nbtsock,
+ void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
+ struct socket_address *),
+ void *private)
+{
+ nbtsock->unexpected.handler = handler;
+ nbtsock->unexpected.private_data = private;
+ EVENT_FD_READABLE(nbtsock->fde);
+ return NT_STATUS_OK;
+}
/*
turn a NBT rcode into a NTSTATUS