BSD 4_3_Net_2 development
[unix-history] / .ref-8c8a5b54e79564c14fc7a2823a21a8f048449bcf / usr / src / include / protocols / talkd.h
CommitLineData
d0aeaf5a
DF
1/*
2 * Copyright (c) 1983 Regents of the University of California.
5c4d2881 3 * All rights reserved.
d0aeaf5a 4 *
269a7923 5 * %sccs.include.redist.c%
5c4d2881 6 *
d2b7358e 7 * @(#)talkd.h 5.7 (Berkeley) %G%
212b2321
MK
8 */
9
d2b7358e
KB
10#ifndef _TALKD_H_
11#define _TALKD_H_
12
595cdd5e
KM
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 */
212b2321 30
595cdd5e
KM
31/*
32 * Client->server request message format.
33 */
34typedef 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 */
53799aeb
MK
40 struct osockaddr addr; /* old (4.3) style */
41 struct osockaddr ctl_addr; /* old (4.3) style */
595cdd5e
KM
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 */
963ce42e 46#define TTY_SIZE 16
595cdd5e
KM
47 char r_tty[TTY_SIZE];/* callee's tty name */
48} CTL_MSG;
963ce42e 49
595cdd5e
KM
50/*
51 * Server->client response message format.
52 */
53typedef 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 */
53799aeb 59 struct osockaddr addr; /* address for establishing conversation */
595cdd5e 60} CTL_RESPONSE;
963ce42e 61
595cdd5e 62#define TALK_VERSION 1 /* protocol version */
963ce42e 63
595cdd5e
KM
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 */
963ce42e 69
595cdd5e
KM
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 */
963ce42e 80
595cdd5e
KM
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 */
d2b7358e
KB
87
88#endif /* !_TALKD_H_ */