2 Unix SMB/CIFS implementation.
4 count number of calls on an interface
6 Copyright (C) Andrew Tridgell 2003
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 BOOL torture_rpc_countcalls(void)
28 const struct dcerpc_interface_table *iface;
30 struct dcerpc_pipe *p;
32 const char *iface_name;
33 DATA_BLOB stub_in, stub_out;
35 iface_name = lp_parm_string(-1, "countcalls", "interface");
36 if (iface_name == NULL) {
37 printf("You must specify an interface name with countcalls:interface\n");
41 iface = idl_iface_by_name(iface_name);
43 printf("Unknown interface '%s'\n", iface_name);
47 status = torture_rpc_connection(&p, iface->endpoints->names[0],
48 iface->uuid, iface->if_version);
49 if (!NT_STATUS_IS_OK(status)) {
50 printf("Failed to open '%s' - %s\n", iface->name, nt_errstr(status));
54 stub_in = data_blob_talloc(p, NULL, 0);
56 printf("\nScanning pipe '%s'\n", iface->name);
58 for (i=0;i<5000;i++) {
59 status = dcerpc_request(p, i, p, &stub_in, &stub_out);
60 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT) &&
61 p->last_fault_code == DCERPC_FAULT_OP_RNG_ERROR) break;
65 printf("no limit on calls!?\n");
69 printf("Found %d calls\n", i);