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