summaryrefslogtreecommitdiff
path: root/src/z_pack.pkg
blob: c2582e455d80ecfd3d1b057d3b05a8c10e504602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
/* File: z_pack.pkg */

/*
 * Purpose: Lua interface defitions for z-*.c
 * To be processed by tolua to generate C source code.
 */

$#include "angband.h"

/** @typedef cptr
 * @note String
 */
typedef char* cptr;
/** @typedef errr
 * @note Number
 */
typedef int errr;
/** @typedef bool
 * @note Boolean
 */
typedef unsigned char bool;
/** @typedef byte
 * @note Number
 */
typedef unsigned char byte;
/** @typedef s16b
 * @note Number
 */
typedef signed short s16b;
/** @typedef u16b
 * @note Number
 */
typedef unsigned short u16b;
/** @typedef s32b
 * @note Number
 */
typedef signed int s32b;
/** @typedef u32b
 * @note Number
 */
typedef unsigned int u32b;

/** @name Terminal actions
 * @{ */
/** @def TERM_XTRA_EVENT
 * @note Process some pending events 
 */
#define TERM_XTRA_EVENT	1	
/** @def TERM_XTRA_FLUSH
 * @note Flush all pending events 
 */
#define TERM_XTRA_FLUSH 2	
/** @def TERM_XTRA_CLEAR
 * @note Clear the entire window 
 */
#define TERM_XTRA_CLEAR 3	
/** @def TERM_XTRA_SHAPE
 * @note Set cursor shape (optional) 
 */
#define TERM_XTRA_SHAPE 4	
/** @def TERM_XTRA_FROSH
 * @note Flush one row (optional) 
 */
#define TERM_XTRA_FROSH 5	
/** @def TERM_XTRA_FRESH
 * @note Flush all rows (optional) 
 */
#define TERM_XTRA_FRESH 6	
/** @def TERM_XTRA_NOISE
 * @note Make a noise (optional) 
 */
#define TERM_XTRA_NOISE 7	
/** @def TERM_XTRA_SOUND
 * @note Make a sound (optional) 
 */
#define TERM_XTRA_SOUND 8	
/** @def TERM_XTRA_BORED
 * @note Handle stuff when bored (optional) 
 */
#define TERM_XTRA_BORED 9	
/** @def TERM_XTRA_REACT
 * @note React to global changes (optional) 
 */
#define TERM_XTRA_REACT 10	
/** @def TERM_XTRA_ALIVE
 * @note Change the "hard" level (optional) 
 */
#define TERM_XTRA_ALIVE 11	
/** @def TERM_XTRA_LEVEL
 * @note Change the "soft" level (optional) 
 */
#define TERM_XTRA_LEVEL 12	
/** @def TERM_XTRA_DELAY
 * @note Delay some milliseconds (optional) 
 */
#define TERM_XTRA_DELAY 13	
/** @def TERM_XTRA_GET_DELAY
 * @note Get the cuyrrent time in milliseconds (optional) 
 */
#define TERM_XTRA_GET_DELAY 14	
/** @def TERM_XTRA_SCANSUBDIR
 * @note Scan for subdir in a dir 
 */
#define TERM_XTRA_SCANSUBDIR 15 
/** @} */

/** @var Term_xtra_long
 * @brief Number
 */
extern long Term_xtra_long;

/** @var scansubdir_dir[1024]
 * @brief String
 * @note The directory which is scanned for sub-directories.
 */
char scansubdir_dir[1024];

/** @var scansubdir_max
 * @brief Number
 * @note The number of entries in the scansubdir_result array.
 */
int scansubdir_max;

/** @var scansubdir_result[scansubdir_max]
 * @brief String
 * @note The sub-directories of scansubdir_dir directory.
 */
cptr scansubdir_result[scansubdir_max];

/** @fn Term_xtra(int n, int v)
 * @brief Generic function to perform system dependant terminal actions.\n
 * @param n Number \n a terminal action (see TERM_XTRA fields).
 * @brief Terminal action
 * @param v Number \n variable depending on the terminal action.
 * @brief Variable
 * @return Number \n Result of the terminal action.
 * @note
 * The "Term->xtra_hook" hook provides a variety of different functions,
 * based on the first parameter (which should be taken from the various
 * TERM_XTRA_* defines) and the second parameter (which may make sense
 * only for some first parameters).  It is available to the program via
 * the "Term_xtra()" function, though some first parameters are only
 * "legal" when called from inside this package.
 * @note (see file z-term.c)
 */
extern errr Term_xtra(int n, int v);

/** @fn Term_set_cursor(int v)
 * @brief Set the cursor visibility.\n
 * @param v Number \n v is the visibility.
 * @brief Visibility
 * @return Number \n 1 if visibility was unchanged, otherwise 0.
 * @note
 * Cursor visibility (field "cv") is defined as a boolean, so take care what
 * value is assigned to "v".
 * @note (see file z-term.c)
 */
extern errr Term_set_cursor(int v);

/** @fn Term_gotoxy(int x, int y)
 * @brief Place the cursor at a given location.\n
 * @param x Number \n x-coordinate of target location.
 * @brief X-coordinate
 * @param y Number \n y-coordinate of target location.
 * @brief Y-coordinate
 * @return Number \n -1 if cursor could not be placed at given location,
 * otherwise 0.
 * @note
 * Note -- "illegal" requests do not move the cursor.\n\n
 * The cursor is flagged as useful if it placed okay.
 * @note (see file z-term.c)
 */
extern errr Term_gotoxy(int x, int y);

/** @fn Term_putch(int x, int y, byte a, char c)
 * @brief Move to a location and, using an attr, add a char.\n
 * @param x Number \n x-coordinate of target location.
 * @brief X-coordinate
 * @param y Number \n y-coordinate of target location.
 * @brief Y-coordinate
 * @param a Number \n attribute of character.
 * @brief Attribute
 * @param c String \n the character.
 * @brief Character
 * @return Number \n <0 if error, 0 if success, 1 if success but cursor is
 * useless.
 * @note
 * We return "-2" if the character is "illegal". XXX XXX\n\n
 * We return "-1" if the cursor is currently unusable.\n\n
 * We queue the given attr/char for display at the current
 * cursor location, and advance the cursor to the right,
 * marking it as unuable and returning "1" if it leaves
 * the screen, and otherwise returning "0".\n\n
 * So when this function returns a positive value, future calls to this
 * function will return negative ones.
 * @note (see file z-term.c)
 */
extern errr Term_putch(int x, int y, byte a, char c);

/** @fn Term_putstr(int x, int y, int n, byte a, cptr s)
 * @brief Move to a location and, using an attr, add a string.\n
 * @param x Number \n x-coordinate of target location.
 * @brief X-coordinate
 * @param y Number \n y-coordinate of target location.
 * @brief Y-coordinate
 * @param n Number \n length of string.
 * @brief Length
 * @param a Number \n attribute of string.
 * @brief Attribute
 * @param s String \n the string.
 * @brief String
 * @return Number \n <0 if error, 0 if success, 1 if success but cursor is
 * useless.
 * @note
 * For length "n", using negative values to imply the largest possible value,
 * and then we use the minimum of this length and the "actual" length of the
 * string as the actual number of characters to attempt to display, never
 * displaying more characters than will actually fit, since we do NOT attempt
 * to "wrap" the cursor at the screen edge.\n\n
 * We return "-1" if the cursor is currently unusable.\n
 * We return "N" if we were "only" able to write "N" chars, even if all of the
 * given characters fit on the screen, and mark the cursor as unusable for
 * future attempts.\n\n
 * So when this function, returns a positive value, future calls to this
 * function will return negative ones.
 * @note (see file z-term.c)
 */
extern errr Term_putstr(int x, int y, int n, byte a, cptr s);

/** @fn Term_clear(void)
 * @brief Clear the entire window, and move to the top left corner.
 * @return Number \n 0 (always).
 * @note
 * Note the use of the special "total_erase" code
 * @note (see file z-term.c)
 */
extern errr Term_clear(void);

/** @fn Term_redraw(void)
 * @brief Redraw (and refresh) the whole window.
 * @return Number \n 0 (always).
 * @note (see file z-term.c)
 */
extern errr Term_redraw(void);

/** @fn Term_redraw_section(int x1, int y1, int x2, int y2)
 * @brief Redraw part of a window.\n
 * @param x1 Number \n x-coordinate of top-left location.
 * @brief X-coordinate (top left)
 * @param y1 Number \n y-coordinate of top-left location.
 * @brief Y-coordinate (top left)
 * @param x2 Number \n x-coordinate of bottom-right location.
 * @brief X-coordinate (bottom right)
 * @param y2 Number \n y-coordinate of bottom-right location.
 * @brief Y-coordinate (bottom right)
 * @return Number \n 0 (always).
 * @note (see file z-term.c)
 */
extern errr Term_redraw_section(int x1, int y1, int x2, int y2);

/** @fn Term_get_size(int *w, int *h)
 * @brief Extract the current window size.\n
 * @param *w Number
 * @brief Screen width
 * @param *h Number
 * @brief Screen height
 * @return Number \n 0 (always).
 * @return *w Number \n The width of the screen (in characters).
 * @return *h Number \n The height of the screen (in characters).
 * @note (see file z-term.c)
 */
extern errr Term_get_size(int *w, int *h);

/*
 * random numbers
 */
$static s32b lua_rand_int(s32b m) {return rand_int(m);}

/** @fn rand_int(s32b m);
 * @brief Generate a random integer between 0 and (m - 1).\n
 * @param m Number \n maximum value of random integer. The random integer
 * will be less than "m".
 * @brief Maximum
 * @return Number \n The random number.
 * @note (see file w_z_pack.c)
 */
static s32b lua_rand_int @ rand_int(s32b m);

/*
 * Generates a random long integer X where A<=X<=B
 * The integer X falls along a uniform distribution.
 * Note: rand_range(0,N-1) == rand_int(N)
 */
$static s32b lua_rand_range(s32b A, s32b B) {return ((A) + (rand_int(1+(B)-(A))));}

/** @fn  rand_range(s32b A, s32b B);
 * @brief Generate a random integer between A and B inclusive.\n
 * @param A Number \n minimum number.
 * @brief Minimum
 * @param B Number \n maximum number.
 * @brief Maximum
 * @return Number \n The random number.
 * @note (see file w_z_pack.c)
 */
static s32b lua_rand_range @ rand_range(s32b A, s32b B);

/*
 * Generate a random long integer X where A-D<=X<=A+D
 * The integer X falls along a uniform distribution.
 * Note: rand_spread(A,D) == rand_range(A-D,A+D)
 */
$static s32b lua_rand_spread(s32b A, s32b D) {return ((A) + (rand_int(1+(D)+(D))) - (D));}

/** @fn  rand_spread(s32b A, s32b D);
 * @brief Generate a radom integer between A-D and A+D inclusive.\n
 * @param A Number \n average number.
 * @brief Average
 * @param D Number \n deviation from average.
 * @brief Deviation
 * @return Number \n The random number.
 * @note (see file w_z_pack.c)
 */
static s32b lua_rand_spread @ rand_spread(s32b A, s32b D);


/*
 * Generate a random long integer X where 1<=X<=M
 * Also, "correctly" handle the case of M<=1
 */
$static s32b lua_randint(s32b m) {return rand_int(m) + 1;}

/** @fn  randint(s32b m);
 * @brief Generate a random integer between 1 and M inclusive.\n
 * @param m Number \n maximum value of random integer.
 * @brief Maximum
 * @return Number \n The random number.
 * @note (see file w_z_pack.c)
 */
static s32b lua_randint @ randint(s32b m);


/*
 * Evaluate to TRUE "P" percent of the time
 */
$static bool lua_magik(s32b P) {return (rand_int(100) < (P));}

/** @fn  magik(s32b P);
 * @brief Return TRUE "P" % of the time.
 * @param P Number \n percent chance the function returns TRUE.
 * @brief Percent true
 * @return Boolean \n TRUE if a random number from 0 to 99 is less than P,
 * otherwise FALSE.
 * @note (see file w_z_pack.c)
 */
static bool lua_magik @ magik(s32b P);


/**** Available Variables ****/
/** @var Rand_quick
 * @brief Boolean
 * @note
 * If this is TRUE, then use the "simple" Random Number Generator.\n
 * If this is FALSE, then use the "complex" Random Number Generator.
 */
extern bool Rand_quick;

/** @var Rand_value
 * @brief Number
 * @note
 * The current value (seed) of the simple Random Number Generator.
 */
extern u32b Rand_value;

/**** Available Functions ****/
/** @fn damroll(int num, int sides)
 * @brief Generates damage for "2d6" style dice rolls.\n
 * @param num Number \n the number of "dice" used.
 * @brief Number
 * @param sides Number \n the number of sides on each "die".
 * @brief Sides
 * @return Number \n The random number.
 * @note
 * The function simulates the rolling of "num" "sides"-sided dice. Each die
 * will result in a random number from 1 to "sides".
 * @note (see file z-rand.c)
 */
extern s16b damroll(int num, int sides);

/** @fn maxroll(int num, int sides)
 * @brief Generate the maximum damage for "num" dice with "sides" sides each.
 * @param num Number \n The number of "dice" used.
 * @brief Number
 * @param sides Number \n The number of sides on each "die".
 * @brief Sides
 * @return Number \n "num" * "sides".
 * @note (see file z-rand.c)
 */
extern s16b maxroll(int num, int sides);





/*
 ****************** ZSOCKS ***************
 */

/** @struct ip_connection
 * This represents an IP connection
 */
struct ip_connection
{
	/** @var setup
	 * @brief Boolean
	 * @note Has it been setted up yet? 
	 */
	bool setup;

	/** @var conn_ip
	 * @brief Number
	 * @note The IP where to connect to 
	 */
	long conn_ip;

	/** @var conn_port
	 * @brief Number
	 * @note The port where to connect to 
	 */
	int conn_port;
	
	/** @var conn_type
	 * @brief Number
	 * @note Type of connection 
	 */
	byte conn_type;

	/** @var connected
	 * @brief Boolean
	 * @note The connection status 
	 */
	bool connected;
	
	/** @var *socket
	 * @brief void
	 * @note The socket for the connection 
	 */
	void *socket;

	/** @var server
	 * @brief Boolean
	 * @note Is it a server socket ? 
	 */
	bool server;
};

/*
 * Possible connection types
 */
/** @def ZSOCK_TYPE_TCP */
#define ZSOCK_TYPE_TCP  	1

/* #define ZSOCK_TYPE_UDP  	2 */


/** @def ZSOCK_TIMER_DELAY
 * @note The time in milliseconds when to call the sockets callbacks for the
 * timer
 */
#define ZSOCK_TIMER_DELAY       100


/** @struct zsock_hooks
 * @note Hooks needed for a main-foo.c to be sock-able
 */
struct zsock_hooks
{
	/** @fn *new_connection()
	 * @brief Creates an IP connection.
	 * @return ip_connection \n An IP connection.
	 * @note (see file z-sock.c)
	 */
	ip_connection *new_connection();

	/** @fn free_connection(ip_connection *c)
	 * @brief Free IP connection "c".\n
	 * @param *c ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @note (see file z-sock.c)
	 */
	void free_connection(ip_connection *c);
	
	/** @fn setup(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server)
	 * @brief Setup a connection, but do NOT connect.\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @param conn_ip String \n IP address of host machine.
	 * @brief Host ip address
	 * @param port Number \n port of host machine.
	 * @brief Host port
	 * @param conn_type Number \n type of connection.
	 * @brief Connection type
	 * @param server Boolean \n TRUE if this is a server socket,
     * otherwise FALSE.
	 * @brief Server socket?
	 * @return Boolean \n TRUE if socket setup successfully, otherwise FALSE.
	 * @note
     * You can not setup a connection if it is setup.
	 * @note (see file z-sock.c)
	 */
	bool setup(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server);

	/** @fn unsetup(ip_connection *conn)
	 * @brief Unsetup a connection, but and DO close before if needed.\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @return Boolean \n TRUE if socket was setup, otherwise FALSE.
	 * @note
     * You can not unset a connection if it is not setup.
     * @note (see file z-sock.c)
	 */
	bool unsetup(ip_connection *conn);

	/** @fn open(ip_connection *conn)
	 * @brief Open(connect) a well setup-ed connection.\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @return Boolean \n TRUE if connection was opened, otherwise FALSE.
	 * @note
	 * You can not open a connection if it is open.
	 * @note (see file z-sock.c)
	 */
	bool open(ip_connection *conn);

	/** @fn close(ip_connection *conn)
	 * @brief Close a connected connection.\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @return Boolean \n TRUE if connection was closed, otherwise FALSE.
	 * @note
	 * You can not close a connection if it is closed.
	 * @note (see file z-sock.c)
	 */
	bool close(ip_connection *conn);

	/** @fn write(ip_connection *conn, cptr str, int *size)
	 * @brief Send data on the connection.\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @param str String \n the string to send along the connection.
	 * @brief String
	 * @param *size Number
	 * @brief Bytes sent
	 * @return Boolean \n TRUE if string was sent successfully,
	 * otherwise FALSE.
	 * @return *size \n the number of bytes sent.
	 * @note
	 * This function will return FALSE if you write to a connection which
	 * is not connected, or if the connection has died.
	 * @note (see file z-sock.c)
	 */
	bool write(ip_connection *conn, cptr str, int *size);

	/* Read data on the connection */
	 /** @fn read(ip_connection *conn, char *str, int *len, bool raw)
	  * @brief Read data on connection.\n
	  * @param *conn ip_connection \n an IP connection.
	  * @brief Ip connection
	  * @param *str String
	  * @brief String
	  * @param *len Number \n the number of bytes to read.
	  * @brief Bytes to read
	  * @param raw Boolean \n TRUE if all data is to be read at once,
	  * otherwise FALSE.
	  * @brief Read raw data?
	  * @return Boolean \n TRUE if a string was returned, otherwise FALSE.
	  * @return *str String \n The string read.
	  * @return *len Number \n The number of bytes read.
	  * @note
	  * @note (see file z-sock.c)
	  */
	/* -- DG -- This is done in script.c since it needs a specific wrapper :(
	 bool read(ip_connection *conn, char *str, int *len, bool raw);
	*/

	/** @fn write_simple(ip_connection *conn, cptr str)
	 * @brief Send data on the connection.\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @param str String \n the string to send along the connection.
	 * @brief String
	 * @return Boolean \n TRUE if string was sent successfully,
	 * otherwise FALSE.
	 * @note
	 * This is easy to use.
	 * @note (see file z-sock.c)
	 */
	bool write_simple(ip_connection *conn, cptr str);

	/* Read data on the connection -- easy to use */
	/** @fn read_simple(ip_connection *conn, char *str, int len)
	 * @brief Read data on the connection.\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @param *str String
	 * @brief String
	 * @param len Number \n the number of bytes to read.
	 * @brief Bytes to read
	 * @return Boolean \n TRUE if a string was returned, otherwise FALSE.
	 * @return *str String \n The string read.
	 * @note
	 * This function will return FALSE if you read from a connection which
	 * is not connected, or if the connection has died.
	 * @note (see file z-sock.c)
	 */
	bool read_simple(ip_connection *conn, char *str, int len);

	/* Accept a connection */
	/** @fn accept(ip_connection *conn, ip_connection *child)
	 * @brief Allow "conn" to accept a connection from "child".\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Parent ip connection
	 * @param *child ip_connection \n another IP connection.
	 * @brief Child ip connection
	 * @return Boolean \n TRUE if child socket was accepted, otherwise
	 * FALSE.
	 * @note
	 * "conn" must be a server and must be connected.
	 * @note (see file z-sock.c)
	 */
	bool accept(ip_connection *conn, ip_connection *child);

	/** @fn can_read(ip_connection *conn)
	 * @brief Check if there is any data to be read and return instantly
	 * in any case.\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @return Boolean \n TRUE if there is something to read, otherwise
	 * FALSE.
	 * @note
	 * This function will return FALSE if you read from a connection which
	 * is not connected.
	 * @note (see file z-sock.c)
	 */
	bool can_read(ip_connection *conn);

	/** @fn wait(ip_connection *conn, int seconds)
	 * @brief Wait for up to "seconds" seconds for data to read from
	 * "conn".\n
	 * @param *conn ip_connection \n an IP connection.
	 * @brief Ip connection
	 * @param seconds Number \n number of seconds to wait for something to
	 * read.
	 * @brief Seconds to wait
	 * @return Boolean TRUE if there is something to read, otherwise
	 * FALSE.
	 * @note
	 * This function will return FALSE if you wait for a connection which
	 * is not connected.
	 * @note (see file z-sock.c)
	 */
	bool wait(ip_connection *conn, int seconds);


	/*
	 * Timer stuff, I hope I can make that look better
	 */
	/** @fn add_timer(timer_callback callback)
	 * @brief Add "callback" to the list.\n
	 * @param callback timer_callback \n a callback timer.
	 * @brief Callback
	 * @return Boolean \n TRUE (always).
	 * @note
	 * If this is the first callback, the timer will be created.
	 * @note (see file z-sock.c)
	 */
	bool add_timer(timer_callback callback);

	/** @fn remove_timer(timer_callback callback)
	 * @brief Remove "callback" from the list.\n
	 * @param callback timer_callback \n a callback timer.
	 * @brief Callback
	 * @return Boolean \n TRUE (always).
	 * @note
	 * If this is the last callback, the timer will be deleted.
	 * @note (see file z-sock.c)
	 */
	bool remove_timer(timer_callback callback);
};

/** @var zsock
 * @brief zsock_hooks
 */
extern zsock_hooks zsock;