diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-10 08:41:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:31 -0500 |
commit | c7304b3ab8396ffd1eb54a09cc730ea975ad488c (patch) | |
tree | 67e9be611368de386cac4f3a798513c5fe9e9b9c /source4/nbt_server | |
parent | 056096c30ba73cbc5304c99af5d5a08d89111aab (diff) | |
download | samba-c7304b3ab8396ffd1eb54a09cc730ea975ad488c.tar.gz samba-c7304b3ab8396ffd1eb54a09cc730ea975ad488c.tar.bz2 samba-c7304b3ab8396ffd1eb54a09cc730ea975ad488c.zip |
r8285: generate some real stats in the nbt server for the irpc client code to look at
(This used to be commit 73643884a3c76de5a738a28054a168fdb008a9f8)
Diffstat (limited to 'source4/nbt_server')
-rw-r--r-- | source4/nbt_server/interfaces.c | 9 | ||||
-rw-r--r-- | source4/nbt_server/nodestatus.c | 2 | ||||
-rw-r--r-- | source4/nbt_server/packet.c | 20 | ||||
-rw-r--r-- | source4/nbt_server/register.c | 4 |
4 files changed, 35 insertions, 0 deletions
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c index b77e692e10..aa22e5d4ad 100644 --- a/source4/nbt_server/interfaces.c +++ b/source4/nbt_server/interfaces.c @@ -34,6 +34,12 @@ static void nbtd_request_handler(struct nbt_name_socket *nbtsock, struct nbt_name_packet *packet, const char *src_address, int src_port) { + struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, + struct nbtd_interface); + struct nbtd_server *nbtsrv = iface->nbtsrv; + + nbtsrv->stats.total_received++; + /* see if its from one of our own interfaces - if so, then ignore it */ if (nbtd_self_packet(nbtsock, packet, src_address, src_port)) { DEBUG(10,("Ignoring self packet from %s:%d\n", src_address, src_port)); @@ -42,17 +48,20 @@ static void nbtd_request_handler(struct nbt_name_socket *nbtsock, switch (packet->operation & NBT_OPCODE) { case NBT_OPCODE_QUERY: + nbtsrv->stats.query_count++; nbtd_request_query(nbtsock, packet, src_address, src_port); break; case NBT_OPCODE_REGISTER: case NBT_OPCODE_REFRESH: case NBT_OPCODE_REFRESH2: + nbtsrv->stats.register_count++; nbtd_request_defense(nbtsock, packet, src_address, src_port); break; case NBT_OPCODE_RELEASE: case NBT_OPCODE_MULTI_HOME_REG: + nbtsrv->stats.release_count++; nbtd_winsserver_request(nbtsock, packet, src_address, src_port); break; diff --git a/source4/nbt_server/nodestatus.c b/source4/nbt_server/nodestatus.c index 7f8e6d4a24..daae7b8a78 100644 --- a/source4/nbt_server/nodestatus.c +++ b/source4/nbt_server/nodestatus.c @@ -37,6 +37,7 @@ static void nbtd_node_status_reply(struct nbt_name_socket *nbtsock, struct nbt_name_packet *packet; uint32_t name_count; struct nbtd_iface_name *iname; + struct nbtd_server *nbtsrv = iface->nbtsrv; /* work out how many names to send */ name_count = 0; @@ -85,6 +86,7 @@ static void nbtd_node_status_reply(struct nbt_name_socket *nbtsock, DEBUG(7,("Sending node status reply for %s to %s:%d\n", nbt_name_string(packet, name), src_address, src_port)); + nbtsrv->stats.total_sent++; nbt_name_reply_send(nbtsock, src_address, src_port, packet); failed: diff --git a/source4/nbt_server/packet.c b/source4/nbt_server/packet.c index 6e14fef06c..c1e0c4411b 100644 --- a/source4/nbt_server/packet.c +++ b/source4/nbt_server/packet.c @@ -89,6 +89,9 @@ void nbtd_name_query_reply(struct nbt_name_socket *nbtsock, { struct nbt_name_packet *packet; size_t num_addresses = str_list_length(addresses); + struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, + struct nbtd_interface); + struct nbtd_server *nbtsrv = iface->nbtsrv; int i; if (num_addresses == 0) { @@ -131,6 +134,7 @@ void nbtd_name_query_reply(struct nbt_name_socket *nbtsock, DEBUG(7,("Sending name query reply for %s at %s to %s:%d\n", nbt_name_string(packet, name), addresses[0], src_address, src_port)); + nbtsrv->stats.total_sent++; nbt_name_reply_send(nbtsock, src_address, src_port, packet); failed: @@ -147,6 +151,9 @@ void nbtd_negative_name_query_reply(struct nbt_name_socket *nbtsock, { struct nbt_name_packet *packet; struct nbt_name *name = &request_packet->questions[0].name; + struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, + struct nbtd_interface); + struct nbtd_server *nbtsrv = iface->nbtsrv; packet = talloc_zero(nbtsock, struct nbt_name_packet); if (packet == NULL) return; @@ -171,6 +178,7 @@ void nbtd_negative_name_query_reply(struct nbt_name_socket *nbtsock, DEBUG(7,("Sending negative name query reply for %s to %s:%d\n", nbt_name_string(packet, name), src_address, src_port)); + nbtsrv->stats.total_sent++; nbt_name_reply_send(nbtsock, src_address, src_port, packet); failed: @@ -187,6 +195,9 @@ void nbtd_name_registration_reply(struct nbt_name_socket *nbtsock, { struct nbt_name_packet *packet; struct nbt_name *name = &request_packet->questions[0].name; + struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, + struct nbtd_interface); + struct nbtd_server *nbtsrv = iface->nbtsrv; packet = talloc_zero(nbtsock, struct nbt_name_packet); if (packet == NULL) return; @@ -214,6 +225,7 @@ void nbtd_name_registration_reply(struct nbt_name_socket *nbtsock, rcode==0?"positive":"negative", nbt_name_string(packet, name), src_address, src_port)); + nbtsrv->stats.total_sent++; nbt_name_reply_send(nbtsock, src_address, src_port, packet); failed: @@ -231,6 +243,9 @@ void nbtd_name_release_reply(struct nbt_name_socket *nbtsock, { struct nbt_name_packet *packet; struct nbt_name *name = &request_packet->questions[0].name; + struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, + struct nbtd_interface); + struct nbtd_server *nbtsrv = iface->nbtsrv; packet = talloc_zero(nbtsock, struct nbt_name_packet); if (packet == NULL) return; @@ -256,6 +271,7 @@ void nbtd_name_release_reply(struct nbt_name_socket *nbtsock, rcode==0?"positive":"negative", nbt_name_string(packet, name), src_address, src_port)); + nbtsrv->stats.total_sent++; nbt_name_reply_send(nbtsock, src_address, src_port, packet); failed: @@ -273,6 +289,9 @@ void nbtd_wack_reply(struct nbt_name_socket *nbtsock, { struct nbt_name_packet *packet; struct nbt_name *name = &request_packet->questions[0].name; + struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, + struct nbtd_interface); + struct nbtd_server *nbtsrv = iface->nbtsrv; packet = talloc_zero(nbtsock, struct nbt_name_packet); if (packet == NULL) return; @@ -299,6 +318,7 @@ void nbtd_wack_reply(struct nbt_name_socket *nbtsock, DEBUG(7,("Sending WACK reply for %s to %s:%d\n", nbt_name_string(packet, name), src_address, src_port)); + nbtsrv->stats.total_sent++; nbt_name_reply_send(nbtsock, src_address, src_port, packet); failed: diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c index cd39ef4769..0d0526b94e 100644 --- a/source4/nbt_server/register.c +++ b/source4/nbt_server/register.c @@ -83,6 +83,7 @@ static void name_refresh_handler(struct event_context *ev, struct timed_event *t struct nbtd_interface *iface = iname->iface; struct nbt_name_register io; struct nbt_name_request *req; + struct nbtd_server *nbtsrv = iface->nbtsrv; /* setup a single name register request. Notice that we don't use a name refresh request, as Windows and Samba3 do not @@ -100,6 +101,7 @@ static void name_refresh_handler(struct event_context *ev, struct timed_event *t io.in.timeout = 3; io.in.retries = 0; + nbtsrv->stats.total_sent++; req = nbt_name_register_send(iface->nbtsock, &io); if (req == NULL) return; @@ -169,6 +171,7 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface, const char *scope = lp_netbios_scope(); struct nbt_name_register_bcast io; struct composite_context *req; + struct nbtd_server *nbtsrv = iface->nbtsrv; iname = talloc(iface, struct nbtd_iface_name); if (!iname) return; @@ -209,6 +212,7 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface, io.in.nb_flags = nb_flags; io.in.ttl = iname->ttl; + nbtsrv->stats.total_sent++; req = nbt_name_register_bcast_send(iface->nbtsock, &io); if (req == NULL) return; |