summaryrefslogtreecommitdiff
path: root/zhm/zhm_client.c
diff options
context:
space:
mode:
authorGravatar Greg Hudson <ghudson@mit.edu>1997-09-14 18:12:16 +0000
committerGravatar Greg Hudson <ghudson@mit.edu>1997-09-14 18:12:16 +0000
commitce6018836c422c86a729ba39fe5433ec11b87b02 (patch)
treecc2e6601489384fcf41e0565e8906822897b46c8 /zhm/zhm_client.c
parentac16f380e349fa39ec7e26bccb5456cb300006a5 (diff)
Pull in sources from zephyr locker. See /mit/zephyr/repository for
detailed change information.
Diffstat (limited to 'zhm/zhm_client.c')
-rw-r--r--zhm/zhm_client.c125
1 files changed, 60 insertions, 65 deletions
diff --git a/zhm/zhm_client.c b/zhm/zhm_client.c
index ec41466..ff7d3ea 100644
--- a/zhm/zhm_client.c
+++ b/zhm/zhm_client.c
@@ -19,89 +19,84 @@ static char rcsid_hm_client_c[] = "$Header$";
#endif /* SABER */
#endif /* lint */
-extern int no_server, timeout_type, nclt, deactivated;
+extern int no_server, nclt, deactivated;
extern struct sockaddr_in cli_sin, serv_sin, from;
-transmission_tower(notice, packet, pak_len)
+void transmission_tower(notice, packet, pak_len)
ZNotice_t *notice;
- caddr_t packet;
+ char *packet;
int pak_len;
{
- ZNotice_t gack;
- Code_t ret;
- struct sockaddr_in gsin;
- unsigned int tleft;
+ ZNotice_t gack;
+ Code_t ret;
+ struct sockaddr_in gsin;
- nclt++;
- if (notice->z_kind == HMCTL) {
- if (!strcmp(notice->z_opcode, CLIENT_FLUSH)) {
- send_flush_notice(HM_FLUSH);
- deactivated = 1;
- }
- else if (!strcmp(notice->z_opcode, CLIENT_NEW_SERVER))
- new_server((char *)NULL);
- else
- syslog (LOG_INFO, "Bad control notice from client.");
- return;
- } else
+ nclt++;
+ if (notice->z_kind == HMCTL) {
+ if (!strcmp(notice->z_opcode, CLIENT_FLUSH)) {
+ send_flush_notice(HM_FLUSH);
+ deactivated = 1;
+ } else if (!strcmp(notice->z_opcode, CLIENT_NEW_SERVER)) {
+ new_server((char *)NULL);
+ } else {
+ syslog (LOG_INFO, "Bad control notice from client.");
+ }
+ return;
+ } else {
if (notice->z_kind != UNSAFE) {
- gack = *notice;
- gack.z_kind = HMACK;
- gack.z_message_len = 0;
- gack.z_multinotice = "";
- gsin = cli_sin;
- gsin.sin_port = from.sin_port;
- if (gack.z_port == 0)
+ gack = *notice;
+ gack.z_kind = HMACK;
+ gack.z_message_len = 0;
+ gack.z_multinotice = "";
+ gsin = cli_sin;
+ gsin.sin_port = from.sin_port;
+ if (gack.z_port == 0)
gack.z_port = from.sin_port;
- DPR2 ("Client Port = %u\n", ntohs(gack.z_port));
- notice->z_port = gack.z_port;
- if ((ret = ZSetDestAddr(&gsin)) != ZERR_NONE) {
- Zperr(ret);
- com_err("hm", ret, "setting destination");
- }
- /* Bounce ACK to library */
- if ((ret = send_outgoing(&gack)) != ZERR_NONE) {
- Zperr(ret);
- com_err("hm", ret, "sending raw notice");
- }
- }
- if (!no_server) {
- DPR2 ("Server Port = %u\n", ntohs(serv_sin.sin_port));
- if ((ret = ZSetDestAddr(&serv_sin)) != ZERR_NONE) {
- Zperr(ret);
- com_err("hm", ret, "setting destination");
+ DPR2 ("Client Port = %u\n", ntohs(gack.z_port));
+ notice->z_port = gack.z_port;
+ if ((ret = ZSetDestAddr(&gsin)) != ZERR_NONE) {
+ Zperr(ret);
+ com_err("hm", ret, "setting destination");
}
- if ((ret = send_outgoing(notice)) != ZERR_NONE) {
- Zperr(ret);
- com_err("hm", ret, "while sending raw notice");
+ /* Bounce ACK to library */
+ if ((ret = send_outgoing(&gack)) != ZERR_NONE) {
+ Zperr(ret);
+ com_err("hm", ret, "sending raw notice");
}
- if (tleft = alarm(0))
- (void)alarm(tleft);
- else {
- timeout_type = NOTICES;
- (void)alarm(rexmit_times[0]);
- }
- }
- (void)add_notice_to_queue(notice, packet, &gsin, pak_len);
+ }
+ }
+ if (!no_server) {
+ DPR2 ("Server Port = %u\n", ntohs(serv_sin.sin_port));
+ if ((ret = ZSetDestAddr(&serv_sin)) != ZERR_NONE) {
+ Zperr(ret);
+ com_err("hm", ret, "setting destination");
+ }
+ if ((ret = send_outgoing(notice)) != ZERR_NONE) {
+ Zperr(ret);
+ com_err("hm", ret, "while sending raw notice");
+ }
+ }
+ add_notice_to_queue(notice, packet, &gsin, pak_len);
}
Code_t
send_outgoing(notice)
ZNotice_t *notice;
{
- Code_t retval;
- char *packet;
- int length;
+ Code_t retval;
+ char *packet;
+ int length;
- if (!(packet = (char *) malloc((unsigned)sizeof(ZPacket_t))))
- return(ENOMEM);
+ if (!(packet = (char *) malloc((unsigned)sizeof(ZPacket_t))))
+ return(ENOMEM);
- if ((retval = ZFormatSmallRawNotice(notice, packet, &length))
- != ZERR_NONE) {
- free(packet);
- return(retval);
- }
- retval = ZSendPacket(packet, length, 0);
+ if ((retval = ZFormatSmallRawNotice(notice, packet, &length))
+ != ZERR_NONE) {
free(packet);
return(retval);
+ }
+ retval = ZSendPacket(packet, length, 0);
+ free(packet);
+ return(retval);
}
+