]> andersk Git - moira.git/blob - clients/moira/menus.c
d6bbba3a7b833a9f36d2e6bf822c1dfd9aab3fef
[moira.git] / clients / moira / menus.c
1 #if (!defined(lint) && !defined(SABER))
2   static char rcsid_module_c[] = "$Header$";
3 #endif lint
4
5 /*      This is the file menus.c for the SMS Client, which allows a nieve
6  *      user to quickly and easily maintain most parts of the SMS database.
7  *      It Contains: All menu definitions.
8  *      
9  *      Created:        4/11/88
10  *      By:             Chris D. Peterson
11  *
12  *      $Source$
13  *      $Author$
14  *      $Header$
15  *      
16  *      Copyright 1988 by the Massachusetts Institute of Technology.
17  *
18  *      For further information on copyright and distribution 
19  *      see the file mit-copyright.h
20  */
21
22 #include <stdio.h>
23 #include <menu.h>
24
25 #include "mit-copyright.h"
26 #include "defs.h"
27 #include "f_defs.h"
28 #include "globals.h"
29
30
31 /* ------------------------- Second Tier Menus ------------------------- */
32
33 /* 
34  * Cluster Data Menu
35  */
36
37 Menu cluster_data_menu = {
38   NULLFUNC,
39   NULLFUNC,
40   "Cluster Data Menu",
41   4,
42   {
43     { ShowClusterData, NULLMENU, 3, {
44       {"show", "Show Data on a given Cluster"},
45       {"clus", "Cluster's Name: "},
46       {"label", "Label Identifing the data: "},
47     } },
48     { AddClusterData, NULLMENU, 4, {
49       {"add", "Add Data to a given Cluster"},
50       {"clus", "Cluster Name: "},
51       {"label", "Label Identifing the data: "},
52       {"data", "The data to be added: "},
53     } },
54     { RemoveClusterData, NULLMENU, 3, {
55       {"delete", "Remove Data to a given Cluster"},
56       {"clus", "Cluster's Name: "},
57       {"label", "Label Identifing the data: "},
58     } }, 
59     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
60   }
61 };
62
63 /*
64  * List Information Menu
65  */
66
67 Menu list_info_menu = {
68     NULLFUNC,
69     NULLFUNC,
70     "List Information Menu",
71     5,
72     {
73         SIMPLEFUNC("member",
74                    "Show all lists to which a given member belongs",
75                    ListByMember),
76         SIMPLEFUNC("admin",
77                    "Show all items which a given member can administer",
78                    ListByAdministrator),
79         SIMPLEFUNC("groups", "Show all lists which are groups",
80                    ListAllGroups),
81         SIMPLEFUNC("public", "Show all public mailing lists",
82                    ListAllPublicMailLists),
83         SIMPLEFUNC("maillists", "Show all mailing lists",
84                    ListAllMailLists)
85     }
86 };
87
88 /*
89  * List Member Menu
90  */
91
92 Menu list_member_menu = {
93     ListmaintMemberMenuEntry,
94     ListmaintMemberMenuExit,
95     NULL,
96     7,
97     {
98         SIMPLEFUNC("add", "Add a member to this list", AddMember),
99         SIMPLEFUNC("remove", "Remove a member from this list", DeleteMember),
100         SIMPLEFUNC("all", "Show the members of this list", ListAllMembers),
101         SIMPLEFUNC("user", "Show the members of type USER", ListUserMembers),
102         SIMPLEFUNC("list", "Show the members of type LIST", ListListMembers),
103         SIMPLEFUNC("string", "Show the members of type STRING", 
104                    ListStringMembers),
105         SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
106     } 
107 };
108
109 /*
110  *  Machine To Cluster Mappings Menu
111  */
112
113 Menu mappings_menu = {
114   NULLFUNC,
115   NULLFUNC,
116   "Machine To Cluster Mappings Menu",
117   4,
118   {
119     { MachineToClusterMap, NULLMENU, 3, {
120       {"map", "Show Machine to cluster mapping"},
121       {"name", "Machine's Name: "},
122       {"cluster", "Cluster's Name: "},
123     } },
124     { AddMachineToCluster, NULLMENU, 3, {
125       {"addcluster","Add machines to a clusters"},
126       {"name","Machine's Name: "},
127       {"cluster", "Cluster's Name: "},
128     } },
129     { RemoveMachineFromCluster, NULLMENU, 3, {
130       {"remcluster", "Remove machines from clusters"},
131       {"name","Machine's Name: "},
132       {"cluster", "Cluster's Name: "},
133     } },
134     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
135   }
136 };
137
138 /* 
139  * Post Office Box Menu
140  */
141
142 Menu pobox_menu = {
143   NULLFUNC,
144   NULLFUNC,
145   "Post Office Box Menu",
146   4,
147   {
148     {GetUserPOBox, NULLMENU, 2, {
149       {"show", "Show a user's post office box"},
150       {"login name", "login name: "}
151     } },
152     {SetUserPOBox, NULLMENU, 2, {
153       {"set", "Set (Add or Change) a user's post office box"},
154       {"login name", "login name: "}
155     } },
156     {RemoveUserPOBox, NULLMENU, 2, {
157       {"remove", "Remove a user's post office box"},
158       {"login name", "login name: "}
159     } },
160     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
161   }
162 };
163    
164 /*
165  * Quota Menu
166  */
167  
168 Menu quota_menu = {
169   NULLFUNC,
170   NULLFUNC,
171   "Quota Menu",
172   7,
173   {
174     SIMPLEFUNC("shdef", "Show default user quota (in KB)", ShowDefaultQuota),
175     {ChangeDefaultQuota, NULLMENU, 2, {
176       {"chdef", "Change default user quota"},
177       {"quota", "New quota (in KB): "}
178     } },
179     SIMPLEFUNC("shquota", "Show a user's disk quota on a filesytem",
180                ShowUserQuota),
181     SIMPLEFUNC("addquota", "Add a new disk quota for user on a filesytem",
182                AddUserQuota),
183     SIMPLEFUNC("chquota", "Change a user's disk quota on a filesytem",
184                ChangeUserQuota),
185     SIMPLEFUNC("rmquota", "Remove a user's disk quota on a filesytem",
186                RemoveUserQuota),
187     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
188   } 
189 };
190
191 Menu service_menu = {
192     NULLFUNC,
193     NULLFUNC,
194     "DCM Service Menu",
195     6,
196     {
197         { showserv, NULLMENU, 2, {
198             { "showserv", "Show service information" },
199             { "service name", "Name of service: " },
200         } },
201         { addserv, NULLMENU, 2, {
202             { "addserv", "Add a new service" },
203             { "service name", "Name of service: " },
204         } },
205         { updateserv, NULLMENU, 2, {
206             { "updateserv", "Update service information" },
207             { "service name", "Name of service: " },
208         } },
209         { resetsrverr, NULLMENU, 2, {
210             { "resetsrverr", "Reset service error" },
211             { "service name", "Name of service: " },
212         } },
213         { resetsrvc, NULLMENU, 2, {
214             { "resetsrvc", "Reset service state" },
215             { "service name", "Name of service: " },
216         } },
217         { delserv, NULLMENU, 2, {
218             { "delserv", "Delete service info" },
219             { "service name", "Name of service: " },
220         } },
221     }
222 };
223
224 Menu host_menu = {
225     NULLFUNC,
226     NULLFUNC,
227     "DCM Host Menu",
228     7,
229     {
230         { showhost, NULLMENU, 3, {
231             { "showhost", "Show service/host tuple information" },
232             { "service name", "Name of service: " },
233             { "host name", "Name of machine: " },
234         } },
235         { addhost, NULLMENU, 3, {
236             { "addhost", "Add a new service/host tuple" },
237             { "service name", "Name of service: " },
238             { "host name", "Name of machine: " },
239         } },
240         { updatehost, NULLMENU, 3, {
241             { "updatehost", "Update a service/host tuple" },
242             { "service name", "Name of service: " },
243             { "host name", "Name of machine: " },
244         } },
245         { resethosterr, NULLMENU, 3, {
246             { "resethosterr", "Reset service/host error" },
247             { "service name", "Name of service: " },
248             { "host name", "Name of machine: " },
249         } },
250         { resethost, NULLMENU, 3, {
251             { "resethost", "Reset service/host state" },
252             { "service name", "Name of service: " },
253             { "host name", "Name of machine: " },
254         } },
255         { sethostor, NULLMENU, 3, {
256             { "override", "Set service/host override" },
257             { "service name", "Name of service: " },
258             { "host name", "Name of machine: " },
259         } },
260         { delhost, NULLMENU, 3, {
261             { "delhost", "Delete service/host tuple" },
262             { "service name", "Name of service: " },
263             { "host name", "Name of machine: " },
264         } },
265     }
266 };
267
268 /* ------------------------- First Tier Menus ------------------------- */
269
270 /* 
271  * Cluster Menu
272  */
273
274 Menu cluster_menu = {
275   NULLFUNC,
276   NULLFUNC,
277   "Cluster Menu",
278   7,
279   {
280     { ShowClusterInfo, NULLMENU, 2, {
281       {"show", "Get cluster information"},
282       {"name", "Cluster's Name: "}
283     } },
284     { AddCluster, NULLMENU, 2, {
285       {"add", "Add a new cluster"},
286       {"name","Cluster's Name: "},
287     } },
288     { UpdateCluster, NULLMENU, 2, {
289       {"update", "Update cluster information"},
290       {"name","Cluster's Name: "},
291     } },
292     { DeleteCluster, NULLMENU, 2, {
293       {"delete", "Delete this cluster"},
294       {"name", "Cluster's Name: "}
295     } },
296     SUBMENU("mappings","Machine To Cluster Mappings Menu", &mappings_menu),
297     SUBMENU("c_data","Cluster Data Menu", &cluster_data_menu),
298     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
299   }
300 };
301
302 /* 
303  * Filesystem Menu
304  */
305
306 Menu filesys_menu = {
307   NULLFUNC, 
308   NULLFUNC, 
309   "Filesystem Menu",
310   10,
311   {
312     { GetFS, NULLMENU, 2, {
313       {"get", "Get Filesystem Name Information"},
314       {"name", "Name of Filesystem: "}
315     } },
316     { AddFS, NULLMENU, 2, {
317       {"add", "Add New Filesystem to Database"},
318       {"name", "name: "},
319     } },
320     { ChangeFS, NULLMENU, 2, {
321       {"change", "Update Filesystem Information"},
322       {"name", "name: "},
323     } },
324     { DeleteFS, NULLMENU, 2, {
325       {"delete", "Delete Filesystem"},
326       {"name", "Filesystem Name: "}
327     } },
328     { GetFSAlias, NULLMENU, 2, {
329       {"check", "Check An Association"},
330       {"name", "alias name : "}
331     } },
332     { CreateFSAlias, NULLMENU, 2, {
333       {"alias", "Associate with a Filesystem"},
334       {"name", "alias name : "},
335     } },
336     { DeleteFSAlias, NULLMENU, 2, {
337       {"unalias", "Disassociate from a Filesystem"},
338       {"name", "alias name : "},
339     } },
340     SUBMENU("quotas","Quota Menu", &quota_menu),
341     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
342     SIMPLEFUNC("help", "Help ..", AttachHelp)
343   }
344 };
345
346 /*
347  * Machine Menu
348  */
349
350 Menu machine_menu = {
351   NULLFUNC,
352   NULLFUNC,
353   "Machine Menu",
354   6,
355   {
356     { ShowMachineInfo, NULLMENU, 2, {
357       {"show","Get machine information"},
358       {"name","Machine's Name: "}
359     } },
360     { AddMachine, NULLMENU, 2, {
361       {"add","Add a new machine"},
362       {"name","Machine's Name: "},
363     } },
364     { UpdateMachine, NULLMENU, 2, {
365       {"update","Update machine information"},
366       {"name","Machine's Name: "},
367     } },
368     { DeleteMachine, NULLMENU, 2, {
369       {"delete","Delete this machine"},
370       {"name","Machine's Name: "}
371     } },
372     SUBMENU("mappings","Machine To Cluster Mappings Menu", &mappings_menu),
373     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
374   }
375 };
376
377 /*
378  * List Menu
379  */
380
381 Menu list_menu = {
382     NULLFUNC,
383     NULLFUNC,
384     "List Menu",
385     10,
386     {
387         { ShowListInfo, NULLMENU, 2, {
388             {"show", "Display information about a list"},
389             {"list name", "Name of list: "}
390         } },
391         { NULLFUNC, &list_member_menu, 2, {
392             {"add", "Create new List"},
393             {"list name", "Name of list: "}
394         } },
395         { UpdateList, NULLMENU, 2, {
396             {"update", "Update characteristics of a list"},
397             {"list name", "Name of list: "}
398         } },
399         { DeleteList, NULLMENU, 2, {
400             {"delete", "Delete a List"},
401             {"list name", "Name of list: "}
402         } },
403         SIMPLEFUNC("query_remove",
404                    "Interactively remove an item from all lists",
405                    InterRemoveItemFromLists),
406         { NULLFUNC, &list_member_menu, 2, {
407             {"members", "Member Menu - Change/Show Members of a List."},
408             {"list name", "Name of list: "}
409         } },
410         SUBMENU("list_info", "List Info Menu",
411                 &list_info_menu),
412         SUBMENU("quotas","Quota Menu", &quota_menu),    
413         SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
414         SIMPLEFUNC("help", "Print Help", ListHelp)
415     } 
416 };
417
418 /*
419  * NFS Physical Menu
420  */
421
422 Menu nfsphys_menu = {
423   NULLFUNC,
424   NULLFUNC,
425   "NFS Physical Menu",
426   6,
427   {
428     { ShowNFSService, NULLMENU, 2, {
429       { "show", "Show an NFS server" },
430       { "machine", "Machine Name: "},
431     } },
432     { AddNFSService, NULLMENU, 2, {
433       { "add", "Add NFS server" },
434       { "machine", "Machine Name: "},
435     } },
436     { UpdateNFSService, NULLMENU, 2, {
437       { "update", "Update NFS server"},
438       { "machine", "Machine Name: "},
439     } },
440     { DeleteNFSService, NULLMENU, 2, {
441       { "delete", "Delete NFS server"},
442       {"machine", "Machine Name: "},
443     } },
444     SUBMENU("quotas","Quota Menu", &quota_menu),
445     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
446 /*    SIMPLEFUNC("help", "Help", NFSHelp), */
447   }
448 };
449
450 /*
451  * User Menu
452  */
453
454 Menu user_menu = {
455   NULLFUNC,
456   NULLFUNC,
457   "User Menu",
458   11,
459   {
460     {ShowUserByLogin, NULLMENU, 2, {
461        {"login", "Show user information by login name"},
462        {"login name", "Desired login name: "}
463      } },
464     {ShowUserByName, NULLMENU, 3, {
465       {"name", "Show user information by name"},
466       {"first", "First name: "},
467       {"last", "Last name: "}
468     } },
469     {ShowUserByClass, NULLMENU, 2, {
470        {"class", "Show names of users in a given class"},
471        {"login name", "Desired class: "}
472      } },    
473     {UpdateUser, NULLMENU, 2, {
474       {"modify", "Change all user fields"},
475       {"login", "Login name: "}
476     } },
477 /*    SIMPLEFUNC("chpw", "Change a user's password", change_user_password), */
478     SIMPLEFUNC("adduser", "Add a new user to the database", 
479                AddNewUser),
480     SIMPLEFUNC("register", "Register a user", RegisterUser),
481     {DeactivateUser, NULLMENU, 2, {
482       {"deactivate", "Deactivate user"},
483       {"login", "Login name: "},
484     } },
485     {DeleteUser, NULLMENU, 2, {
486       {"expunge", "Expunge user"},
487       {"login", "Login name: "}
488     } },
489 /*    {DeleteUserByUid, NULLMENU, 2, {
490       {"udelete", "Delete user by uid"},
491       {"uid", "User ID (not MIT ID!): "}
492     } }, */
493     SUBMENU("pobox", "Post Office Box Menu", &pobox_menu),
494     SUBMENU("quota", "Quota Menu", &quota_menu),
495     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
496   }
497 };
498
499 Menu dcm_menu = {
500     NULLFUNC,
501     NULLFUNC,
502     "DCM Menu",
503     6,
504     {
505         SIMPLEFUNC("enable", "Enable/disable DCM", EnableDcm),
506         SUBMENU("service", "DCM Service Menu", &service_menu),
507         SUBMENU("host", "DCM Host Menu", &host_menu),
508         SIMPLEFUNC("active", "Display entries currently being updated",
509                    InProgress),
510         SIMPLEFUNC("failed", "Display entries with errors to be reset",
511                    DcmFailed),
512         SIMPLEFUNC("dcm", "Invoke a DCM update now", Dcm),
513     }
514 };
515
516 /* 
517  * Printer Menu
518  */
519
520 Menu printer_menu = {
521   NULLFUNC, 
522   NULLFUNC, 
523   "Printer Menu",
524   4,
525   {
526     { GetPcap, NULLMENU, 2, {
527       {"get", "Get Printcap Entry Information"},
528       {"name", "Name of Printer: "}
529     } },
530     { AddPcap, NULLMENU, 2, {
531       {"add", "Add New Printcap Entry to Database"},
532       {"name", "name: "},
533     } },
534     { ChngPcap, NULLMENU, 2, {
535       {"change", "Update Printer Information"},
536       {"name", "name: "},
537     } },
538     { DeletePcap, NULLMENU, 2, {
539       {"delete", "Delete Printcap Entry"},
540       {"name", "Printer Name: "}
541     } }
542   }
543 };
544
545
546 /*
547  * Miscellaneous Menu
548  */
549
550 Menu misc_menu = {
551     NULLFUNC,
552     NULLFUNC,
553     "Miscellaneous Menu",
554     4,
555     {
556         SIMPLEFUNC("statistics", "Show database statistics", TableStats),
557         SIMPLEFUNC("clients", "Show active SMS clients", ShowClients),
558         { ShowValue, NULLMENU, 2, {
559             {"getval", "Show a database variable value"},
560             {"name", "variable name: "},
561         } },
562         { ShowAlias, NULLMENU, 3, {
563             {"getalias", "Show an alias relation"},
564             {"name", "Alias name: "},
565             {"type", "Alias type: "},
566         } },
567     }
568 };
569
570
571 /* ------------------------- Root Menu ------------------------- */
572
573 /* 
574  * Sms top menu
575  */
576
577 Menu sms_top_menu = {
578   NULLFUNC,
579   NULLFUNC,
580   "Sms Database Manipulation",
581   9,
582   {
583     SUBMENU("cluster","Cluster Menu",&cluster_menu),
584     SUBMENU("filesys","Filesystem Menu", &filesys_menu),
585     SUBMENU("list","Lists and Group Menu", &list_menu),
586     SUBMENU("machine","Machine Menu",&machine_menu),
587     SUBMENU("nfs","NFS Physical Menu", &nfsphys_menu),
588     SUBMENU("user","User Menu", &user_menu),
589     SUBMENU("printer", "Printer Menu", &printer_menu),
590     SUBMENU("dcm", "DCM Menu", &dcm_menu),
591     SUBMENU("misc", "Miscellaneous Menu", &misc_menu)
592   }
593 };  
This page took 0.069421 seconds and 3 git commands to generate.