3 * This is the file menus.c for the Moira Client, which allows users
4 * to quickly and easily maintain most parts of the Moira database.
5 * It Contains: All menu definitions.
8 * By: Chris D. Peterson
10 * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
11 * For copying and distribution information, please see the file
17 #include "mit-copyright.h"
27 /* ------------------------- Second Tier Menus ------------------------- */
33 Menu cluster_data_menu = {
39 { ShowClusterData, NULLMENU, 3, {
40 {"show", "Show Data on a given Cluster"},
41 {"clus", "Cluster's Name: "},
42 {"label", "Label Identifing the data: "},
44 { AddClusterData, NULLMENU, 4, {
45 {"add", "Add Data to a given Cluster"},
46 {"clus", "Cluster Name: "},
47 {"label", "Label Identifing the data: "},
48 {"data", "The data to be added: "},
50 { RemoveClusterData, NULLMENU, 3, {
51 {"delete", "Remove Data from a given Cluster"},
52 {"clus", "Cluster's Name: "},
53 {"label", "Label Identifing the data: "},
55 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
60 * List Information Menu
63 Menu list_info_menu = {
66 "List Information Menu",
70 "Show all lists to which a given member belongs",
73 "Show all items which a given member can administer",
75 SIMPLEFUNC("public", "Show all public mailing lists",
76 ListAllPublicMailLists),
84 Menu list_member_menu = {
85 ListmaintMemberMenuEntry,
86 ListmaintMemberMenuExit,
90 SIMPLEFUNC("add", "Add a member to this list", AddMember),
91 SIMPLEFUNC("remove", "Remove a member from this list", DeleteMember),
92 SIMPLEFUNC("all", "Show the members of this list", ListAllMembers),
93 SIMPLEFUNC("user", "Show the members of type USER", ListUserMembers),
94 SIMPLEFUNC("list", "Show the members of type LIST", ListListMembers),
95 SIMPLEFUNC("string", "Show the members of type STRING",
97 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
102 * Machine To Cluster Mappings Menu
105 Menu mappings_menu = {
108 "Machine To Cluster Mappings Menu",
111 { MachineToClusterMap, NULLMENU, 3, {
112 {"map", "Show Machine to cluster mapping"},
113 {"name", "Machine's Name: "},
114 {"cluster", "Cluster's Name: "},
116 { AddMachineToCluster, NULLMENU, 3, {
117 {"addcluster", "Add machine to a cluster"},
118 {"name", "Machine's Name: "},
119 {"cluster", "Cluster's Name: "},
121 { RemoveMachineFromCluster, NULLMENU, 3, {
122 {"remcluster", "Remove machines from clusters"},
123 {"name", "Machine's Name: "},
124 {"cluster", "Cluster's Name: "},
126 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
131 * Post Office Box Menu
137 "Post Office Box Menu",
140 {GetUserPOBox, NULLMENU, 2, {
141 {"show", "Show a user's post office box"},
142 {"login name", "login name: "}
144 {SetUserPOBox, NULLMENU, 2, {
145 {"set", "Set (Add or Change) a user's post office box"},
146 {"login name", "login name: "}
148 {RemoveUserPOBox, NULLMENU, 2, {
149 {"remove", "Remove a user's post office box"},
150 {"login name", "login name: "}
152 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
166 SIMPLEFUNC("shdef", "Show default user quota (in KB)", ShowDefaultQuota),
167 {ChangeDefaultQuota, NULLMENU, 2, {
168 {"chdef", "Change default user quota"},
169 {"quota", "New quota (in KB): "}
171 SIMPLEFUNC("getquota", "Show a quota on a filesystem",
173 SIMPLEFUNC("getfsquotas", "Show all quotas on a filesystem",
175 SIMPLEFUNC("addquota", "Add a new disk quota on a filesystem",
177 SIMPLEFUNC("upquota", "Change a quota on a filesystem",
179 SIMPLEFUNC("delquota", "Delete a quota on a filesystem",
181 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
185 Menu fsgroup_menu = {
188 "Filesystem Group Menu",
191 { GetFS, NULLMENU, 2, {
192 {"get", "Get individual or group filesystem information"},
193 {"name", "Name of Filesystem: "}
195 { AddFSToGroup, NULLMENU, 3, {
196 {"add", "Add a new filesystem to an FS group"},
197 {"group", "FS Group name: "},
198 {"filsys", "Filesystem name: "}
200 { RemoveFSFromGroup, NULLMENU, 3, {
201 {"remove", "Remove a filesystem from an FS group"},
202 {"group", "FS Group name: "},
203 {"filsys", "Filesystem name: "}
205 { ChangeFSGroupOrder, NULLMENU, 2, {
206 {"order", "Change the order of filesystems in a group"},
207 {"group", "FS Group name: "}
209 SIMPLEFUNC("help", "Info on Filesystem Groups", FSGroupHelp),
210 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
214 Menu service_menu = {
220 { showserv, NULLMENU, 2, {
221 { "showserv", "Show service information" },
222 { "service name", "Name of service: " },
224 { addserv, NULLMENU, 2, {
225 { "addserv", "Add a new service" },
226 { "service name", "Name of service: " },
228 { updateserv, NULLMENU, 2, {
229 { "updateserv", "Update service information" },
230 { "service name", "Name of service: " },
232 { resetsrverr, NULLMENU, 2, {
233 { "resetsrverr", "Reset service error" },
234 { "service name", "Name of service: " },
236 { resetsrvc, NULLMENU, 2, {
237 { "resetsrvc", "Reset service state" },
238 { "service name", "Name of service: " },
240 { delserv, NULLMENU, 2, {
241 { "delserv", "Delete service info" },
242 { "service name", "Name of service: " },
253 { showhost, NULLMENU, 3, {
254 { "showhost", "Show service/host tuple information" },
255 { "service name", "Name of service: " },
256 { "host name", "Name of machine: " },
258 { addhost, NULLMENU, 3, {
259 { "addhost", "Add a new service/host tuple" },
260 { "service name", "Name of service: " },
261 { "host name", "Name of machine: " },
263 { updatehost, NULLMENU, 3, {
264 { "updatehost", "Update a service/host tuple" },
265 { "service name", "Name of service: " },
266 { "host name", "Name of machine: " },
268 { resethosterr, NULLMENU, 3, {
269 { "resethosterr", "Reset service/host error" },
270 { "service name", "Name of service: " },
271 { "host name", "Name of machine: " },
273 { resethost, NULLMENU, 3, {
274 { "resethost", "Reset service/host state" },
275 { "service name", "Name of service: " },
276 { "host name", "Name of machine: " },
278 { sethostor, NULLMENU, 3, {
279 { "override", "Set service/host override" },
280 { "service name", "Name of service: " },
281 { "host name", "Name of machine: " },
283 { delhost, NULLMENU, 3, {
284 { "delhost", "Delete service/host tuple" },
285 { "service name", "Name of service: " },
286 { "host name", "Name of machine: " },
291 /* ------------------------- First Tier Menus ------------------------- */
297 Menu cluster_menu = {
303 { ShowClusterInfo, NULLMENU, 2, {
304 {"show", "Get cluster information"},
305 {"name", "Cluster's Name: "}
307 { AddCluster, NULLMENU, 2, {
308 {"add", "Add a new cluster"},
309 {"name", "Cluster's Name: "},
311 { UpdateCluster, NULLMENU, 2, {
312 {"update", "Update cluster information"},
313 {"name", "Cluster's Name: "},
315 { DeleteCluster, NULLMENU, 2, {
316 {"delete", "Delete this cluster"},
317 {"name", "Cluster's Name: "}
319 SUBMENU("mappings", "Machine To Cluster Mappings Menu", &mappings_menu),
320 SUBMENU("c_data", "Cluster Data Menu", &cluster_data_menu),
321 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
329 Menu filesys_menu = {
335 { GetFS, NULLMENU, 2, {
336 {"get", "Get Filesystem Name Information"},
337 {"name", "Name of Filesystem: "}
339 { GetFSM, NULLMENU, 2, {
340 {"getmach", "Get Filesystems by Machine"},
341 {"name", "Name of Server: "}
343 { AddFS, NULLMENU, 2, {
344 {"add", "Add New Filesystem to Database"},
347 { ChangeFS, NULLMENU, 2, {
348 {"change", "Update Filesystem Information"},
351 { DeleteFS, NULLMENU, 2, {
352 {"delete", "Delete Filesystem"},
353 {"name", "Filesystem Name: "}
355 SUBMENU("fsgroups", "File System Groups Menu", &fsgroup_menu),
356 { GetFSAlias, NULLMENU, 2, {
357 {"check", "Check An Association"},
358 {"name", "alias name : "}
360 { CreateFSAlias, NULLMENU, 2, {
361 {"alias", "Associate with a Filesystem"},
362 {"name", "alias name : "},
364 { DeleteFSAlias, NULLMENU, 2, {
365 {"unalias", "Disassociate from a Filesystem"},
366 {"name", "alias name : "},
368 SUBMENU("quotas", "Quota Menu", "a_menu),
369 /* SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode), */
370 /* SIMPLEFUNC("help", "Help ..", AttachHelp) */
380 { ShowSubnetInfo, NULLMENU, 2, {
381 {"show", "Get network information"},
382 {"name", "Network's Name: "}
384 { AddSubnet, NULLMENU, 2, {
385 {"add", "Add a new network"},
386 {"name", "Network's Name: "},
388 { UpdateSubnet, NULLMENU, 2, {
389 {"update", "Update network information"},
390 {"name", "Network's Name: "},
392 { DeleteSubnet, NULLMENU, 2, {
393 {"delete", "Delete this network"},
394 {"name", "Network's Name: "}
396 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
406 { ShowCname, NULLMENU, 3, {
407 {"show", "Get host alias information"},
408 {"alias", "Alias Name (Cname): "},
409 {"host", "Canonical Host Name: "}
411 { AddCname, NULLMENU, 3, {
412 {"add", "Add a new host alias"},
413 {"alias", "Alias Name (Cname): "},
414 {"host", "Canonical Host Name: "}
416 { DeleteCname, NULLMENU, 3, {
417 {"delete", "Delete this alias"},
418 {"alias", "Alias Name (Cname): "},
419 {"host", "Canonical Host Name: "}
421 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
429 Menu machine_menu = {
435 { ShowMachineInfo, NULLMENU, 2, {
436 {"show", "Get machine information"},
437 {"name", "Machine's Name: "}
439 { ShowMachineQuery, NULLMENU, 5, {
440 {"query", "Lookup machines"},
441 {"name", "Machine Name (or leave empty to match any): "},
442 {"address", "Address in dotted notation (or leave empty to match any): "},
443 {"location", "Location (or leave empty to match any): "},
444 {"network", "Network (or leave empty to match any): "}
446 { AddMachine, NULLMENU, 2, {
447 {"add", "Add a new machine"},
448 {"network", "Network assignment: "},
450 { UpdateMachine, NULLMENU, 2, {
451 {"update", "Update machine information"},
452 {"name", "Machine's Name: "},
454 { DeleteMachine, NULLMENU, 2, {
455 {"delete", "Delete this machine"},
456 {"name", "Machine's Name: "}
458 SUBMENU("cnames", "Alias names for machines", &cname_menu),
459 SUBMENU("mappings", "Machine To Cluster Mappings Menu", &mappings_menu),
473 { ShowListInfo, NULLMENU, 2, {
474 {"show", "Display information about a list"},
475 {"list name", "Name of list: "}
477 { NULLFUNC, &list_member_menu, 2, {
478 {"add", "Create new List"},
479 {"list name", "Name of list: "}
481 { UpdateList, NULLMENU, 2, {
482 {"update", "Update characteristics of a list"},
483 {"list name", "Name of list: "}
485 { DeleteList, NULLMENU, 2, {
486 {"delete", "Delete a List"},
487 {"list name", "Name of list: "}
489 SIMPLEFUNC("query_remove",
490 "Interactively remove an item from all lists",
491 InterRemoveItemFromLists),
492 { NULLFUNC, &list_member_menu, 2, {
493 {"members", "Member Menu - Change/Show Members of a List."},
494 {"list name", "Name of list: "}
496 SUBMENU("list_info", "List Info Menu",
498 SUBMENU("quotas", "Quota Menu", "a_menu),
499 /* SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode), */
500 SIMPLEFUNC("help", "Print Help", ListHelp)
508 Menu nfsphys_menu = {
514 { ShowNFSService, NULLMENU, 2, {
515 { "show", "Show an NFS server" },
516 { "machine", "Machine Name: "},
518 { AddNFSService, NULLMENU, 2, {
519 { "add", "Add NFS server" },
520 { "machine", "Machine Name: "},
522 { UpdateNFSService, NULLMENU, 2, {
523 { "update", "Update NFS server"},
524 { "machine", "Machine Name: "},
526 { DeleteNFSService, NULLMENU, 2, {
527 { "delete", "Delete NFS server"},
528 {"machine", "Machine Name: "},
530 SUBMENU("quotas", "Quota Menu", "a_menu),
531 SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
532 /* SIMPLEFUNC("help", "Help", NFSHelp), */
539 "User Kerberos Mapping Menu",
542 { GetKrbmap, NULLMENU, 3, {
543 { "show", "Show Kerberos Mappings" },
544 { "user", "User login name: " },
545 { "principal", "Principal: " },
547 { AddKrbmap, NULLMENU, 3, {
548 { "add", "Add Kerberos Mapping" },
549 { "user", "User login name: " },
550 { "principal", "Principal (this is case sensitive): " },
552 { DeleteKrbmap, NULLMENU, 3, {
553 { "delete", "Delete Kerberos Mapping" },
554 { "user", "User login name: " },
555 { "principal", "Principal: " },
570 {ShowUserByLogin, NULLMENU, 2, {
571 {"login", "Show user information by login name"},
572 {"login name", "Desired login name: "}
574 {ShowUserByName, NULLMENU, 3, {
575 {"name", "Show user information by name"},
576 {"first", "First name: "},
577 {"last", "Last name: "}
579 {ShowUserByClass, NULLMENU, 2, {
580 {"class", "Show names of users in a given class"},
581 {"login name", "Desired class: "}
583 {ShowUserById, NULLMENU, 2, {
584 {"id", "Show user information by ID number"},
585 {"ID number", "ID number: "}
587 {UpdateUser, NULLMENU, 2, {
588 {"modify", "Change all user fields"},
589 {"login", "Login name: "}
591 SIMPLEFUNC("adduser", "Add a new user to the database",
593 SIMPLEFUNC("register", "Register a user", RegisterUser),
594 {DeactivateUser, NULLMENU, 2, {
595 {"deactivate", "Deactivate user"},
596 {"login", "Login name: "},
598 {DeleteUser, NULLMENU, 2, {
599 {"expunge", "Expunge user"},
600 {"login", "Login name: "}
602 SUBMENU("pobox", "Post Office Box Menu", &pobox_menu),
603 SUBMENU("krbmap", "User Kerberos Mappings", &krbmap_menu),
613 SIMPLEFUNC("enable", "Enable/disable DCM", EnableDcm),
614 SUBMENU("service", "DCM Service Menu", &service_menu),
615 SUBMENU("host", "DCM Host Menu", &host_menu),
616 SIMPLEFUNC("active", "Display entries currently being updated",
618 SIMPLEFUNC("failed", "Display entries with errors to be reset", DcmFailed),
619 SIMPLEFUNC("dcm", "Invoke a DCM update now", Dcm),
627 Menu printer_menu = {
633 { GetPrn, NULLMENU, 2, {
634 {"get", "Get Printer Information"},
635 {"name", "Name of Printer: "}
637 { GetPrnByHostname, NULLMENU, 2, {
638 {"hostname", "Look up Printer Information by Printer Hostname"},
639 {"name", "Hostname of Printer: "}
641 { GetPrnByEthernet, NULLMENU, 2, {
642 {"ether", "Look up Printer Information by Ethernet address"},
643 {"hwaddr", "Ethernet address of Printer: "}
645 { GetPrnByRM, NULLMENU, 2, {
646 {"rm", "Look up Printer Information by Print Spooler"},
647 {"name", "Hostname of spooler: "}
649 { GetPrnByLocation, NULLMENU, 2, {
650 {"loc", "Look up Printer Information by Location"},
651 {"location", "Location: "}
653 { GetPrnByContact, NULLMENU, 2, {
654 {"contact", "Look up Printer Information by Contact Info"},
655 {"contact", "Contact: "}
657 { AddPrn, NULLMENU, 2, {
658 {"add", "Add New Printer to Database"},
661 { ChngPrn, NULLMENU, 2, {
662 {"change", "Update Printer Information"},
665 { DeletePrn, NULLMENU, 2, {
666 {"delete", "Delete Printer"},
667 {"name", "Printer Name: "}
669 { UpdateHWAddr, NULLMENU, 2, {
670 {"hwaddr", "Update Printer Hardware Address"},
671 {"name", "Printer hostname: "}
687 { GetZephyr, NULLMENU, 2, {
688 {"get", "Get Zephyr Class Information"},
689 {"name", "Name of class: "}
691 { AddZephyr, NULLMENU, 2, {
692 {"add", "Add New Zephyr class restrictions"},
693 {"name", "Class name: "},
695 { ChngZephyr, NULLMENU, 2, {
696 {"change", "Update Zephyr class restrictions"},
697 {"name", "Class name: "},
699 { DeleteZephyr, NULLMENU, 2, {
700 {"delete", "Delete Zephyr class restriction"},
701 {"name", "Class Name: "}
703 { NULLFUNC, &list_member_menu, 2, {
704 {"members", "Member Menu - Change/Show Members of a List."},
705 {"list name", "Name of list: "}
718 "Miscellaneous Menu",
721 SIMPLEFUNC("statistics", "Show database statistics", TableStats),
722 SIMPLEFUNC("clients", "Show active Moira clients", ShowClients),
723 { ShowValue, NULLMENU, 2, {
724 {"getval", "Show a database variable value"},
725 {"name", "variable name: "},
727 { ShowAlias, NULLMENU, 3, {
728 {"getalias", "Show an alias relation"},
729 {"name", "Alias name: "},
730 {"type", "Alias type: "},
736 /* ------------------------- Root Menu ------------------------- */
742 Menu moira_top_menu = {
745 "Moira Database Manipulation",
748 SUBMENU("cluster", "Cluster Menu", &cluster_menu),
749 SUBMENU("filesys", "Filesystem Menu", &filesys_menu),
750 SUBMENU("list", "Lists and Group Menu", &list_menu),
751 SUBMENU("machine", "Machine Menu", &machine_menu),
752 SUBMENU("network", "Network Menu", &subnet_menu),
753 SUBMENU("nfs", "NFS Physical Menu", &nfsphys_menu),
754 SUBMENU("printer", "Printer Menu", &printer_menu),
755 SUBMENU("user", "User Menu", &user_menu),
756 SUBMENU("zephyr", "Zephyr ACLS Menu", &zephyr_menu),
757 SUBMENU("dcm", "DCM Menu", &dcm_menu),
758 SUBMENU("misc", "Miscellaneous Menu", &misc_menu)