1 | /* $Id: globalmessage.h,v 1.2 2004-05-21 19:42:23 zacheiss Exp $ */ |
---|
2 | |
---|
3 | /* Copyright 1988, 1998 by the Massachusetts Institute of Technology. |
---|
4 | * |
---|
5 | * Permission to use, copy, modify, and distribute this |
---|
6 | * software and its documentation for any purpose and without |
---|
7 | * fee is hereby granted, provided that the above copyright |
---|
8 | * notice appear in all copies and that both that copyright |
---|
9 | * notice and this permission notice appear in supporting |
---|
10 | * documentation, and that the name of M.I.T. not be used in |
---|
11 | * advertising or publicity pertaining to distribution of the |
---|
12 | * software without specific, written prior permission. |
---|
13 | * M.I.T. makes no representations about the suitability of |
---|
14 | * this software for any purpose. It is provided "as is" |
---|
15 | * without express or implied warranty. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef __GLOBALMESSAGE_H__ |
---|
19 | #define __GLOBALMESSAGE_H__ |
---|
20 | |
---|
21 | #include <stdlib.h> |
---|
22 | #include <errno.h> |
---|
23 | #include <unistd.h> |
---|
24 | #include <fcntl.h> |
---|
25 | #include <string.h> |
---|
26 | #include "globalmessage_err.h" |
---|
27 | /* Function return code */ |
---|
28 | typedef int Code_t; |
---|
29 | |
---|
30 | #define GMS_NAME_CLASS "globalmessage" |
---|
31 | #define GMS_NAME_TYPE "sloc" |
---|
32 | |
---|
33 | #define GMS_SERV_NAME "globalmessage" |
---|
34 | #define GMS_SERV_PROTO "udp" |
---|
35 | |
---|
36 | #define GMS_MESSAGE_NAME "/var/cache/libgms/messages" |
---|
37 | |
---|
38 | #define GMS_USERFILE_NAME "/.message_times" |
---|
39 | #define GMS_USERFILE_NAME_LEN (sizeof(GMS_USERFILE_NAME)-1) |
---|
40 | |
---|
41 | #define GMS_VERSION_STRING "GMS:0" |
---|
42 | #define GMS_VERSION_STRING_LEN (sizeof(GMS_VERSION_STRING)-1) |
---|
43 | |
---|
44 | #define GMS_MAX_MESSAGE_LEN 2048 |
---|
45 | |
---|
46 | #define GMS_TIMEOUT_SEC 5 |
---|
47 | #define GMS_TIMEOUT_USEC 0 |
---|
48 | |
---|
49 | /* log_10(2^32) >= 10, plus a NL, plus a NUL */ |
---|
50 | #define GMS_TIMESTAMP_LEN 12 |
---|
51 | |
---|
52 | void view_message_by_zephyr(char *message); |
---|
53 | void view_message_by_tty(char *message); |
---|
54 | Code_t get_servername(char ***ret_name); |
---|
55 | Code_t get_message_from_server(char **ret_message, int *ret_message_size, |
---|
56 | char *server); |
---|
57 | Code_t get_a_message(char **buf); |
---|
58 | Code_t check_viewable(char *message, int checktime, int updateuser); |
---|
59 | Code_t gethost_error(void); |
---|
60 | Code_t hesiod_error(void); |
---|
61 | Code_t read_to_memory(char **ret_block, int *ret_size, int filedesc); |
---|
62 | Code_t put_fallback_file(char *message_data, int message_size, |
---|
63 | char *message_filename); |
---|
64 | Code_t get_fallback_file(char **ret_data, int *ret_size, |
---|
65 | char *message_filename); |
---|
66 | |
---|
67 | #endif /* __GLOBALMESSAGE_H__ */ |
---|