2 * (C) COPYRIGHT IBM CORPORATION 1987
3 * LICENSED MATERIALS - PROPERTY OF IBM
6 /*--------------------------------------------------------------------------------------------------------------
10 Test of the routines used by the FileServer to manipulate the cell/server database and
11 determine the local cell name:
12 1) Reading in the local cell name from file.
13 2) Reading in the cell/server database from disk.
14 3) Reporting the set of servers associated with a given cell name.
15 4) Printing out the contents of the cell/server database.
16 5) Reclaiming the space used by an in-memory database.
21 --------------------------------------------------------------------------------------------------------------*/
22 #include <afs/param.h>
23 #include <sys/types.h>
27 #include <afs/afsutil.h>
31 #include <netinet/in.h>
33 #include <afs/cellconfig.h>
35 PrintOneCell(ainfo, arock, adir)
36 struct afsconf_cell *ainfo;
38 struct afsconf_dir *adir; {
42 printf("Cell %s:\n", ainfo->name);
43 for(i=0;i<ainfo->numServers;i++) {
44 bcopy(&ainfo->hostAddr[i].sin_addr, &temp, sizeof(long));
45 printf(" host %s at %x.%x\n", ainfo->hostName[i], temp, ainfo->hostAddr[i].sin_port);
50 /*Main for testcellconfig*/
55 struct afsconf_dir *theDir;
57 struct afsconf_cell theCell;
63 printf("usage: testcellconfig <conf-dir-name> [<cell-to-display>]*\n");
68 theDir = afsconf_Open(dirName);
70 printf("could not open configuration files in '%s'\n", dirName);
75 code = afsconf_GetLocalCell(theDir, tbuffer, sizeof(tbuffer));
77 printf("get local cell failed, code %d\n", code);
80 printf("Local cell is '%s'\n\n", tbuffer);
83 printf("About to print cell database contents:\n");
84 afsconf_CellApply(theDir, PrintOneCell, 0);
86 /* do this junk once */
87 printf("start of special test\n");
88 code = afsconf_GetCellInfo(theDir, (char *) 0, "afsprot", &theCell);
89 if (code) printf("failed to find afsprot service (%d)\n", code);
91 printf("AFSPROT service:\n");
92 PrintOneCell(&theCell, (char *) (char *) 0, theDir);
94 code = afsconf_GetCellInfo(theDir, 0, "bozotheclown", &theCell);
95 if (code == 0) printf("unexpectedly found service 'bozotheclown'\n");
96 code = afsconf_GetCellInfo(theDir, (char *) 0, "telnet", &theCell);
97 printf("Here's the telnet service:\n");
98 PrintOneCell(&theCell, (char *) 0, theDir);
99 printf("done with special test\n");
102 /* now print out specified cell info */
103 for(i = 2; i<argc; i++) {
104 code = afsconf_GetCellInfo(theDir, argv[i], 0, &theCell);
106 printf("Could not find info for cell '%s', code %d\n", argv[i], code);
108 else PrintOneCell(&theCell, (char *) 0, theDir);