blob: 0a325bcf9d614311e0633bd242799aec18e8d91d [file] [log] [blame]
Zesstra7ea4a032019-11-26 20:11:40 +01001NAME
2 master for LDMud 3.3
3
4DESCRIPTION
5 This directory contains descriptions for the functions that
6 LDMud expects to find in the master object (similar to lfuns,
7 but for the master object only). The name of the master object
8 is hardcoded in the parser, but can also be specified on
9 the commandline (usually to "secure/master").
10
11 The master is the gateway between the interpreter and the
12 mudlib to perform actions with mudlib specific effects. Calls
13 to the master by the interpreter have an automatic catch() in
14 effect. Functions to be called by the driver can be public
15 or static, but not private.
16
17 Note that the master is loaded first of all objects. Thus you
18 shouldn't inherit an other object, nor is the compiler able to
19 search include files (read: they must be specified with full
20 path).
21
22 Amylaar says: actually, you can inherit, but the file will be
23 loaded then before the master, which isn't good for most
24 files.
25
26 A short survey of the things that happen at system startup
27 time:
28
29 The Initialisation functions are called after (re)loading the
30 master to establish the most basic operation parameters.
31
32 The initialisation of the mud on startup follows this schedule:
33 - The interpreter evaluates the commandline options and
34 initializes itself.
35 - The master is loaded, but since the driverhooks are not set yet,
36 no standard initialisation lfun is called.
37 - get_master_uid() is called. If the result is valid, it becomes the
38 masters uid.
39 - inaugurate_master() is called.
40 - flag() is called for each given '-f' commandline option.
41 - get_simul_efun() is called.
42 - the WIZLIST is read in.
43 - epilog() is called. If it returns an array of strings,
44 they are given one at a time as argument to preload().
45 Traditionally, these strings are the filenames of the objects to
46 pre-load, which preload() then does.
47 - The interpreter sets up the IP communication and enters
48 the backend loop.
49
50 If the master is reloaded during system operation, these
51 actions are taken:
52 - The master is loaded, and its initialisation lfun is
53 called according to the settings of the driverhooks (if set).
54 - Any auto-include string and all driverhooks are cleared.
55 - get_master_uid() is called. If the result is valid, it becomes the
56 masters uid and euid.
57 - inaugurate_master() is called.
58
59 If the master was destructed, but couldn't be reloaded, the old
60 master object could be reactivated. In that case:
61 - reactivate_destructed_master() is called.
62 - inaugurate_master() is called.
63
64
65 Security hint: most of these functions are not useful to be
66 called directly from other objects and can be made private or
67 static. Unlike create(), these functions that are applied to
68 the master object are found by the interpreter even if not
69 publicly accessible.
70
71
72
73 A short reference to all expected master functions...
74 ----------------------------------------------------------------
75 Initialisation
76
77 void inaugurate_master ()
78 Perform mudlib specific setup of the master.
79
80 string get_master_uid ()
81 Return the string to be used as uid (and -euid) of a
82 (re)loaded master.
83
84 void flag (string arg)
85 Evaluate an argument given as option '-f' to the driver.
86
87 string *epilog (int eflag)
88 Perform final actions before opening the system to users.
89
90 void preload (string file)
91 Preload a given object.
92
93 void external_master_reload ()
94 Called after a reload of the master on external request.
95
96 void reactivate_destructed_master (int removed)
97 Reactivate a formerly destructed master.
98
99 string|string * get_simul_efun ()
100 Load the simul_efun object and return one or more paths of it.
101
102 ----------------------------------------------------------------
103 Handling of user connections
104
105 object connect ()
106 Handle the request for a new connection.
107
108 void disconnect (object obj)
109 Handle the loss of an IP connection.
110
111 void remove_player (object user)
112 Remove a user object from the system.
113
114 void stale_erq (closure callback)
115 Notify the loss of the erq demon.
116
117 -----------------------------------------------------------------
118 Runtime Support
119
120 object compile_object (string filename)
121 Compile a virtual object.
122
123 mixed include_file (string file, string compiled_file, int sys_include)
124 Return the full pathname for an included file. // 3.2.8 and later
125
126 mixed inherit_file (string file, string compiled_file)
127 Return the full pathname for an inherited object. // 3.2.8 and later
128
129 string get_wiz_name (string file)
130 Return the author of a file.
131
132 string printf_obj_name (object obj) // 3.2.6 and later
133 string object_name (object obj) // 3.2.1 .. 3.2.5
134 Return a printable name for an object.
135
136 mixed prepare_destruct (object obj)
137 Prepare the destruction of the given object.
138
139 void quota_demon (void)
140 Handle quotas in times of memory shortage.
141
142 void receive_imp (string host, string msg, int port)
143 Handle a received IMP message.
144
145 void slow_shut_down (int minutes)
146 Schedule a shutdown for the near future.
147
148 void notify_shutdown ()
149 Notify the master about an immediate shutdown.
150
151 -----------------------------------------------------------------
152 Error Handling
153
154 void dangling_lfun_closure ()
155 Handle a dangling lfun-closure.
156
157 void log_error (string file, string err, int warn)
158 Announce a compiler-time error or warning.
159
160 mixed heart_beat_error (object culprit, string err,
161 string prg, string curobj, int line)
162 Announce an error in the heart_beat() function.
163
164 void runtime_error (string err, string prg, string curobj, int line)
165 Announce a runtime error.
166
167 void runtime_warning (string msg, string curobj, string prg, int line)
168 Announce a runtime warning.
169
170 -----------------------------------------------------------------
171 Security and Permissions
172
173 int privilege_violation (string op, mixed who, mixed arg3, mixed arg4)
174 Validate the execution of a privileged operation.
175
176 int query_allow_shadow (object victim)
177 Validate a shadowing.
178
179 int valid_exec (string name)
180 Validate the rebinding of an IP connection by usage of efun
181 exec().
182
183 int valid_query_snoop (object obj)
184 Validate if the snoopers of an object may be revealed by
185 usage of the efun query_snoop().
186
187 int valid_snoop (object snoopee, object snooper)
188 Validate the start/stop of a snoop.
189
190 ------------------------------------------------------------------
191 Userids and depending Security
192
193 string get_bb_uid()
194 Return the string to be used as root-uid.
195
196 int|string valid_read (string path, string euid, string fun, object caller)
197 int|string valid_write (string path, string euid, string fun, object caller)
198 Validate a reading/writing file operation.
199
200 -----------------------------------------------------------------
201 ed() Support
202
203 string make_path_absolute (string str)
204 Absolutize a relative filename given to the editor.
205
206 int save_ed_setup (object who, int code)
207 Save individual settings of ed for a wizard.
208
209 int retrieve_ed_setup (object who)
210 Retrieve individual settings of ed for a wizard.
211
212 string get_ed_buffer_save_file_name (string file)
213 Return a filename for the ed buffer to be saved into.
214
215 ----------------------------------------------------------------
216 parse_command() Support (!compat, SUPPLY_PARSE_COMMAND defined)
217
218 string *parse_command_id_list ()
219 Return generic singular ids.
220
221 string *parse_command_plural_id_list ()
222 Return generic plural ids.
223
224 string *parse_command_adjectiv_id_list ()
225 Return generic adjective ids.
226
227 string *parse_command_prepos_list ()
228 Return common prepositions.
229
230 string parse_command_all_word()
231 Return the one(!) 'all' word.
232
233SEE ALSO
234 master(M), efun(E), applied(A), concepts(C), driver(D), lpc(LPC)