1 /* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)talkd.h 8.1 (Berkeley) 06/02/93 8 */ 9 10 #ifndef _TALKD_H_ 11 #define _TALKD_H_ 12 13 /* 14 * This describes the protocol used by the talk server and clients. 15 * 16 * The talk server acts a repository of invitations, responding to 17 * requests by clients wishing to rendezvous for the purpose of 18 * holding a conversation. In normal operation, a client, the caller, 19 * initiates a rendezvous by sending a CTL_MSG to the server of 20 * type LOOK_UP. This causes the server to search its invitation 21 * tables to check if an invitation currently exists for the caller 22 * (to speak to the callee specified in the message). If the lookup 23 * fails, the caller then sends an ANNOUNCE message causing the server 24 * to broadcast an announcement on the callee's login ports requesting 25 * contact. When the callee responds, the local server uses the 26 * recorded invitation to respond with the appropriate rendezvous 27 * address and the caller and callee client programs establish a 28 * stream connection through which the conversation takes place. 29 */ 30 31 /* 32 * Client->server request message format. 33 */ 34 typedef struct { 35 u_char vers; /* protocol version */ 36 u_char type; /* request type, see below */ 37 u_char answer; /* not used */ 38 u_char pad; 39 u_long id_num; /* message id */ 40 struct osockaddr addr; /* old (4.3) style */ 41 struct osockaddr ctl_addr; /* old (4.3) style */ 42 long pid; /* caller's process id */ 43 #define NAME_SIZE 12 44 char l_name[NAME_SIZE];/* caller's name */ 45 char r_name[NAME_SIZE];/* callee's name */ 46 #define TTY_SIZE 16 47 char r_tty[TTY_SIZE];/* callee's tty name */ 48 } CTL_MSG; 49 50 /* 51 * Server->client response message format. 52 */ 53 typedef struct { 54 u_char vers; /* protocol version */ 55 u_char type; /* type of request message, see below */ 56 u_char answer; /* respose to request message, see below */ 57 u_char pad; 58 u_long id_num; /* message id */ 59 struct osockaddr addr; /* address for establishing conversation */ 60 } CTL_RESPONSE; 61 62 #define TALK_VERSION 1 /* protocol version */ 63 64 /* message type values */ 65 #define LEAVE_INVITE 0 /* leave invitation with server */ 66 #define LOOK_UP 1 /* check for invitation by callee */ 67 #define DELETE 2 /* delete invitation by caller */ 68 #define ANNOUNCE 3 /* announce invitation by caller */ 69 70 /* answer values */ 71 #define SUCCESS 0 /* operation completed properly */ 72 #define NOT_HERE 1 /* callee not logged in */ 73 #define FAILED 2 /* operation failed for unexplained reason */ 74 #define MACHINE_UNKNOWN 3 /* caller's machine name unknown */ 75 #define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */ 76 #define UNKNOWN_REQUEST 5 /* request has invalid type value */ 77 #define BADVERSION 6 /* request has invalid protocol version */ 78 #define BADADDR 7 /* request has invalid addr value */ 79 #define BADCTLADDR 8 /* request has invalid ctl_addr value */ 80 81 /* 82 * Operational parameters. 83 */ 84 #define MAX_LIFE 60 /* max time daemon saves invitations */ 85 /* RING_WAIT should be 10's of seconds less than MAX_LIFE */ 86 #define RING_WAIT 30 /* time to wait before resending invitation */ 87 88 #endif /* !_TALKD_H_ */ 89