Move epoch and cid generation into the rx core
[openafs.git] / src / rx / test / generator.c
index bf11247..d2cb3e9 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <limits.h>
 #include <float.h>
-#include <malloc.h>
 #include <assert.h>
 #include "generator.h"
 
@@ -110,6 +107,7 @@ static char *nt_symbols[] = {
 /* all one string */
     "LIBS = $(DESTDIR)/lib/afsrxkad.lib \\\n"
        "\t$(DESTDIR)/lib/afsdes.lib \\\n" "\t$(DESTDIR)/lib/afsrx.lib \\\n"
+       "\t$(DESTDIR)/lib/afshcrypto.lib \\\n"
        "\t$(DESTDIR)/lib/afslwp.lib \\\n"
        "\t$(DESTDIR)/lib/afs/afscmd.lib \\\n"
        "\t$(DESTDIR)/lib/afs/afsafs_com_err.lib \\\n"
@@ -159,8 +157,7 @@ GetDescription(rpcArgs * argsP)
     char *bufP2;
     int i;
 
-    bufP2 =
-       (char *)calloc((MAX_TYP_STR + MAX_DIR_STR + ATTRIB_LEN * ATTRIB_NO)
+    bufP2 = calloc((MAX_TYP_STR + MAX_DIR_STR + ATTRIB_LEN * ATTRIB_NO)
                       * argsP->argCount + 3, sizeof(char));
     MEM_CHK(bufP2, "GetDescription: out of mem bufP2\n");
 
@@ -180,7 +177,7 @@ GetName(char *serverName, int sign_no)
     /* itl file name 8.3 format */
     char *bufP;
 
-    bufP = (char *)malloc(32 * sizeof(char));
+    bufP = malloc(32 * sizeof(char));
     MEM_CHK(bufP, "GetName: bufP out of mem\n");
 
     sprintf(bufP, "%s%d", serverName, sign_no);
@@ -315,8 +312,8 @@ GetRandP(char *typ, char **ret, char **ret2)
     double d, d1;
     short shI;
 
-    *ret = (char *)calloc(MAX_RAND_LENGTH + 1, sizeof(char));
-    *ret2 = (char *)calloc(MAX_RAND_LENGTH + 1, sizeof(char));
+    *ret = calloc(MAX_RAND_LENGTH + 1, sizeof(char));
+    *ret2 = calloc(MAX_RAND_LENGTH + 1, sizeof(char));
 
     if (strstr(typ, "char")) {
        GetRandStr(1, ret2, &randI);
@@ -534,7 +531,7 @@ WriteServC(rpcArgs * argsP, FILE * srv_h, char *serverName, int sign_no)
                        argsP->argDescr[i].outValue[0]);
            } else if (!strcmp(typ, "varString")) {
                if (!strcmp(argsP->argDescr[i].direction, "OUT")) {
-                   fprintf(srv_h, "\n\t*a%d = (char *) malloc(STR_MAX);", i);
+                   fprintf(srv_h, "\n\t*a%d = malloc(STR_MAX);", i);
                }
                fprintf(srv_h, "\n\tstrcpy((char *)*a%d, %s);", i,
                        argsP->argDescr[i].outValue[0]);
@@ -731,7 +728,7 @@ WriteCltTrailer(char *serverName, int first, int last, FILE * itl_h)
     fprintf(itl_h, "}\n");
 
     fprintf(itl_h,
-           "\n\nstatic void DoRun(struct cmd_syndesc *as, char *arock) {\n");
+           "\n\nstatic void DoRun(struct cmd_syndesc *as, void *arock) {\n");
 
     if (threadModel == PTHREADS) {
        fprintf(itl_h, "\tpthread_t *tid;\n");
@@ -772,7 +769,7 @@ WriteCltTrailer(char *serverName, int first, int last, FILE * itl_h)
                "malloc(numThreads*(sizeof(pthread_t)));\n");
     } else {
        fprintf(itl_h,
-               "\ttid = (PROCESS *) malloc(numThreads*(sizeof(PROCESS *)));\n");
+               "\ttid = malloc(numThreads*(sizeof(PROCESS *)));\n");
     }
 
     fprintf(itl_h, "\tassert(tid);\n" "\tfor(j=0;j<numThreads;j++) {\n");
@@ -802,7 +799,7 @@ WriteCltTrailer(char *serverName, int first, int last, FILE * itl_h)
 
     fprintf(itl_h,
            "static void SetupRunCmd(void) {\n" "\tstruct cmd_syndesc *ts;\n"
-           "\tts = cmd_CreateSyntax(NULL,DoRun, 0, \"run the test client program\");\n"
+           "\tts = cmd_CreateSyntax(NULL,DoRun, NULL, \"run the test client program\");\n"
            "\tcmd_AddParm(ts, \"-threadCount\", CMD_SINGLE, CMD_REQUIRED, \"number of threads to spawn\");\n"
            "\tcmd_AddParm(ts, \"-iterationCount\", CMD_SINGLE, CMD_REQUIRED, \"number of iterations to make over entire interface for each thread\");\n"
            "\tcmd_AddParm(ts, \"-secType\", CMD_SINGLE, CMD_REQUIRED, \"security level to use (1 -> unauthenticated, 2 -> authenticated)\");\n"
@@ -918,8 +915,8 @@ WriteCltInit(arg_tuple * arg, FILE * itl_h, int i, int structFlag)
                        arg->type);
                fprintf(itl_h,
                        "\t%sa%d.drpc_out_%s_t_val = "
-                       "(%s *) malloc(FIX_ARRAY_SIZE * sizeof(%s));\n", s, i,
-                       arg->type, (arg->type + 3), (arg->type + 3));
+                       "malloc(FIX_ARRAY_SIZE * sizeof(%s));\n", s, i,
+                       arg->type, (arg->type + 3));
            }
            for (j = 0; j < IDL_FIX_ARRAY_SIZE; j++) {
                if (structFlag) {
@@ -1187,7 +1184,7 @@ WriteServTrailer(FILE * srv_h)
            "\nstatic long GetKey (char *rock, long kvno, struct ktc_encryptionKey *key) {\n"
            "\tmemcpy ((void *) key, (void *) &serviceKey, sizeof(*key));\n"
            "\treturn 0;\n" "}\n\n"
-           "static void DoRun(struct cmd_syndesc *as, char *arock) {\n"
+           "static void DoRun(struct cmd_syndesc *as, void *arock) {\n"
            "\tstruct rx_service *serv;\n"
            "\tstruct rx_securityClass *sc[3];\n\n"
            "\tint port=0, errflg=0;\n" "\tint lowThreads=4, highThreads=8;\n"
@@ -1204,7 +1201,7 @@ WriteServTrailer(FILE * srv_h)
            "\t\trx_SetMaxProcs(serv,highThreads);\n"
            "\t\trx_StartServer(1);\n" "\t}\n" "\texit(0);\n" "}\n\n"
            "static void SetupRunCmd(void) {\n" "\tstruct cmd_syndesc *ts;\n"
-           "\tts = cmd_CreateSyntax(NULL,DoRun, 0, \"run the test server program\");\n"
+           "\tts = cmd_CreateSyntax(NULL,DoRun, NULL, \"run the test server program\");\n"
            "\tcmd_AddParm(ts, \"-lowThreadCount\", CMD_SINGLE, CMD_REQUIRED, \"minimum number of threads to spawn\");\n"
            "\tcmd_AddParm(ts, \"-highThreadCount\", CMD_SINGLE, CMD_REQUIRED, \"maximum number of threads to spawn\");\n"
            "\tcmd_AddParm(ts, \"-serverPort\", CMD_SINGLE, CMD_REQUIRED, \"port that server is using\");\n"