2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include "afs/param.h"
11 #include <afsconfig.h>
16 #include <sys/types.h>
17 #include <netinet/in.h>
23 #include "rx_globals.h"
32 static short secLevel = 0;
33 static short stats = 0;
37 MakeVTest(akey, aticket, asession)
38 struct rxvab_EncryptionKey *akey, *asession;
39 struct rxvab_Ticket *aticket;
41 aticket->ViceId = htonl(71);
42 memcpy(&aticket->HandShakeKey, "testkeyx", 8);
43 memcpy(asession, "testkeyx", 8);
44 bcrypt_encrypt(aticket, aticket, sizeof(struct rxvab_Ticket), akey);
48 #define MakeVTest(a,b,c) (printf ("rx_vab support removed\n"), exit (-1))
55 rx_PrintStats(rx_debugFile);
59 rx_PrintStats(stdout);
70 register struct hostent *th;
71 for (i = 1; i < argc; i++) {
72 if (!strcmp(argv[i], "-port")) {
73 port = atoi(argv[i + 1]);
75 } else if (!strcmp(argv[i], "-host")) {
76 th = gethostbyname(argv[i + 1]);
78 printf("could not find host '%s' in host table\n",
82 memcpy(&host, th->h_addr, sizeof(long));
84 } else if (!strcmp(argv[i], "-count")) {
85 count = atoi(argv[i + 1]);
87 } else if (!strcmp(argv[i], "-security")) {
88 secLevel = atoi(argv[i + 1]);
90 } else if (!strcmp(argv[i], "-log")) {
91 rx_debugFile = fopen("kctest.log", "w");
92 if (rx_debugFile == NULL)
93 printf("Couldn't open rx_stest.db");
94 signal(SIGINT, SigInt);
95 } else if (!strcmp(argv[i], "-stats"))
98 printf("unrecognized switch '%s'\n", argv[i]);
110 gettimeofday(&tv, 0);
111 temp = ((tv.tv_sec & 0xffff) * 1000) + (tv.tv_usec / 1000);
119 struct rx_securityClass *so;
120 struct rx_connection *tconn;
121 struct rx_call *tcall;
123 int i, startms, endms;
126 struct rxvab_Ticket ticket;
127 struct rxvab_EncryptionKey session;
130 host = htonl(0x7f000001);
133 if (ParseCmd(argc, argv) != 0) {
134 printf("error parsing commands\n");
139 so = rxnull_NewClientSecurityObject();
140 else if (secLevel == 1) {
141 MakeVTest((struct rxvab_EncryptionKey *)"applexxx", &ticket,
144 so = rxvab_NewClientSecurityObject(&session, &ticket, 0);
146 } else if (secLevel == 2) {
147 MakeVTest((struct rxvab_EncryptionKey *)"applexxx", &ticket,
150 so = rxvab_NewClientSecurityObject(&session, &ticket, 1);
153 printf("bad security index\n");
157 printf("failed to create security obj\n");
160 tconn = rx_NewConnection(host, port, 1, so, secLevel);
161 printf("conn is %x\n", tconn);
164 for (i = 0; i < count; i++) {
165 tcall = rx_NewCall(tconn);
167 xdrrx_create(&xdr, tcall, XDR_ENCODE);
169 xdr_long(&xdr, &temp);
170 xdr.x_op = XDR_DECODE;
171 xdr_long(&xdr, &temp);
173 printf("wrong value returned (%d)\n", temp);
174 rx_EndCall(tcall, 0);
177 printf("That was %d ms per call.\n", (endms - startms) / count);
181 rx_PrintStats(stdout);