1
0
mirror of https://github.com/samba-team/samba.git synced 2025-06-03 17:05:54 +03:00

r8285: generate some real stats in the nbt server for the irpc client code to look at

(This used to be commit 73643884a3c76de5a738a28054a168fdb008a9f8)
This commit is contained in:
Andrew Tridgell 2005-07-10 08:41:02 +00:00 committed by Gerald (Jerry) Carter
parent 056096c30b
commit c7304b3ab8
4 changed files with 35 additions and 0 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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:

View File

@ -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;