src/protocols/zephyr/ZInit.c

changeset 2086
007508451e2c
child 2419
beb509dd2935
equal deleted inserted replaced
2085:4659ae7bc69c 2086:007508451e2c
1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains source for the ZInitialize function.
3 *
4 * Created by: Robert French
5 *
6 * $Source$
7 * $Author: warmenhoven $
8 *
9 * Copyright (c) 1987, 1991 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
11 * "mit-copyright.h".
12 */
13 /* $Header$ */
14
15 #ifndef lint
16 static char rcsid_ZInitialize_c[] =
17 "$Zephyr: /afs/athena.mit.edu/astaff/project/zephyr/src/lib/RCS/ZInitialize.c,v 1.17 89/05/30 18:11:25 jtkohl Exp $";
18 #endif
19
20 #include <internal.h>
21
22 #include <sys/socket.h>
23 #ifdef ZEPHYR_USES_KERBEROS
24 #include <krb_err.h>
25 #endif
26
27 Code_t ZInitialize()
28 {
29 struct servent *hmserv;
30 char addr[4];
31 #ifdef ZEPHYR_USES_KERBEROS
32 int krbval;
33
34 initialize_krb_error_table();
35 #endif
36
37 initialize_zeph_error_table();
38
39 (void) memset((char *)&__HM_addr, 0, sizeof(__HM_addr));
40
41 __HM_addr.sin_family = AF_INET;
42
43 /* Set up local loopback address for HostManager */
44 addr[0] = 127;
45 addr[1] = 0;
46 addr[2] = 0;
47 addr[3] = 1;
48
49 hmserv = (struct servent *)getservbyname(HM_SVCNAME, "udp");
50 __HM_addr.sin_port = (hmserv) ? hmserv->s_port : HM_SVC_FALLBACK;
51
52 (void) memcpy((char *)&__HM_addr.sin_addr, addr, 4);
53
54 __HM_set = 0;
55
56 #ifdef ZEPHYR_USES_KERBEROS
57 if ((krbval = krb_get_lrealm(__Zephyr_realm, 1)) != KSUCCESS)
58 return (krbval);
59 #endif
60
61 /* Get the sender so we can cache it */
62 (void) ZGetSender();
63
64 /* Initialize the input queue */
65 __Q_Tail = NULL;
66 __Q_Head = NULL;
67
68 return (ZERR_NONE);
69 }

mercurial