diff options
-rw-r--r-- | hunt/huntd/Makefile | 6 | ||||
-rw-r--r-- | hunt/huntd/ctl.c | 85 | ||||
-rw-r--r-- | hunt/huntd/ctl_transact.c | 128 | ||||
-rw-r--r-- | hunt/huntd/faketalk.c | 199 | ||||
-rw-r--r-- | hunt/huntd/get_names.c | 174 | ||||
-rw-r--r-- | hunt/huntd/huntd.6 | 16 | ||||
-rw-r--r-- | hunt/huntd/talk_ctl.h | 106 |
7 files changed, 7 insertions, 707 deletions
diff --git a/hunt/huntd/Makefile b/hunt/huntd/Makefile index cbf07727..f3e7937c 100644 --- a/hunt/huntd/Makefile +++ b/hunt/huntd/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.1 1997/10/04 09:11:21 mrg Exp $ +# $NetBSD: Makefile,v 1.2 2014/03/29 20:32:04 dholland Exp $ PROG= huntd -SRCS= answer.c ctl.c ctl_transact.c draw.c driver.c execute.c expl.c \ - extern.c faketalk.c get_names.c makemaze.c pathname.c shots.c terminal.c +SRCS= answer.c draw.c driver.c execute.c expl.c \ + extern.c faketalk.c makemaze.c pathname.c shots.c terminal.c MAN= huntd.6 .include <bsd.prog.mk> diff --git a/hunt/huntd/ctl.c b/hunt/huntd/ctl.c deleted file mode 100644 index d847ad39..00000000 --- a/hunt/huntd/ctl.c +++ /dev/null @@ -1,85 +0,0 @@ -/* $NetBSD: ctl.c,v 1.7 2014/03/29 20:16:09 dholland Exp $ */ -/* - * Copyright (c) 1983-2003, Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * + Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * + Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * + Neither the name of the University of California, San Francisco nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(TALK_43) || defined(TALK_42) - -#include <sys/cdefs.h> -#ifndef lint -#if 0 -static char sccsid[] = "@(#)ctl.c 5.2 (Berkeley) 3/13/86"; -#else -__RCSID("$NetBSD: ctl.c,v 1.7 2014/03/29 20:16:09 dholland Exp $"); -#endif -#endif /* not lint */ - -/* - * This file handles haggling with the various talk daemons to - * get a socket to talk to. sockt is opened and connected in - * the progress - */ - -#include "hunt.h" -#include "talk_ctl.h" - -struct sockaddr_in daemon_addr; -struct sockaddr_in ctl_addr; - -/* inet addresses of the two machines */ -struct in_addr my_machine_addr; -struct in_addr his_machine_addr; - -u_short daemon_port; /* port number of the talk daemon */ - -int ctl_sockt; - -CTL_MSG msg; - -/* open the ctl socket */ -void -open_ctl(void) -{ - socklen_t length; - - ctl_addr.sin_family = AF_INET; - ctl_addr.sin_port = 0; - ctl_addr.sin_addr = my_machine_addr; - ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0); - if (ctl_sockt <= 0) - p_error("Bad socket"); - if (bind(ctl_sockt, (struct sockaddr *)&ctl_addr, - sizeof(ctl_addr)) != 0) - p_error("Couldn't bind to control socket"); - length = sizeof(ctl_addr); - if (getsockname(ctl_sockt, (struct sockaddr *) &ctl_addr, &length) < 0) - p_error("Bad address for ctl socket"); -} -#endif diff --git a/hunt/huntd/ctl_transact.c b/hunt/huntd/ctl_transact.c deleted file mode 100644 index 9bae0895..00000000 --- a/hunt/huntd/ctl_transact.c +++ /dev/null @@ -1,128 +0,0 @@ -/* $NetBSD: ctl_transact.c,v 1.11 2014/03/29 20:16:09 dholland Exp $ */ -/* - * Copyright (c) 1983-2003, Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * + Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * + Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * + Neither the name of the University of California, San Francisco nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(TALK_43) || defined(TALK_42) - -#include <sys/cdefs.h> -#ifndef lint -#if 0 -static char sccsid[] = "@(#)ctl_transact.c 5.2 (Berkeley) 3/13/86"; -#else -__RCSID("$NetBSD: ctl_transact.c,v 1.11 2014/03/29 20:16:09 dholland Exp $"); -#endif -#endif /* not lint */ - -#include <sys/time.h> -#include <unistd.h> -#include "hunt.h" -#include "talk_ctl.h" - -#define CTL_WAIT 2 /* time to wait for a response, in seconds */ -#define MAX_RETRY 5 - -/* - * SOCKDGRAM is unreliable, so we must repeat messages if we have - * not received an acknowledgement within a reasonable amount - * of time - */ -void -ctl_transact(struct in_addr target, CTL_MSG tmsg, int type, CTL_RESPONSE *rp) -{ - struct pollfd set[1]; - int nready, cc, retries; - - nready = 0; - tmsg.type = type; - daemon_addr.sin_family = AF_INET; - daemon_addr.sin_addr = target; - daemon_addr.sin_port = daemon_port; - set[0].fd = ctl_sockt; - set[0].events = POLLIN; - - /* - * Keep sending the message until a response of - * the proper type is obtained. - */ - do { - /* resend message until a response is obtained */ - for (retries = MAX_RETRY; retries > 0; retries -= 1) { - cc = sendto(ctl_sockt, &tmsg, sizeof (tmsg), 0, - (struct sockaddr *) &daemon_addr, - sizeof(daemon_addr)); - if (cc != sizeof (tmsg)) { - if (errno == EINTR) - continue; - p_error("Error on write to talk daemon"); - } - nready = poll(set, 1, CTL_WAIT * 1000); - if (nready < 0) { - if (errno == EINTR) - continue; - p_error("Error waiting for daemon response"); - } - if (nready != 0) - break; - } - if (retries <= 0) - break; - /* - * Keep reading while there are queued messages - * (this is not necessary, it just saves extra - * request/acknowledgements being sent) - */ - do { - cc = recv(ctl_sockt, rp, sizeof (*rp), 0); - if (cc < 0) { - if (errno == EINTR) - continue; - p_error("Error on read from talk daemon"); - } - /* an immediate poll */ - nready = poll(set, 1, 0); - } while (nready > 0 && ( -#ifdef TALK_43 - rp->vers != TALK_VERSION || -#endif - rp->type != type)); - } while ( -#ifdef TALK_43 - rp->vers != TALK_VERSION || -#endif - rp->type != type); - rp->id_num = ntohl(rp->id_num); -#ifdef TALK_43 - rp->addr.sa_family = ntohs(rp->addr.sa_family); -#else - rp->addr.sin_family = ntohs(rp->addr.sin_family); -#endif -} -#endif diff --git a/hunt/huntd/faketalk.c b/hunt/huntd/faketalk.c index a5935cd9..2aef727b 100644 --- a/hunt/huntd/faketalk.c +++ b/hunt/huntd/faketalk.c @@ -1,4 +1,4 @@ -/* $NetBSD: faketalk.c,v 1.23 2014/03/29 20:16:09 dholland Exp $ */ +/* $NetBSD: faketalk.c,v 1.24 2014/03/29 20:32:04 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,209 +32,14 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: faketalk.c,v 1.23 2014/03/29 20:16:09 dholland Exp $"); +__RCSID("$NetBSD: faketalk.c,v 1.24 2014/03/29 20:32:04 dholland Exp $"); #endif /* not lint */ #include "hunt.h" -#if defined(TALK_43) || defined(TALK_42) - -#include <sys/time.h> -#include <sys/wait.h> -#include <ctype.h> -#include <netdb.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include "talk_ctl.h" - -/* defines for fake talk message to announce start of game */ -#ifdef TALK_43 -#define MASQUERADE "\"Hunt Game\"" -#else -#define MASQUERADE "HuntGame" -#endif -#define RENDEZVOUS "hunt-players" -#define ARGV0 "HUNT-ANNOUNCE" - -extern char *my_machine_name; - -static void do_announce(char *); -void exorcise(int); - -/* - * exorcise - disspell zombies - */ - -void -exorcise(int dummy __unused) -{ - (void) wait(0); -} - -/* - * query the local SMTP daemon to expand the RENDEZVOUS mailing list - * and fake a talk request to each address thus found. - */ - -void -faketalk(void) -{ - struct servent *sp; - char buf[BUFSIZ]; - FILE *f; - int service; /* socket of service */ - struct sockaddr_in des; /* address of destination */ - - (void) signal(SIGCHLD, exorcise); - - if (fork() != 0) - return; - - (void) signal(SIGINT, SIG_IGN); - (void) signal(SIGPIPE, SIG_IGN); - - /* - * change argv so that a ps shows ARGV0 - */ - setproctitle("%s", ARGV0); - - /* - * initialize "talk" - */ - get_local_name(MASQUERADE); - open_ctl(); - - /* - * start fetching addresses - */ - - if ((sp = getservbyname("smtp", NULL)) == NULL) { -#ifdef LOG - syslog(LOG_ERR, "faketalk: smtp protocol not supported\n"); -#else - warn("faketalk: smtp protocol not supported"); -#endif - _exit(1); - } - - memset(&des, 0, sizeof (des)); - des.sin_family = AF_INET; - des.sin_addr = my_machine_addr; - des.sin_port = sp->s_port; - - if ((service = socket(des.sin_family, SOCK_STREAM, 0)) < 0) { -#ifdef LOG - syslog(LOG_ERR, "falktalk: socket"); -#else - warn("falktalk: socket"); -#endif - _exit(1); - } - - if (connect(service, (struct sockaddr *) &des, sizeof(des)) != 0) { -#ifdef LOG - syslog(LOG_ERR, "faketalk: connect"); -#else - warn("faketalk: connect"); -#endif - _exit(1); - } - if ((f = fdopen(service, "r")) == NULL) { -#ifdef LOG - syslog(LOG_ERR, "fdopen failed\n"); -#else - warn("faketalk: fdopen"); -#endif - _exit(2); - } - - (void) fgets(buf, BUFSIZ, f); - (void) snprintf(buf, sizeof(buf), - "HELO HuntGame@%s\r\n", my_machine_name); - (void) write(service, buf, strlen(buf)); - (void) fgets(buf, BUFSIZ, f); - (void) snprintf(buf, sizeof(buf), - "EXPN %s@%s\r\n", RENDEZVOUS, my_machine_name); - (void) write(service, buf, strlen(buf)); - while (fgets(buf, BUFSIZ, f) != NULL) { - char *s, *t; - - if (buf[0] != '2' || buf[1] != '5' || buf[2] != '0') - break; - if ((s = strchr(buf + 4, '<')) == NULL) - s = buf + 4, t = buf + strlen(buf) - 1; - else { - s += 1; - if ((t = strrchr(s, '>')) == NULL) - t = s + strlen(s) - 1; - else - t -= 1; - } - while (isspace((unsigned char)*s)) - s += 1; - if (*s == '\\') - s += 1; - while (isspace((unsigned char)*t)) - t -= 1; - *(t + 1) = '\0'; - do_announce(s); /* construct and send talk request */ - if (buf[3] == ' ') - break; - } - (void) shutdown(service, 2); - (void) close(service); - _exit(0); -} - -/* - * The msg.id's for the invitations on the local and remote machines. - * These are used to delete the invitations. - */ - -static void -do_announce(char *s) -{ - CTL_RESPONSE response; - - get_remote_name(s); /* setup his_machine_addr, msg.r_name */ - -#ifdef TALK_43 - /* XXX this is nothing like a safe cast */ - msg.ctl_addr = *(struct talkd_sockaddr *) &ctl_addr; - msg.ctl_addr.sa_family = htons(msg.ctl_addr.sa_family); -#else - msg.ctl_addr = ctl_addr; - msg.ctl_addr.sin_family = htons(msg.ctl_addr.sin_family); -#endif - msg.id_num = (int) htonl((uint32_t) -1); /* an impossible id_num */ - ctl_transact(his_machine_addr, msg, ANNOUNCE, &response); - if (response.answer != SUCCESS) - return; - - /* - * Have the daemons delete the invitations now that we - * have announced. - */ - - /* we don't care if cleanup doesn't make it. */ - msg.type = DELETE; - msg.id_num = (int) htonl(response.id_num); - daemon_addr.sin_addr = his_machine_addr; - if (sendto(ctl_sockt, &msg, sizeof (msg), 0, - (struct sockaddr *) &daemon_addr, sizeof(daemon_addr)) - != sizeof(msg)) - p_error("send delete remote"); -} - -#else - void faketalk(void) { return; } -#endif diff --git a/hunt/huntd/get_names.c b/hunt/huntd/get_names.c deleted file mode 100644 index 6878c8b3..00000000 --- a/hunt/huntd/get_names.c +++ /dev/null @@ -1,174 +0,0 @@ -/* $NetBSD: get_names.c,v 1.16 2014/03/29 20:16:09 dholland Exp $ */ -/* - * Copyright (c) 1983-2003, Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * + Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * + Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * + Neither the name of the University of California, San Francisco nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -#ifndef lint -__RCSID("$NetBSD: get_names.c,v 1.16 2014/03/29 20:16:09 dholland Exp $"); -#endif /* not lint */ - -#if defined(TALK_43) || defined(TALK_42) - -#include <sys/param.h> -#include <netdb.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <assert.h> - -#include "hunt.h" -#include "talk_ctl.h" - -static char hostname[MAXHOSTNAMELEN + 1]; -char *my_machine_name; - -/* - * Determine the local user and machine - */ -void -get_local_name(const char *my_name) -{ - struct hostent *hp; - struct servent *sp; - - /* Load these useful values into the standard message header */ - msg.id_num = 0; - (void) strncpy(msg.l_name, my_name, NAME_SIZE); - msg.l_name[NAME_SIZE - 1] = '\0'; - msg.r_tty[0] = '\0'; - msg.pid = getpid(); -#ifdef TALK_43 - msg.vers = TALK_VERSION; - msg.addr.sa_family = htons(AF_INET); - msg.ctl_addr.sa_family = htons(AF_INET); -#else - msg.addr.sin_family = htons(AF_INET); - msg.ctl_addr.sin_family = htons(AF_INET); -#endif - - (void)gethostname(hostname, sizeof (hostname)); - hostname[sizeof(hostname) - 1] = '\0'; - my_machine_name = hostname; - /* look up the address of the local host */ - hp = gethostbyname(my_machine_name); - if (hp == (struct hostent *) 0) { -#ifdef LOG - syslog(LOG_ERR, - "This machine doesn't exist. Boy, am I confused!"); -#else - perror("This machine doesn't exist. Boy, am I confused!"); -#endif - exit(1); - } - memcpy(&my_machine_addr, hp->h_addr, hp->h_length); - /* find the daemon portal */ -#ifdef TALK_43 - sp = getservbyname("ntalk", "udp"); -#else - sp = getservbyname("talk", "udp"); -#endif - if (sp == 0) { -#ifdef LOG - syslog(LOG_ERR, "This machine doesn't support talk"); -#else - perror("This machine doesn't support talk"); -#endif - exit(1); - } - daemon_port = sp->s_port; -} - -/* - * Determine the remote user and machine - */ -int -get_remote_name(char *his_address) -{ - const char *his_name; - const char *his_machine_name; - char *ptr; - struct addrinfo ai0, *ai; - struct sockaddr_in *sin; - - /* check for, and strip out, the machine name of the target */ - for (ptr = his_address; *ptr != '\0' && *ptr != '@' && *ptr != ':' - && *ptr != '!' && *ptr != '.'; ptr++) - continue; - if (*ptr == '\0') { - /* this is a local to local talk */ - his_name = his_address; - his_machine_name = my_machine_name; - his_machine_addr = my_machine_addr; - } else { - if (*ptr == '@') { - /* user@host */ - his_name = his_address; - his_machine_name = ptr + 1; - } else { - /* host.user or host!user or host:user */ - his_name = ptr + 1; - his_machine_name = his_address; - } - *ptr = '\0'; - - /* - * Look up the address of the recipient's machine. - * Since this is used for sending udp talk packets, - * it has to be AF_INET. - */ - ai0.ai_flags = 0; - ai0.ai_family = AF_INET; - ai0.ai_socktype = SOCK_DGRAM; - ai0.ai_protocol = IPPROTO_UDP; - ai0.ai_addrlen = 0; - ai0.ai_addr = NULL; - ai0.ai_canonname = NULL; - ai0.ai_next = NULL; - if (getaddrinfo(his_machine_name, NULL, &ai0, &ai) != 0) { - return 0; - } - assert(ai->ai_family == AF_INET); - assert(ai->ai_socktype == SOCK_DGRAM); - assert(ai->ai_protocol == IPPROTO_UDP); - assert(ai->ai_addrlen == sizeof(his_machine_addr)); - assert(ai->ai_addr != NULL); - sin = (struct sockaddr_in *)ai->ai_addr; - his_machine_addr = sin->sin_addr; - freeaddrinfo(ai); - } - /* Load these useful values into the standard message header */ - (void) strncpy(msg.r_name, his_name, NAME_SIZE); - msg.r_name[NAME_SIZE - 1] = '\0'; - - return 1; -} -#endif diff --git a/hunt/huntd/huntd.6 b/hunt/huntd/huntd.6 index 5da995e9..51e646b8 100644 --- a/hunt/huntd/huntd.6 +++ b/hunt/huntd/huntd.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: huntd.6,v 1.10 2013/07/09 09:41:30 njoly Exp $ +.\" $NetBSD: huntd.6,v 1.11 2014/03/29 20:32:04 dholland Exp $ .\" .\" huntd .\" @@ -31,7 +31,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 4, 2001 +.Dd March 29, 2014 .Dt HUNTD 6 .Os .Sh NAME @@ -46,14 +46,6 @@ controls the multi-player .Xr hunt 6 game. -When it starts up, it tries to notify all members of the -.Em hunt-players -mailing list (see -.Xr sendmail 1 ) -by faking a -.Xr talk 1 -request from user -.Dq Hunt Game . .Pp The .Fl s @@ -68,9 +60,6 @@ The .Fl p option changes the UDP port number used to rendezvous with the player process and thus allows for private games of hunt. -This option turns off the notification of players on the -.Em hunt-players -mailing list. .Ss INETD To run .Nm @@ -117,7 +106,6 @@ process starts up a on the local machine and tries to rendezvous with it. .Sh SEE ALSO .Xr sendmail 1 , -.Xr talk 1 , .Xr hunt 6 .Sh AUTHORS Conrad Huang, Ken Arnold, and Greg Couch; diff --git a/hunt/huntd/talk_ctl.h b/hunt/huntd/talk_ctl.h deleted file mode 100644 index ba516524..00000000 --- a/hunt/huntd/talk_ctl.h +++ /dev/null @@ -1,106 +0,0 @@ -/* $NetBSD: talk_ctl.h,v 1.7 2009/07/04 04:29:54 dholland Exp $ */ - -/* - * Copyright (c) 1983-2003, Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * + Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * + Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * + Neither the name of the University of California, San Francisco nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/types.h> -#include <netinet/in.h> - -#ifdef TALK_43 -#include <protocols/talkd.h> -#else - -#include <sys/socket.h> - -#define NAME_SIZE 9 -#define TTY_SIZE 16 -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif - -#define MAX_LIFE 60 /* max time daemon saves invitations */ -/* RING_WAIT should be 10's of seconds less than MAX_LIFE */ -#define RING_WAIT 30 /* time to wait before refreshing invitation */ - -/* type values */ -#define LEAVE_INVITE 0 -#define LOOK_UP 1 -#define DELETE 2 -#define ANNOUNCE 3 - -/* answer values */ -#define SUCCESS 0 -#define NOT_HERE 1 -#define FAILED 2 -#define MACHINE_UNKNOWN 3 -#define PERMISSION_DENIED 4 -#define UNKNOWN_REQUEST 5 - -typedef struct ctl_response { - char type; - char answer; - int id_num; - struct sockaddr_in addr; -} CTL_RESPONSE; - -typedef struct ctl_msg { - char type; - char l_name[NAME_SIZE]; - char r_name[NAME_SIZE]; - int id_num; - int pid; - char r_tty[TTY_SIZE]; - struct sockaddr_in addr; - struct sockaddr_in ctl_addr; -} CTL_MSG; -#endif - -#include <errno.h> -#ifdef LOG -#include <syslog.h> -#endif - -extern struct sockaddr_in daemon_addr; -extern struct sockaddr_in ctl_addr; -extern struct sockaddr_in my_addr; -extern struct in_addr my_machine_addr; -extern struct in_addr his_machine_addr; -extern u_short daemon_port; -extern int ctl_sockt; -extern CTL_MSG msg; - -#ifdef LOG -#define p_error(str) syslog(LOG_WARNING, "faketalk %s: %m", str) -#else -#define p_error(str) warn(str) -#endif - -void ctl_transact(struct in_addr, CTL_MSG, int, CTL_RESPONSE *); |