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 <afsconfig.h>
11 #include "afs/param.h"
14 #include <sys/types.h>
15 #include <netinet/in.h>
21 #include "rx_globals.h"
30 static short secLevel
= 0;
31 static short stats
= 0;
35 MakeVTest(akey
, aticket
, asession
)
36 struct rxvab_EncryptionKey
*akey
, *asession
;
37 struct rxvab_Ticket
*aticket
;
39 aticket
->ViceId
= htonl(71);
40 memcpy(&aticket
->HandShakeKey
, "testkeyx", 8);
41 memcpy(asession
, "testkeyx", 8);
42 bcrypt_encrypt(aticket
, aticket
, sizeof(struct rxvab_Ticket
), akey
);
46 #define MakeVTest(a,b,c) (printf ("rx_vab support removed\n"), exit (-1))
53 rx_PrintStats(rx_debugFile
);
57 rx_PrintStats(stdout
);
69 for (i
= 1; i
< argc
; i
++) {
70 if (!strcmp(argv
[i
], "-port")) {
71 port
= atoi(argv
[i
+ 1]);
73 } else if (!strcmp(argv
[i
], "-host")) {
74 th
= gethostbyname(argv
[i
+ 1]);
76 printf("could not find host '%s' in host table\n",
80 memcpy(&host
, th
->h_addr
, sizeof(long));
82 } else if (!strcmp(argv
[i
], "-count")) {
83 count
= atoi(argv
[i
+ 1]);
85 } else if (!strcmp(argv
[i
], "-security")) {
86 secLevel
= atoi(argv
[i
+ 1]);
88 } else if (!strcmp(argv
[i
], "-log")) {
89 rx_debugFile
= fopen("kctest.log", "w");
90 if (rx_debugFile
== NULL
)
91 printf("Couldn't open rx_stest.db");
92 signal(SIGINT
, SigInt
);
93 } else if (!strcmp(argv
[i
], "-stats"))
96 printf("unrecognized switch '%s'\n", argv
[i
]);
108 gettimeofday(&tv
, NULL
);
109 temp
= ((tv
.tv_sec
& 0xffff) * 1000) + (tv
.tv_usec
/ 1000);
117 struct rx_securityClass
*so
;
118 struct rx_connection
*tconn
;
119 struct rx_call
*tcall
;
121 int i
, startms
, endms
;
124 struct rxvab_Ticket ticket
;
125 struct rxvab_EncryptionKey session
;
128 host
= htonl(0x7f000001);
131 if (ParseCmd(argc
, argv
) != 0) {
132 printf("error parsing commands\n");
137 so
= rxnull_NewClientSecurityObject();
138 else if (secLevel
== 1) {
139 MakeVTest((struct rxvab_EncryptionKey
*)"applexxx", &ticket
,
142 so
= rxvab_NewClientSecurityObject(&session
, &ticket
, 0);
144 } else if (secLevel
== 2) {
145 MakeVTest((struct rxvab_EncryptionKey
*)"applexxx", &ticket
,
148 so
= rxvab_NewClientSecurityObject(&session
, &ticket
, 1);
151 printf("bad security index\n");
155 printf("failed to create security obj\n");
158 tconn
= rx_NewConnection(host
, port
, 1, so
, secLevel
);
159 printf("conn is %x\n", tconn
);
162 for (i
= 0; i
< count
; i
++) {
163 tcall
= rx_NewCall(tconn
);
165 xdrrx_create(&xdr
, tcall
, XDR_ENCODE
);
167 xdr_long(&xdr
, &temp
);
168 xdr
.x_op
= XDR_DECODE
;
169 xdr_long(&xdr
, &temp
);
171 printf("wrong value returned (%d)\n", temp
);
172 rx_EndCall(tcall
, 0);
175 printf("That was %d ms per call.\n", (endms
- startms
) / count
);
179 rx_PrintStats(stdout
);