| 1 | (* HCoop Domtool (http://hcoop.sourceforge.net/) |
| 2 | * Copyright (c) 2006, Adam Chlipala |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | *) |
| 18 | |
| 19 | (* Domain-related primitive actions *) |
| 20 | |
| 21 | signature DOMAIN = sig |
| 22 | |
| 23 | val declareClient : unit -> unit |
| 24 | val fakePrivileges : unit -> unit |
| 25 | |
| 26 | val yourPath : string -> bool |
| 27 | val isIdent : char -> bool |
| 28 | val validHost : string -> bool |
| 29 | val validDomain : string -> bool |
| 30 | val yourDomain : string -> bool |
| 31 | val validUser : string -> bool |
| 32 | val validEmailUser : string -> bool |
| 33 | |
| 34 | val ip : string Env.arg |
| 35 | |
| 36 | val registerResetGlobal : (unit -> unit) -> unit |
| 37 | val registerResetLocal : (unit -> unit) -> unit |
| 38 | (* Register functions for clearing out all Domtool configuration at the global |
| 39 | * (AFS) and local levels, respectively. *) |
| 40 | |
| 41 | val resetGlobal : unit -> unit |
| 42 | val resetLocal : unit -> unit |
| 43 | (* Call all registered functions *) |
| 44 | |
| 45 | val registerBefore : (string -> unit) -> unit |
| 46 | val registerAfter : (string -> unit) -> unit |
| 47 | (* Register handlers to run just before and after entering a domain |
| 48 | * block. *) |
| 49 | |
| 50 | val currentDomain : unit -> string |
| 51 | |
| 52 | val domainFile : {node : string, name : string} -> TextIO.outstream |
| 53 | (* Open one of the current domain's configuration files for a particular |
| 54 | * node. *) |
| 55 | |
| 56 | val currentAliasDomains : unit -> string list |
| 57 | val currentDomains : unit -> string list |
| 58 | (* Return the auxiliary domains being configured (not including |
| 59 | * currentDomain) or the list of all domains being configured, |
| 60 | * respectively. *) |
| 61 | |
| 62 | (* The type of a set of files open for different domains. *) |
| 63 | type files = {write : string -> unit, (* Write a string to each. *) |
| 64 | writeDom : unit -> unit, (* Write each's domain name to it. *) |
| 65 | close : unit -> unit} (* Close all files. *) |
| 66 | |
| 67 | val domainsFile : {node : string, name : string} -> files |
| 68 | (* Open a configuration file for every domain being configured. *) |
| 69 | |
| 70 | val dnsMaster : unit -> string option |
| 71 | (* Name of the node that is the DNS master for the current domain, if there |
| 72 | * is one *) |
| 73 | |
| 74 | val nodes : string list |
| 75 | (* Names of all system nodes *) |
| 76 | val nodeMap : string Ast.StringMap.map |
| 77 | (* Map node names to IP addresses *) |
| 78 | val nodeIp : string -> string |
| 79 | (* Look up a node in nodeMap *) |
| 80 | |
| 81 | val setUser : string -> unit |
| 82 | val getUser : unit -> string |
| 83 | (* Name of the UNIX user providing this configuration *) |
| 84 | |
| 85 | val your_domains : unit -> DataStructures.StringSet.set |
| 86 | (* The domains the current user may configure *) |
| 87 | |
| 88 | val your_users : unit -> DataStructures.StringSet.set |
| 89 | val your_groups : unit -> DataStructures.StringSet.set |
| 90 | val your_paths : unit -> DataStructures.StringSet.set |
| 91 | (* UNIX users, groups, and paths the user may act with *) |
| 92 | |
| 93 | val get_context : unit -> OpenSSL.context |
| 94 | val set_context : OpenSSL.context -> unit |
| 95 | |
| 96 | val hasPriv : string -> bool |
| 97 | |
| 98 | val rmdom : string list -> unit |
| 99 | val rmdom' : string -> string list -> unit |
| 100 | |
| 101 | val homedirOf : string -> string |
| 102 | val homedir : unit -> string |
| 103 | |
| 104 | type subject = {node : string, domain : string} |
| 105 | |
| 106 | val registerDescriber : (subject -> string) -> unit |
| 107 | (* When a user runs [domtool-admin describe $DOM], every function passed to |
| 108 | * [registerDescriber] will be run on [$DOM]. *) |
| 109 | val describe : string -> string |
| 110 | (* Argument is domain to describe, over all nodes. *) |
| 111 | |
| 112 | datatype description = |
| 113 | Filename of { filename : string, heading : string, showEmpty : bool } |
| 114 | | Extension of { extension : string, heading : string -> string } |
| 115 | |
| 116 | val considerAll : description list -> subject -> string |
| 117 | (* Find files in a domain directory matching some patterns and generate |
| 118 | * headings and contents listings for them. *) |
| 119 | |
| 120 | (* Callbacks to run whenever the set of Domtool users has changed *) |
| 121 | val registerOnUsersChange : (unit -> unit) -> unit |
| 122 | val onUsersChange : unit -> unit |
| 123 | end |