fwtool: allow udp/tcp for all user rules
[hcoop/domtool2.git] / src / domain.sig
CommitLineData
a3698041
AC
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.
dac62e84 17 *)
a3698041
AC
18
19(* Domain-related primitive actions *)
20
21signature DOMAIN = sig
22
04502362
AC
23 val declareClient : unit -> unit
24 val fakePrivileges : unit -> unit
25
b271ecb0 26 val yourPath : string -> bool
629a34f6
AC
27 val isIdent : char -> bool
28 val validHost : string -> bool
29 val validDomain : string -> bool
085b569a
CE
30 val validIpv6 : string -> bool
31 val validIp : string -> bool
08688401
AC
32 val yourDomain : string -> bool
33 val validUser : string -> bool
2e96b9d4 34 val validEmailUser : string -> bool
629a34f6 35
97665758
AC
36 val ip : string Env.arg
37
71420f8b
AC
38 val registerResetGlobal : (unit -> unit) -> unit
39 val registerResetLocal : (unit -> unit) -> unit
40 (* Register functions for clearing out all Domtool configuration at the global
41 * (AFS) and local levels, respectively. *)
42
43 val resetGlobal : unit -> unit
44 val resetLocal : unit -> unit
45 (* Call all registered functions *)
46
a3698041
AC
47 val registerBefore : (string -> unit) -> unit
48 val registerAfter : (string -> unit) -> unit
49 (* Register handlers to run just before and after entering a domain
50 * block. *)
51
dac62e84
AC
52 val currentDomain : unit -> string
53
e0b0abd2
AC
54 val domainFile : {node : string, name : string} -> TextIO.outstream
55 (* Open one of the current domain's configuration files for a particular
56 * node. *)
dac62e84 57
e0b80e65
AC
58 val currentAliasDomains : unit -> string list
59 val currentDomains : unit -> string list
60 (* Return the auxiliary domains being configured (not including
61 * currentDomain) or the list of all domains being configured,
62 * respectively. *)
63
64 (* The type of a set of files open for different domains. *)
65 type files = {write : string -> unit, (* Write a string to each. *)
66 writeDom : unit -> unit, (* Write each's domain name to it. *)
67 close : unit -> unit} (* Close all files. *)
68
69 val domainsFile : {node : string, name : string} -> files
70 (* Open a configuration file for every domain being configured. *)
71
e0b0abd2
AC
72 val dnsMaster : unit -> string option
73 (* Name of the node that is the DNS master for the current domain, if there
74 * is one *)
2ed6d0e5
AC
75
76 val nodes : string list
77 (* Names of all system nodes *)
9508ffdf 78 val nodeMap : (string * string) Ast.StringMap.map
2ed6d0e5 79 (* Map node names to IP addresses *)
8a7c40fa
AC
80 val nodeIp : string -> string
81 (* Look up a node in nodeMap *)
9508ffdf
CE
82 val nodeIpv6 : string -> string
83 (* Look up a node in nodeMap *)
12adf55a
AC
84
85 val setUser : string -> unit
86 val getUser : unit -> string
87 (* Name of the UNIX user providing this configuration *)
88
89 val your_domains : unit -> DataStructures.StringSet.set
90 (* The domains the current user may configure *)
8a7c40fa
AC
91
92 val your_users : unit -> DataStructures.StringSet.set
93 val your_groups : unit -> DataStructures.StringSet.set
94 val your_paths : unit -> DataStructures.StringSet.set
95 (* UNIX users, groups, and paths the user may act with *)
36e42cb8 96
9b8c6dc8 97 val get_context : unit -> OpenSSL.context
36e42cb8 98 val set_context : OpenSSL.context -> unit
60695e99 99
be1bea4c 100 val hasPriv : string -> bool
c189cbe9 101
e69e60cc 102 val rmdom : string list -> unit
1638d5a2 103 val rmdom' : string -> string list -> unit
0da1c677
AC
104
105 val homedirOf : string -> string
106 val homedir : unit -> string
314ce7bd
AC
107
108 type subject = {node : string, domain : string}
109
110 val registerDescriber : (subject -> string) -> unit
111 (* When a user runs [domtool-admin describe $DOM], every function passed to
112 * [registerDescriber] will be run on [$DOM]. *)
113 val describe : string -> string
114 (* Argument is domain to describe, over all nodes. *)
115
116 datatype description =
41c58daf 117 Filename of { filename : string, heading : string, showEmpty : bool }
314ce7bd
AC
118 | Extension of { extension : string, heading : string -> string }
119
120 val considerAll : description list -> subject -> string
121 (* Find files in a domain directory matching some patterns and generate
122 * headings and contents listings for them. *)
563e7792
AC
123
124 (* Callbacks to run whenever the set of Domtool users has changed *)
125 val registerOnUsersChange : (unit -> unit) -> unit
126 val onUsersChange : unit -> unit
a3698041 127end