]> andersk Git - moira.git/blob - clients/moira/menus.c
3974014938cd9b9c5842804775343e01a6aac0da
[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 fsgroup_menu = {
192     NULLFUNC,
193     NULLFUNC,
194     "Filesystem Group Menu",
195     6,
196     {
197         { GetFS, NULLMENU, 2, {
198             {"get", "Get individual or group filesystem information"},
199             {"name", "Name of Filesystem: "}
200         } },
201         { AddFSToGroup, NULLMENU, 3, {
202             {"add", "Add a new filesystem to an FS group"},
203             {"group", "FS Group name:"},
204             {"filsys", "Filesystem name:"}
205         } },
206         { RemoveFSFromGroup, NULLMENU, 3, {
207             {"remove", "Remove a filesystem from an FS group"},
208             {"group", "FS Group name:"},
209             {"filsys", "Filesystem name:"}
210         } },
211         { ChangeFSGroupOrder, NULLMENU, 2, {
212             {"order", "Change the order of filesystems in a group"},
213             {"group", "FS Group name:"}
214         } },
215         SIMPLEFUNC("help", "Info on Filesystem Groups", FSGroupHelp),
216         SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
217     }
218 };
219
220 Menu service_menu = {
221     NULLFUNC,
222     NULLFUNC,
223     "DCM Service Menu",
224     6,
225     {
226         { showserv, NULLMENU, 2, {
227             { "showserv", "Show service information" },
228             { "service name", "Name of service: " },
229         } },
230         { addserv, NULLMENU, 2, {
231             { "addserv", "Add a new service" },
232             { "service name", "Name of service: " },
233         } },
234         { updateserv, NULLMENU, 2, {
235             { "updateserv", "Update service information" },
236             { "service name", "Name of service: " },
237         } },
238         { resetsrverr, NULLMENU, 2, {
239             { "resetsrverr", "Reset service error" },
240             { "service name", "Name of service: " },
241         } },
242         { resetsrvc, NULLMENU, 2, {
243             { "resetsrvc", "Reset service state" },
244             { "service name", "Name of service: " },
245         } },
246         { delserv, NULLMENU, 2, {
247             { "delserv", "Delete service info" },
248             { "service name", "Name of service: " },
249         } },
250     }
251 };
252
253 Menu host_menu = {
254     NULLFUNC,
255     NULLFUNC,
256     "DCM Host Menu",
257     7,
258     {
259         { showhost, NULLMENU, 3, {
260             { "showhost", "Show service/host tuple information" },
261             { "service name", "Name of service: " },
262             { "host name", "Name of machine: " },
263         } },
264         { addhost, NULLMENU, 3, {
265             { "addhost", "Add a new service/host tuple" },
266             { "service name", "Name of service: " },
267             { "host name", "Name of machine: " },
268         } },
269         { updatehost, NULLMENU, 3, {
270             { "updatehost", "Update a service/host tuple" },
271             { "service name", "Name of service: " },
272             { "host name", "Name of machine: " },
273         } },
274         { resethosterr, NULLMENU, 3, {
275             { "resethosterr", "Reset service/host error" },
276             { "service name", "Name of service: " },
277             { "host name", "Name of machine: " },
278         } },
279         { resethost, NULLMENU, 3, {
280             { "resethost", "Reset service/host state" },
281             { "service name", "Name of service: " },
282             { "host name", "Name of machine: " },
283         } },
284         { sethostor, NULLMENU, 3, {
285             { "override", "Set service/host override" },
286             { "service name", "Name of service: " },
287             { "host name", "Name of machine: " },
288         } },
289         { delhost, NULLMENU, 3, {
290             { "delhost", "Delete service/host tuple" },
291             { "service name", "Name of service: " },
292             { "host name", "Name of machine: " },
293         } },
294     }
295 };
296
297 /* ------------------------- First Tier Menus ------------------------- */
298
299 /* 
300  * Cluster Menu
301  */
302
303 Menu cluster_menu = {
304   NULLFUNC,
305   NULLFUNC,
306   "Cluster Menu",
307   7,
308   {
309     { ShowClusterInfo, NULLMENU, 2, {
310       {"show", "Get cluster information"},
311       {"name", "Cluster's Name: "}
312     } },
313     { AddCluster, NULLMENU, 2, {
314       {"add", "Add a new cluster"},
315       {"name","Cluster's Name: "},
316     } },
317     { UpdateCluster, NULLMENU, 2, {
318       {"update", "Update cluster information"},
319       {"name","Cluster's Name: "},
320     } },
321     { DeleteCluster, NULLMENU, 2, {
322       {"delete", "Delete this cluster"},
323       {"name", "Cluster's Name: "}
324     } },
325     SUBMENU("mappings","Machine To Cluster Mappings Menu", &mappings_menu),
326     SUBMENU("c_data","Cluster Data Menu", &cluster_data_menu),
327     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
328   }
329 };
330
331 /* 
332  * Filesystem Menu
333  */
334
335 Menu filesys_menu = {
336   NULLFUNC, 
337   NULLFUNC, 
338   "Filesystem Menu",
339   9,
340   {
341     { GetFS, NULLMENU, 2, {
342       {"get", "Get Filesystem Name Information"},
343       {"name", "Name of Filesystem: "}
344     } },
345     { AddFS, NULLMENU, 2, {
346       {"add", "Add New Filesystem to Database"},
347       {"name", "name: "},
348     } },
349     { ChangeFS, NULLMENU, 2, {
350       {"change", "Update Filesystem Information"},
351       {"name", "name: "},
352     } },
353     { DeleteFS, NULLMENU, 2, {
354       {"delete", "Delete Filesystem"},
355       {"name", "Filesystem Name: "}
356     } },
357     SUBMENU("fsgroups", "File System Groups Menu", &fsgroup_menu),
358     { GetFSAlias, NULLMENU, 2, {
359       {"check", "Check An Association"},
360       {"name", "alias name : "}
361     } },
362     { CreateFSAlias, NULLMENU, 2, {
363       {"alias", "Associate with a Filesystem"},
364       {"name", "alias name : "},
365     } },
366     { DeleteFSAlias, NULLMENU, 2, {
367       {"unalias", "Disassociate from a Filesystem"},
368       {"name", "alias name : "},
369     } },
370     SUBMENU("quotas","Quota Menu", &quota_menu),
371 /*    SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode), */
372 /*    SIMPLEFUNC("help", "Help ..", AttachHelp) */
373   }
374 };
375
376 /*
377  * Machine Menu
378  */
379
380 Menu machine_menu = {
381   NULLFUNC,
382   NULLFUNC,
383   "Machine Menu",
384   6,
385   {
386     { ShowMachineInfo, NULLMENU, 2, {
387       {"show","Get machine information"},
388       {"name","Machine's Name: "}
389     } },
390     { AddMachine, NULLMENU, 2, {
391       {"add","Add a new machine"},
392       {"name","Machine's Name: "},
393     } },
394     { UpdateMachine, NULLMENU, 2, {
395       {"update","Update machine information"},
396       {"name","Machine's Name: "},
397     } },
398     { DeleteMachine, NULLMENU, 2, {
399       {"delete","Delete this machine"},
400       {"name","Machine's Name: "}
401     } },
402     SUBMENU("mappings","Machine To Cluster Mappings Menu", &mappings_menu),
403     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
404   }
405 };
406
407 /*
408  * List Menu
409  */
410
411 Menu list_menu = {
412     NULLFUNC,
413     NULLFUNC,
414     "List Menu",
415     9,
416     {
417         { ShowListInfo, NULLMENU, 2, {
418             {"show", "Display information about a list"},
419             {"list name", "Name of list: "}
420         } },
421         { NULLFUNC, &list_member_menu, 2, {
422             {"add", "Create new List"},
423             {"list name", "Name of list: "}
424         } },
425         { UpdateList, NULLMENU, 2, {
426             {"update", "Update characteristics of a list"},
427             {"list name", "Name of list: "}
428         } },
429         { DeleteList, NULLMENU, 2, {
430             {"delete", "Delete a List"},
431             {"list name", "Name of list: "}
432         } },
433         SIMPLEFUNC("query_remove",
434                    "Interactively remove an item from all lists",
435                    InterRemoveItemFromLists),
436         { NULLFUNC, &list_member_menu, 2, {
437             {"members", "Member Menu - Change/Show Members of a List."},
438             {"list name", "Name of list: "}
439         } },
440         SUBMENU("list_info", "List Info Menu",
441                 &list_info_menu),
442         SUBMENU("quotas","Quota Menu", &quota_menu),    
443 /*      SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode), */
444         SIMPLEFUNC("help", "Print Help", ListHelp)
445     } 
446 };
447
448 /*
449  * NFS Physical Menu
450  */
451
452 Menu nfsphys_menu = {
453   NULLFUNC,
454   NULLFUNC,
455   "NFS Physical Menu",
456   6,
457   {
458     { ShowNFSService, NULLMENU, 2, {
459       { "show", "Show an NFS server" },
460       { "machine", "Machine Name: "},
461     } },
462     { AddNFSService, NULLMENU, 2, {
463       { "add", "Add NFS server" },
464       { "machine", "Machine Name: "},
465     } },
466     { UpdateNFSService, NULLMENU, 2, {
467       { "update", "Update NFS server"},
468       { "machine", "Machine Name: "},
469     } },
470     { DeleteNFSService, NULLMENU, 2, {
471       { "delete", "Delete NFS server"},
472       {"machine", "Machine Name: "},
473     } },
474     SUBMENU("quotas","Quota Menu", &quota_menu),
475     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
476 /*    SIMPLEFUNC("help", "Help", NFSHelp), */
477   }
478 };
479
480 Menu krbmap_menu = {
481     NULLFUNC,
482     NULLFUNC,
483     "User Kerberos Mapping Menu",
484     3,
485     {
486         { GetKrbmap, NULLMENU, 3, {
487             { "show", "Show Kerberos Mappings" },
488             { "user", "User login name: " },
489             { "principal", "Principal: " },
490         } },
491         { AddKrbmap, NULLMENU, 3, {
492             { "add", "Add Kerberos Mapping" },
493             { "user", "User login name: " },
494             { "principal", "Principal (this is case sensitive): " },
495         } },
496         { DeleteKrbmap, NULLMENU, 3, {
497             { "delete", "Delete Kerberos Mapping" },
498             { "user", "User login name: " },
499             { "principal", "Principal: " },
500         } },
501     }
502 };
503
504 /*
505  * User Menu
506  */
507
508 Menu user_menu = {
509   NULLFUNC,
510   NULLFUNC,
511   "User Menu",
512   11,
513   {
514     {ShowUserByLogin, NULLMENU, 2, {
515        {"login", "Show user information by login name"},
516        {"login name", "Desired login name: "}
517      } },
518     {ShowUserByName, NULLMENU, 3, {
519       {"name", "Show user information by name"},
520       {"first", "First name: "},
521       {"last", "Last name: "}
522     } },
523     {ShowUserByClass, NULLMENU, 2, {
524        {"class", "Show names of users in a given class"},
525        {"login name", "Desired class: "}
526      } },    
527     {UpdateUser, NULLMENU, 2, {
528       {"modify", "Change all user fields"},
529       {"login", "Login name: "}
530     } },
531     SIMPLEFUNC("adduser", "Add a new user to the database", 
532                AddNewUser),
533     SIMPLEFUNC("register", "Register a user", RegisterUser),
534     {DeactivateUser, NULLMENU, 2, {
535       {"deactivate", "Deactivate user"},
536       {"login", "Login name: "},
537     } },
538     {DeleteUser, NULLMENU, 2, {
539       {"expunge", "Expunge user"},
540       {"login", "Login name: "}
541     } },
542     SUBMENU("pobox", "Post Office Box Menu", &pobox_menu),
543     SUBMENU("quota", "Quota Menu", &quota_menu),
544     SUBMENU("krbmap", "User Kerberos Mappings", &krbmap_menu),
545   }
546 };
547
548 Menu dcm_menu = {
549     NULLFUNC,
550     NULLFUNC,
551     "DCM Menu",
552     6,
553     {
554         SIMPLEFUNC("enable", "Enable/disable DCM", EnableDcm),
555         SUBMENU("service", "DCM Service Menu", &service_menu),
556         SUBMENU("host", "DCM Host Menu", &host_menu),
557         SIMPLEFUNC("active", "Display entries currently being updated",
558                    InProgress),
559         SIMPLEFUNC("failed", "Display entries with errors to be reset",
560                    DcmFailed),
561         SIMPLEFUNC("dcm", "Invoke a DCM update now", Dcm),
562     }
563 };
564
565 /* 
566  * Printcap Printer Menu
567  */
568
569 Menu printer_menu = {
570   NULLFUNC, 
571   NULLFUNC, 
572   "Printer Menu",
573   4,
574   {
575     { GetPcap, NULLMENU, 2, {
576       {"get", "Get Printcap Entry Information"},
577       {"name", "Name of Printer: "}
578     } },
579     { AddPcap, NULLMENU, 2, {
580       {"add", "Add New Printcap Entry to Database"},
581       {"name", "name: "},
582     } },
583     { ChngPcap, NULLMENU, 2, {
584       {"change", "Update Printer Information"},
585       {"name", "name: "},
586     } },
587     { DeletePcap, NULLMENU, 2, {
588       {"delete", "Delete Printcap Entry"},
589       {"name", "Printer Name: "}
590     } }
591   }
592 };
593
594
595 /* 
596  * Palladium Printer Menu
597  */
598
599 Menu palladium_menu = {
600   NULLFUNC, 
601   NULLFUNC, 
602   "Printer Menu",
603   7,
604   {
605     { GetPalladium, NULLMENU, 2, {
606       {"get", "Get Palladium Server/Supervisor Information"},
607       {"name", "Name of Printer: "}
608     } },
609     { AddPalladium, NULLMENU, 2, {
610       {"add", "Add New Palladium Server/Supervisor to Database"},
611       {"name", "Supervisor/server name: "},
612     } },
613     { ChngPalladium, NULLMENU, 2, {
614       {"change", "Update Palladium Server/Supervisor Information"},
615       {"name", "name: "},
616     } },
617     { DeletePalladium, NULLMENU, 2, {
618       {"delete", "Delete Palladium Server/Supervisor Entry"},
619       {"name", "Printer Name: "}
620     } },
621     { ShowPalladiumAlias, NULLMENU, 3, {
622       {"getprinter", "Show Logical Printers"},
623       {"newname", "Printer name: "},
624       {"server", "Supervisor or Server name: "},
625     } },
626     { AddPalladiumAlias, NULLMENU, 3, {
627       {"addprinter", "Add Logical Printer"},
628       {"newname", "New printer: "},
629       {"server", "Supervisor or Server name: "},
630     } },
631     { DeletePalladiumAlias, NULLMENU, 3, {
632       {"delprinter", "Remove Logical Printer"},
633       {"newname", "Printer name: "},
634       {"server", "Supervisor or Server name: "},
635     } },
636   }
637 };
638
639
640
641
642 /*
643  * Miscellaneous Menu
644  */
645
646 Menu misc_menu = {
647     NULLFUNC,
648     NULLFUNC,
649     "Miscellaneous Menu",
650     4,
651     {
652         SIMPLEFUNC("statistics", "Show database statistics", TableStats),
653         SIMPLEFUNC("clients", "Show active SMS clients", ShowClients),
654         { ShowValue, NULLMENU, 2, {
655             {"getval", "Show a database variable value"},
656             {"name", "variable name: "},
657         } },
658         { ShowAlias, NULLMENU, 3, {
659             {"getalias", "Show an alias relation"},
660             {"name", "Alias name: "},
661             {"type", "Alias type: "},
662         } },
663     }
664 };
665
666
667 /* ------------------------- Root Menu ------------------------- */
668
669 /* 
670  * Sms top menu
671  */
672
673 Menu sms_top_menu = {
674   NULLFUNC,
675   NULLFUNC,
676   "Sms Database Manipulation",
677   10,
678   {
679     SUBMENU("cluster","Cluster Menu",&cluster_menu),
680     SUBMENU("filesys","Filesystem Menu", &filesys_menu),
681     SUBMENU("list","Lists and Group Menu", &list_menu),
682     SUBMENU("machine","Machine Menu",&machine_menu),
683     SUBMENU("nfs","NFS Physical Menu", &nfsphys_menu),
684     SUBMENU("user","User Menu", &user_menu),
685     SUBMENU("printcap", "Printcap Printer Menu", &printer_menu),
686     SUBMENU("palladium", "Palladium Printer Menu", &palladium_menu),
687     SUBMENU("dcm", "DCM Menu", &dcm_menu),
688     SUBMENU("misc", "Miscellaneous Menu", &misc_menu)
689   }
690 };  
This page took 0.07968 seconds and 3 git commands to generate.