1 | /* This file is part of the Project Athena Zephyr Notification System. |
---|
2 | * It contains global definitions |
---|
3 | * |
---|
4 | * Created by: Robert French |
---|
5 | * |
---|
6 | * $Source: /afs/dev.mit.edu/source/repository/athena/bin/finger/zephyr.h,v $ |
---|
7 | * $Author: ambar $ |
---|
8 | * |
---|
9 | * Copyright (c) 1987 by the Massachusetts Institute of Technology. |
---|
10 | * For copying and distribution information, see the file |
---|
11 | * "mit-copyright.h". |
---|
12 | */ |
---|
13 | /* $Header: /afs/dev.mit.edu/source/repository/athena/bin/finger/zephyr.h,v 1.2 1987-08-27 16:56:51 ambar Exp $ */ |
---|
14 | |
---|
15 | #ifndef __ZEPHYR_H__ |
---|
16 | #define __ZEPHYR_H__ |
---|
17 | |
---|
18 | #include <zephyr/mit-copyright.h> |
---|
19 | #include <zephyr/zephyr_err.h> |
---|
20 | |
---|
21 | #include <errno.h> |
---|
22 | #ifndef _TYPES_ |
---|
23 | #include <sys/types.h> |
---|
24 | #endif |
---|
25 | #ifndef IPPROTO_IP |
---|
26 | #include <netinet/in.h> |
---|
27 | #endif |
---|
28 | #include <sys/time.h> |
---|
29 | #include <stdio.h> |
---|
30 | #include <krb.h> |
---|
31 | |
---|
32 | #define ZVERSIONHDR "ZEPH" |
---|
33 | #define ZVERSIONMAJOR 0 |
---|
34 | #define ZVERSIONMINOR 0 |
---|
35 | |
---|
36 | /* Types */ |
---|
37 | |
---|
38 | /* Maximum packet length */ |
---|
39 | #define Z_MAXPKTLEN 1024 |
---|
40 | |
---|
41 | /* Packet */ |
---|
42 | typedef char ZPacket_t[Z_MAXPKTLEN]; |
---|
43 | |
---|
44 | /* Packet type */ |
---|
45 | typedef enum { UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, |
---|
46 | CLIENTACK, STAT } ZNotice_Kind_t; |
---|
47 | |
---|
48 | /* Unique ID format */ |
---|
49 | typedef struct _ZUnique_Id_t { |
---|
50 | struct in_addr zuid_addr; |
---|
51 | struct timeval tv; |
---|
52 | } ZUnique_Id_t; |
---|
53 | |
---|
54 | /* Checksum */ |
---|
55 | typedef u_long ZChecksum_t; |
---|
56 | |
---|
57 | #define ZNUMFIELDS 15 |
---|
58 | |
---|
59 | /* Notice definition */ |
---|
60 | typedef struct _ZNotice_t { |
---|
61 | char *z_version; |
---|
62 | ZNotice_Kind_t z_kind; |
---|
63 | ZUnique_Id_t z_uid; |
---|
64 | #define z_sender_addr z_uid.zuid_addr |
---|
65 | struct timeval z_time; |
---|
66 | u_short z_port; |
---|
67 | int z_auth; |
---|
68 | int z_authent_len; |
---|
69 | char *z_ascii_authent; |
---|
70 | char *z_class; |
---|
71 | char *z_class_inst; |
---|
72 | char *z_opcode; |
---|
73 | char *z_sender; |
---|
74 | char *z_recipient; |
---|
75 | char *z_default_format; |
---|
76 | ZChecksum_t z_checksum; |
---|
77 | caddr_t z_message; |
---|
78 | int z_message_len; |
---|
79 | } ZNotice_t; |
---|
80 | |
---|
81 | /* Subscription structure */ |
---|
82 | typedef struct _ZSubscription_t { |
---|
83 | char *recipient; |
---|
84 | char *class; |
---|
85 | char *classinst; |
---|
86 | } ZSubscription_t; |
---|
87 | |
---|
88 | /* Function return code */ |
---|
89 | typedef int Code_t; |
---|
90 | |
---|
91 | /* Locations structure */ |
---|
92 | typedef struct _ZLocations_t { |
---|
93 | char *host; |
---|
94 | char *time; |
---|
95 | char *tty; |
---|
96 | } ZLocations_t; |
---|
97 | |
---|
98 | /* Socket file descriptor */ |
---|
99 | extern int __Zephyr_fd; |
---|
100 | |
---|
101 | /* Port number */ |
---|
102 | extern int __Zephyr_port; |
---|
103 | |
---|
104 | /* Destination (HM) addr */ |
---|
105 | extern struct sockaddr_in __HM_addr; |
---|
106 | |
---|
107 | /* Kerberos error table base */ |
---|
108 | extern int krb_err_base; |
---|
109 | |
---|
110 | /* Session key for last parsed packet - server only */ |
---|
111 | extern C_Block __Zephyr_session; |
---|
112 | |
---|
113 | /* ZCompareUIDPred definition */ |
---|
114 | extern int ZCompareUIDPred(); |
---|
115 | |
---|
116 | /* ZGetSession() macro */ |
---|
117 | #define ZGetSession() (__Zephyr_session) |
---|
118 | |
---|
119 | /* ZGetFD() macro */ |
---|
120 | #define ZGetFD() (__Zephyr_fd) |
---|
121 | |
---|
122 | /* ZQLength macro */ |
---|
123 | extern int __Q_Length; |
---|
124 | #define ZQLength() (__Q_Length) |
---|
125 | |
---|
126 | /* ZGetDestAddr() macro */ |
---|
127 | #define ZGetDestAddr() (__HM_addr) |
---|
128 | |
---|
129 | /* ZGetRealm() macro */ |
---|
130 | extern char __Zephyr_realm[]; |
---|
131 | #define ZGetRealm() (__Zephyr_realm) |
---|
132 | |
---|
133 | /* Maximum queue length */ |
---|
134 | #define Z_MAXQLEN 30 |
---|
135 | |
---|
136 | /* UNIX error codes */ |
---|
137 | extern int errno; |
---|
138 | |
---|
139 | /* Random declarations */ |
---|
140 | extern char *ZGetSender(); |
---|
141 | |
---|
142 | /* Successful function return */ |
---|
143 | #define ZERR_NONE 0 |
---|
144 | |
---|
145 | /* Hostmanager wait time (in secs) */ |
---|
146 | #define HM_TIMEOUT 30 |
---|
147 | |
---|
148 | /* Kerberos information */ |
---|
149 | #define SERVER_SERVICE "zephyr" |
---|
150 | #define SERVER_INSTANCE "zephyr" |
---|
151 | #define SERVER_SRVTAB "/site/zephyr/srvtab" |
---|
152 | |
---|
153 | /* Kerberos defines for ZFormatNotice, et al. */ |
---|
154 | extern int ZMakeAuthentication(); |
---|
155 | #define ZAUTH ZMakeAuthentication |
---|
156 | #define ZNOAUTH (int (*)())0 |
---|
157 | |
---|
158 | /* Packet strings */ |
---|
159 | |
---|
160 | #define ZSRVACK_SENT "SENT" /* SERVACK codes */ |
---|
161 | #define ZSRVACK_NOTSENT "LOST" |
---|
162 | #define ZSRVACK_FAIL "FAIL" |
---|
163 | |
---|
164 | /* Server internal class */ |
---|
165 | #define ZEPHYR_ADMIN_CLASS "ZEPHYR_ADMIN" /* Class */ |
---|
166 | |
---|
167 | /* Control codes sent to a server */ |
---|
168 | #define ZEPHYR_CTL_CLASS "ZEPHYR_CTL" /* Class */ |
---|
169 | |
---|
170 | #define ZEPHYR_CTL_CLIENT "CLIENT" /* Inst: From client */ |
---|
171 | #define CLIENT_SUBSCRIBE "SUBSCRIBE" /* Opcode: Subscribe */ |
---|
172 | #define CLIENT_UNSUBSCRIBE "UNSUBSCRIBE" /* Opcode: Unsubsubscribe */ |
---|
173 | #define CLIENT_CANCELSUB "CLEARSUB" /* Opcode: Clear all subs */ |
---|
174 | #define CLIENT_GIMMESUBS "GIMME" /* Opcode: Give me subs */ |
---|
175 | #define CLIENT_INCOMPSUBS "INCOMP" /* Opcode: ret - didn't fit */ |
---|
176 | |
---|
177 | #define ZEPHYR_CTL_HM "HM" /* Inst: From HM */ |
---|
178 | #define HM_BOOT "BOOT" /* Opcode: Boot msg */ |
---|
179 | #define HM_FLUSH "FLUSH" /* Opcode: Flush me */ |
---|
180 | #define HM_DETACH "DETACH" /* Opcode: Detach me */ |
---|
181 | #define HM_ATTACH "ATTACH" /* Opcode: Attach me */ |
---|
182 | |
---|
183 | /* Control codes send to a HostManager */ |
---|
184 | #define HM_CTL_CLASS "HM_CTL" /* Class */ |
---|
185 | |
---|
186 | #define HM_CTL_SERVER "SERVER" /* Inst: From server */ |
---|
187 | #define SERVER_SHUTDOWN "SHUTDOWN" /* Opcode: Server shutdown */ |
---|
188 | #define SERVER_PING "PING" /* Opcode: PING */ |
---|
189 | |
---|
190 | /* HM Statistics */ |
---|
191 | #define HM_STAT_CLASS "HM_STAT" /* Class */ |
---|
192 | |
---|
193 | #define HM_STAT_CLIENT "HMST_CLIENT" /* Inst: From client */ |
---|
194 | #define HM_GIMMESTATS "GIMMESTATS" /* Opcode: get stats */ |
---|
195 | |
---|
196 | /* Login class messages */ |
---|
197 | #define LOGIN_CLASS "LOGIN" /* Class */ |
---|
198 | |
---|
199 | /* Class Instance is principal of user who is logging in or logging out */ |
---|
200 | |
---|
201 | #define LOGIN_USER_LOGIN "USER_LOGIN" /* Opcode: Normal User login */ |
---|
202 | #define LOGIN_QUIET_LOGIN "QUIET_LOGIN" /* Opcode: Quiet login */ |
---|
203 | #define LOGIN_USER_LOGOUT "USER_LOGOUT" /* Opcode: User logout */ |
---|
204 | |
---|
205 | /* Locate class messages */ |
---|
206 | #define LOCATE_CLASS "USER_LOCATE" /* Class */ |
---|
207 | |
---|
208 | #define LOCATE_HIDE "USER_HIDE" /* Opcode: Hide me */ |
---|
209 | #define LOCATE_UNHIDE "USER_UNHIDE" /* Opcode: Unhide me */ |
---|
210 | |
---|
211 | /* Class Instance is principal of user to locate */ |
---|
212 | |
---|
213 | #define LOCATE_LOCATE "LOCATE" /* Opcode: Locate user */ |
---|
214 | |
---|
215 | #endif !__ZEPHYR_H__ |
---|