]> andersk Git - moira.git/blob - clients/moira/menus.c
02a89cd19d8a51bdb40cb411cbf2a7e16e3de131
[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 /*
481  * User Menu
482  */
483
484 Menu user_menu = {
485   NULLFUNC,
486   NULLFUNC,
487   "User Menu",
488   11,
489   {
490     {ShowUserByLogin, NULLMENU, 2, {
491        {"login", "Show user information by login name"},
492        {"login name", "Desired login name: "}
493      } },
494     {ShowUserByName, NULLMENU, 3, {
495       {"name", "Show user information by name"},
496       {"first", "First name: "},
497       {"last", "Last name: "}
498     } },
499     {ShowUserByClass, NULLMENU, 2, {
500        {"class", "Show names of users in a given class"},
501        {"login name", "Desired class: "}
502      } },    
503     {UpdateUser, NULLMENU, 2, {
504       {"modify", "Change all user fields"},
505       {"login", "Login name: "}
506     } },
507 /*    SIMPLEFUNC("chpw", "Change a user's password", change_user_password), */
508     SIMPLEFUNC("adduser", "Add a new user to the database", 
509                AddNewUser),
510     SIMPLEFUNC("register", "Register a user", RegisterUser),
511     {DeactivateUser, NULLMENU, 2, {
512       {"deactivate", "Deactivate user"},
513       {"login", "Login name: "},
514     } },
515     {DeleteUser, NULLMENU, 2, {
516       {"expunge", "Expunge user"},
517       {"login", "Login name: "}
518     } },
519 /*    {DeleteUserByUid, NULLMENU, 2, {
520       {"udelete", "Delete user by uid"},
521       {"uid", "User ID (not MIT ID!): "}
522     } }, */
523     SUBMENU("pobox", "Post Office Box Menu", &pobox_menu),
524     SUBMENU("quota", "Quota Menu", &quota_menu),
525     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
526   }
527 };
528
529 Menu dcm_menu = {
530     NULLFUNC,
531     NULLFUNC,
532     "DCM Menu",
533     6,
534     {
535         SIMPLEFUNC("enable", "Enable/disable DCM", EnableDcm),
536         SUBMENU("service", "DCM Service Menu", &service_menu),
537         SUBMENU("host", "DCM Host Menu", &host_menu),
538         SIMPLEFUNC("active", "Display entries currently being updated",
539                    InProgress),
540         SIMPLEFUNC("failed", "Display entries with errors to be reset",
541                    DcmFailed),
542         SIMPLEFUNC("dcm", "Invoke a DCM update now", Dcm),
543     }
544 };
545
546 /* 
547  * Printer Menu
548  */
549
550 Menu printer_menu = {
551   NULLFUNC, 
552   NULLFUNC, 
553   "Printer Menu",
554   4,
555   {
556     { GetPcap, NULLMENU, 2, {
557       {"get", "Get Printcap Entry Information"},
558       {"name", "Name of Printer: "}
559     } },
560     { AddPcap, NULLMENU, 2, {
561       {"add", "Add New Printcap Entry to Database"},
562       {"name", "name: "},
563     } },
564     { ChngPcap, NULLMENU, 2, {
565       {"change", "Update Printer Information"},
566       {"name", "name: "},
567     } },
568     { DeletePcap, NULLMENU, 2, {
569       {"delete", "Delete Printcap Entry"},
570       {"name", "Printer Name: "}
571     } }
572   }
573 };
574
575
576 /*
577  * Miscellaneous Menu
578  */
579
580 Menu misc_menu = {
581     NULLFUNC,
582     NULLFUNC,
583     "Miscellaneous Menu",
584     4,
585     {
586         SIMPLEFUNC("statistics", "Show database statistics", TableStats),
587         SIMPLEFUNC("clients", "Show active SMS clients", ShowClients),
588         { ShowValue, NULLMENU, 2, {
589             {"getval", "Show a database variable value"},
590             {"name", "variable name: "},
591         } },
592         { ShowAlias, NULLMENU, 3, {
593             {"getalias", "Show an alias relation"},
594             {"name", "Alias name: "},
595             {"type", "Alias type: "},
596         } },
597     }
598 };
599
600
601 /* ------------------------- Root Menu ------------------------- */
602
603 /* 
604  * Sms top menu
605  */
606
607 Menu sms_top_menu = {
608   NULLFUNC,
609   NULLFUNC,
610   "Sms Database Manipulation",
611   9,
612   {
613     SUBMENU("cluster","Cluster Menu",&cluster_menu),
614     SUBMENU("filesys","Filesystem Menu", &filesys_menu),
615     SUBMENU("list","Lists and Group Menu", &list_menu),
616     SUBMENU("machine","Machine Menu",&machine_menu),
617     SUBMENU("nfs","NFS Physical Menu", &nfsphys_menu),
618     SUBMENU("user","User Menu", &user_menu),
619     SUBMENU("printer", "Printer Menu", &printer_menu),
620     SUBMENU("dcm", "DCM Menu", &dcm_menu),
621     SUBMENU("misc", "Miscellaneous Menu", &misc_menu)
622   }
623 };  
This page took 0.076893 seconds and 3 git commands to generate.