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
11 * This file contains sample code for the client admin interface
14 #include <afsconfig.h>
15 #include <afs/param.h>
24 #include <afs/afs_Admin.h>
25 #include <afs/afs_clientAdmin.h>
26 #include <afs/afs_utilAdmin.h>
31 fprintf(stderr, "Usage: cm_client_config <host> <port>\n");
36 ParseArgs(int argc, char *argv[], char **srvrName, long *srvrPort)
42 *srvrName = *(argp++);
45 *srvrPort = strtol(*(argp++), NULL, 0);
46 if (*srvrPort <= 0 || *srvrPort >= 65536)
53 main(int argc, char *argv[])
57 struct rx_connection *conn;
61 afs_ClientConfig_t config;
63 ParseArgs(argc, argv, &srvrName, &srvrPort);
65 rc = afsclient_Init(&st);
67 fprintf(stderr, "afsclient_Init, status %d\n", st);
71 rc = afsclient_NullCellOpen(&cellHandle, &st);
73 fprintf(stderr, "afsclient_NullCellsOpen, status %d\n", st);
77 rc = afsclient_CMStatOpenPort(cellHandle, srvrName, srvrPort, &conn, &st);
79 fprintf(stderr, "afsclient_CMStatOpenPort, status %d\n", st);
83 rc = util_CMClientConfig(conn, &config, &st);
85 fprintf(stderr, "util_CMClientConfig, status %d\n", st);
89 rc = afsclient_CMStatClose(conn, &st);
91 fprintf(stderr, "afsclient_CMStatClose, status %d\n", st);
95 rc = afsclient_CellClose(cellHandle, &st);
97 fprintf(stderr, "afsclient_CellClose, status %d\n", st);
102 printf("\nClient configuration for %s (port %d):\n\n", srvrName,
104 printf(" clientVersion: %d\n", config.clientVersion);
105 printf(" serverVersion: %d\n", config.serverVersion);
106 printf(" nChunkFiles: %d\n", config.c.config_v1.nChunkFiles);
107 printf(" nStatCaches: %d\n", config.c.config_v1.nStatCaches);
108 printf(" nDataCaches: %d\n", config.c.config_v1.nDataCaches);
109 printf(" nVolumeCaches: %d\n", config.c.config_v1.nVolumeCaches);
110 printf(" firstChunkSize: %d\n", config.c.config_v1.firstChunkSize);
111 printf(" otherChunkSize: %d\n", config.c.config_v1.otherChunkSize);
112 printf(" cacheSize: %d\n", config.c.config_v1.cacheSize);
113 printf(" setTime: %d\n", config.c.config_v1.setTime);
114 printf(" memCache: %d\n", config.c.config_v1.memCache);