1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains the hostmanager <--> client interaction routines.
4 * Created by: David C. Jedlinsky
6 * $Id: zhm_client.c,v 1.12 2000/04/05 14:57:37 ghudson Exp $
8 * Copyright (c) 1987 by the Massachusetts Institute of Technology.
9 * For copying and distribution information, see the file
17 static char rcsid_hm_client_c[] = "$Id: zhm_client.c,v 1.12 2000/04/05 14:57:37 ghudson Exp $";
21 extern int no_server, nclt, deactivated, noflushflag;
22 extern struct sockaddr_in cli_sin, serv_sin, from;
24 void transmission_tower(notice, packet, pak_len)
31 struct sockaddr_in gsin;
34 if (notice->z_kind == HMCTL) {
35 if (!strcmp(notice->z_opcode, CLIENT_FLUSH)) {
37 syslog(LOG_INFO, "Client requested hm flush (disabled).");
39 send_flush_notice(HM_FLUSH);
42 } else if (!strcmp(notice->z_opcode, CLIENT_NEW_SERVER)) {
43 new_server((char *)NULL);
45 syslog (LOG_INFO, "Bad control notice from client.");
49 if (notice->z_kind != UNSAFE) {
52 gack.z_message_len = 0;
53 gack.z_multinotice = "";
55 gsin.sin_port = from.sin_port;
57 gack.z_port = from.sin_port;
58 DPR2 ("Client Port = %u\n", ntohs(gack.z_port));
59 notice->z_port = gack.z_port;
60 if ((ret = ZSetDestAddr(&gsin)) != ZERR_NONE) {
62 com_err("hm", ret, "setting destination");
64 /* Bounce ACK to library */
65 if ((ret = send_outgoing(&gack)) != ZERR_NONE) {
67 com_err("hm", ret, "sending raw notice");
72 DPR2 ("Server Port = %u\n", ntohs(serv_sin.sin_port));
73 if ((ret = ZSetDestAddr(&serv_sin)) != ZERR_NONE) {
75 com_err("hm", ret, "setting destination");
77 if ((ret = send_outgoing(notice)) != ZERR_NONE) {
79 com_err("hm", ret, "while sending raw notice");
82 if (add_notice_to_queue(notice, packet, &gsin, pak_len) != ZERR_NONE)
83 syslog(LOG_INFO, "Hey! Insufficient memory to add notice to queue!");
94 if (!(packet = (char *) malloc((unsigned)sizeof(ZPacket_t))))
97 if ((retval = ZFormatSmallRawNotice(notice, packet, &length))
102 retval = ZSendPacket(packet, length, 0);