From 26c48098e6c387cc76b123a78d50f23518d734cf Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 17 Jan 2009 18:15:24 +0100 Subject: [PATCH] libcli/nbt: add nbt_set_unexpected_handler() metze (from samba4wins tree 74232901d1e7ea9ebcb3bd8d584dda36fac37223) --- libcli/nbt/libnbt.h | 4 ++++ libcli/nbt/nbtsocket.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/libcli/nbt/libnbt.h b/libcli/nbt/libnbt.h index f5191656ed4..87183c2c13d 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 68c5d89db67..4816b816fe2 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 -- 2.34.1