diff options
author | Kenneth G Raeburn <raeburn@mit.edu> | 1990-07-16 05:43:44 +0000 |
---|---|---|
committer | Kenneth G Raeburn <raeburn@mit.edu> | 1990-07-16 05:43:44 +0000 |
commit | 5f77c3fe4aa2045bda2c973faaa144a5a3e50dac (patch) | |
tree | a806a705b6a36e1d41a4b1ddeeb357f501fef83d /h/zephyr | |
parent | 8e71505171db58a566fff7081f8e252dfabd17ec (diff) |
Added prototypes and some C++-compatibility code.
[audited by jfc]
Diffstat (limited to 'h/zephyr')
-rw-r--r-- | h/zephyr/zephyr.h | 243 |
1 files changed, 136 insertions, 107 deletions
diff --git a/h/zephyr/zephyr.h b/h/zephyr/zephyr.h index 41acad8..ceac0ee 100644 --- a/h/zephyr/zephyr.h +++ b/h/zephyr/zephyr.h @@ -8,7 +8,7 @@ * * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. * For copying and distribution information, see the file - * "mit-copyright.h". + * "mit-copyright.h". */ /* $Header$ */ @@ -26,160 +26,185 @@ #endif #include <sys/time.h> #include <stdio.h> + +#ifdef __cplusplus +extern "C" { +#endif + #ifdef KERBEROS #include <krb.h> #endif +#if defined(__STDC__) || defined(__cplusplus) +#define Zproto(X) X +#else +#define Zproto(X) () +#endif + #define ZVERSIONHDR "ZEPH" #define ZVERSIONMAJOR 0 #define ZVERSIONMINOR 2 -/* Types */ + /* Types */ - /* Maximum size packet we can send */ + /* Maximum size packet we can send */ #define Z_MAXPKTLEN 1024 - /* Packet */ -typedef char ZPacket_t[Z_MAXPKTLEN]; + /* Packet */ + typedef char ZPacket_t[Z_MAXPKTLEN]; - /* Maximum size for a notice header */ + /* Maximum size for a notice header */ #define Z_MAXHEADERLEN 800 - /* Maximum number of unknown fields in ZNotice_t */ + /* Maximum number of unknown fields in ZNotice_t */ #define Z_MAXOTHERFIELDS 10 - /* Authentication levels returned by ZCheckAuthentication */ + /* Authentication levels returned by ZCheckAuthentication */ #define ZAUTH_FAILED (-1) #define ZAUTH_YES 1 #define ZAUTH_NO 0 - /* Packet type */ -typedef enum { UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, - CLIENTACK, STAT } ZNotice_Kind_t; + /* Packet type */ + typedef enum { UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, + CLIENTACK, STAT } ZNotice_Kind_t; - /* Unique ID format */ -typedef struct _ZUnique_Id_t { - struct in_addr zuid_addr; - struct timeval tv; -} ZUnique_Id_t; + /* Unique ID format */ + typedef struct _ZUnique_Id_t { + struct in_addr zuid_addr; + struct timeval tv; + } ZUnique_Id_t; - /* Checksum */ -typedef u_long ZChecksum_t; + /* Checksum */ + typedef u_long ZChecksum_t; #define ZNUMFIELDS 17 - /* Notice definition */ -typedef struct _ZNotice_t { - char *z_packet; - char *z_version; - ZNotice_Kind_t z_kind; - ZUnique_Id_t z_uid; + /* Notice definition */ + typedef struct _ZNotice_t { + char *z_packet; + char *z_version; + ZNotice_Kind_t z_kind; + ZUnique_Id_t z_uid; #define z_sender_addr z_uid.zuid_addr - struct timeval z_time; - u_short z_port; - int z_auth; - int z_authent_len; - char *z_ascii_authent; - char *z_class; - char *z_class_inst; - char *z_opcode; - char *z_sender; - char *z_recipient; - char *z_default_format; - char *z_multinotice; - ZUnique_Id_t z_multiuid; - ZChecksum_t z_checksum; - int z_num_other_fields; - char *z_other_fields[Z_MAXOTHERFIELDS]; - caddr_t z_message; - int z_message_len; -} ZNotice_t; - - /* Subscription structure */ -typedef struct _ZSubscriptions_t { - char *recipient; - char *class; - char *classinst; -} ZSubscription_t; - - /* Function return code */ -typedef int Code_t; - - /* Locations structure */ -typedef struct _ZLocations_t { - char *host; - char *time; - char *tty; -} ZLocations_t; - - /* Socket file descriptor */ -extern int __Zephyr_fd; - - /* Port number */ -extern int __Zephyr_port; - - /* Destination (HM) addr */ -extern struct sockaddr_in __HM_addr; - - /* Kerberos error table base */ -extern int krb_err_base; + struct timeval z_time; + u_short z_port; + int z_auth; + int z_authent_len; + char *z_ascii_authent; + char *z_class; + char *z_class_inst; + char *z_opcode; + char *z_sender; + char *z_recipient; + char *z_default_format; + char *z_multinotice; + ZUnique_Id_t z_multiuid; + ZChecksum_t z_checksum; + int z_num_other_fields; + char *z_other_fields[Z_MAXOTHERFIELDS]; + caddr_t z_message; + int z_message_len; + } ZNotice_t; + + /* Subscription structure */ + typedef struct _ZSubscriptions_t { + char *recipient; +#ifdef __cplusplus + char *z_class; +#else + char *class; +#endif + char *classinst; + /* Please use these preferred names; those above will go away soon. */ +#define zsub_recipient recipient +#ifdef __cplusplus +#define zsub_class z_class +#else +#define zsub_class class +#endif +#define zsub_classinst classinst + } ZSubscription_t; + + /* Function return code */ + typedef int Code_t; + + /* Locations structure */ + typedef struct _ZLocations_t { + char *host; + char *time; + char *tty; + } ZLocations_t; + + /* Socket file descriptor */ + extern int __Zephyr_fd; + + /* Port number */ + extern int __Zephyr_port; + + /* Destination (HM) addr */ + extern struct sockaddr_in __HM_addr; + + /* Kerberos error table base */ + extern int krb_err_base; #ifdef KERBEROS - /* Session key for last parsed packet - server only */ -extern C_Block __Zephyr_session; + /* Session key for last parsed packet - server only */ + extern C_Block __Zephyr_session; #endif - /* ZCompareUIDPred definition */ -extern int ZCompareUIDPred(), ZCompareMultiUIDPred(); + /* ZCompareUIDPred definition */ + extern int ZCompareUIDPred Zproto((ZNotice_t *, ZUnique_Id_t *)), + ZCompareMultiUIDPred Zproto((ZNotice_t *, ZUnique_Id_t *)); - /* ZGetSession() macro */ + /* ZGetSession() macro */ #define ZGetSession() (__Zephyr_session) - - /* ZGetFD() macro */ + + /* ZGetFD() macro */ #define ZGetFD() (__Zephyr_fd) - /* ZQLength macro */ -extern int __Q_CompleteLength; + /* ZQLength macro */ + extern int __Q_CompleteLength; #define ZQLength() (__Q_CompleteLength) - /* ZGetDestAddr() macro */ + /* ZGetDestAddr() macro */ #define ZGetDestAddr() (__HM_addr) - /* ZGetRealm() macro */ -extern char __Zephyr_realm[]; + /* ZGetRealm() macro */ + extern char __Zephyr_realm[]; #define ZGetRealm() (__Zephyr_realm) - /* Maximum queue length */ + /* Maximum queue length */ #define Z_MAXQLEN 30 - /* UNIX error codes */ -extern int errno; + /* UNIX error codes */ + extern int errno; - /* Random declarations */ -extern char *ZGetSender(), *ZGetVariable(); -extern int ZGetWGPort(); + /* Random declarations */ + extern char *ZGetSender Zproto((void)), *ZGetVariable Zproto((char *)); + extern int ZGetWGPort Zproto((void)); - /* Successful function return */ + /* Successful function return */ #define ZERR_NONE 0 - /* Hostmanager wait time (in secs) */ + /* Hostmanager wait time (in secs) */ #define HM_TIMEOUT 30 - /* Defines for ZFormatNotice, et al. */ -extern int ZMakeAuthentication(); + /* Defines for ZFormatNotice, et al. */ + extern Code_t ZMakeAuthentication Zproto((ZNotice_t*, char *,int, int*)); + typedef Code_t (*Z_AuthProc) Zproto((ZNotice_t*, char *, int, int *)); #define ZAUTH ZMakeAuthentication -#define ZNOAUTH (int (*)())0 +#define ZNOAUTH (Z_AuthProc)0 - /* Packet strings */ + /* Packet strings */ #define ZSRVACK_SENT "SENT" /* SERVACK codes */ #define ZSRVACK_NOTSENT "LOST" #define ZSRVACK_FAIL "FAIL" - /* Server internal class */ + /* Server internal class */ #define ZEPHYR_ADMIN_CLASS "ZEPHYR_ADMIN" /* Class */ - /* Control codes sent to a server */ + /* Control codes sent to a server */ #define ZEPHYR_CTL_CLASS "ZEPHYR_CTL" /* Class */ #define ZEPHYR_CTL_CLIENT "CLIENT" /* Inst: From client */ @@ -189,7 +214,7 @@ extern int ZMakeAuthentication(); #define CLIENT_CANCELSUB "CLEARSUB" /* Opcode: Clear all subs */ #define CLIENT_GIMMESUBS "GIMME" /* Opcode: Give me subs */ #define CLIENT_GIMMEDEFS "GIMMEDEFS" /* Opcode: Give me default - subscriptions */ + * subscriptions */ #define ZEPHYR_CTL_HM "HM" /* Inst: From HM */ #define HM_BOOT "BOOT" /* Opcode: Boot msg */ @@ -197,7 +222,7 @@ extern int ZMakeAuthentication(); #define HM_DETACH "DETACH" /* Opcode: Detach me */ #define HM_ATTACH "ATTACH" /* Opcode: Attach me */ - /* Control codes send to a HostManager */ + /* Control codes send to a HostManager */ #define HM_CTL_CLASS "HM_CTL" /* Class */ #define HM_CTL_SERVER "SERVER" /* Inst: From server */ @@ -208,16 +233,16 @@ extern int ZMakeAuthentication(); #define CLIENT_FLUSH "FLUSH" /* Opcode: Send flush to srv */ #define CLIENT_NEW_SERVER "NEWSERV" /* Opcode: Find new server */ - /* HM Statistics */ + /* HM Statistics */ #define HM_STAT_CLASS "HM_STAT" /* Class */ #define HM_STAT_CLIENT "HMST_CLIENT" /* Inst: From client */ #define HM_GIMMESTATS "GIMMESTATS" /* Opcode: get stats */ - - /* Login class messages */ + + /* Login class messages */ #define LOGIN_CLASS "LOGIN" /* Class */ -/* Class Instance is principal of user who is logging in or logging out */ + /* Class Instance is principal of user who is logging in or logging out */ #define EXPOSE_NONE "NONE" /* Opcode: Not visible */ #define EXPOSE_OPSTAFF "OPSTAFF" /* Opcode: Opstaff visible */ @@ -230,17 +255,17 @@ extern int ZMakeAuthentication(); #define LOGIN_USER_LOGOUT "USER_LOGOUT" /* Opcode: User logout */ #define LOGIN_USER_FLUSH "USER_FLUSH" /* Opcode: flush all locs */ - /* Locate class messages */ + /* Locate class messages */ #define LOCATE_CLASS "USER_LOCATE" /* Class */ #define LOCATE_HIDE "USER_HIDE" /* Opcode: Hide me */ #define LOCATE_UNHIDE "USER_UNHIDE" /* Opcode: Unhide me */ -/* Class Instance is principal of user to locate */ + /* Class Instance is principal of user to locate */ #define LOCATE_LOCATE "LOCATE" /* Opcode: Locate user */ - /* WG_CTL class messages */ + /* WG_CTL class messages */ #define WG_CTL_CLASS "WG_CTL" /* Class */ #define WG_CTL_USER "USER" /* Inst: User request */ @@ -248,4 +273,8 @@ extern int ZMakeAuthentication(); #define USER_SHUTDOWN "SHUTDOWN" /* Opcode: Go catatonic */ #define USER_STARTUP "STARTUP" /* Opcode: Come out of it */ +#ifdef __cplusplus +} +#endif + #endif !__ZEPHYR_H__ |