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