122384Sdist /* 2*61067Sbostic * Copyright (c) 1983, 1993 3*61067Sbostic * The Regents of the University of California. All rights reserved. 422384Sdist * 542618Sbostic * %sccs.include.redist.c% 635053Sbostic * 7*61067Sbostic * @(#)talkd.h 8.1 (Berkeley) 06/02/93 822384Sdist */ 916344Skarels 1047775Sbostic #ifndef _TALKD_H_ 1147775Sbostic #define _TALKD_H_ 1247775Sbostic 1316363Skarels /* 1426843Smckusick * This describes the protocol used by the talk server and clients. 1526843Smckusick * 1626843Smckusick * The talk server acts a repository of invitations, responding to 1726843Smckusick * requests by clients wishing to rendezvous for the purpose of 1826843Smckusick * holding a conversation. In normal operation, a client, the caller, 1926843Smckusick * initiates a rendezvous by sending a CTL_MSG to the server of 2026843Smckusick * type LOOK_UP. This causes the server to search its invitation 2126843Smckusick * tables to check if an invitation currently exists for the caller 2226843Smckusick * (to speak to the callee specified in the message). If the lookup 2326843Smckusick * fails, the caller then sends an ANNOUNCE message causing the server 2426843Smckusick * to broadcast an announcement on the callee's login ports requesting 2526843Smckusick * contact. When the callee responds, the local server uses the 2626843Smckusick * recorded invitation to respond with the appropriate rendezvous 2726843Smckusick * address and the caller and callee client programs establish a 2826843Smckusick * stream connection through which the conversation takes place. 2916344Skarels */ 3016344Skarels 3126843Smckusick /* 3226843Smckusick * Client->server request message format. 3326843Smckusick */ 3426843Smckusick typedef struct { 3526843Smckusick u_char vers; /* protocol version */ 3626843Smckusick u_char type; /* request type, see below */ 3726843Smckusick u_char answer; /* not used */ 3826843Smckusick u_char pad; 3926843Smckusick u_long id_num; /* message id */ 4038637Skarels struct osockaddr addr; /* old (4.3) style */ 4138637Skarels struct osockaddr ctl_addr; /* old (4.3) style */ 4226843Smckusick long pid; /* caller's process id */ 4326843Smckusick #define NAME_SIZE 12 4426843Smckusick char l_name[NAME_SIZE];/* caller's name */ 4526843Smckusick char r_name[NAME_SIZE];/* callee's name */ 4616363Skarels #define TTY_SIZE 16 4726843Smckusick char r_tty[TTY_SIZE];/* callee's tty name */ 4826843Smckusick } CTL_MSG; 4916344Skarels 5026843Smckusick /* 5126843Smckusick * Server->client response message format. 5226843Smckusick */ 5326843Smckusick typedef struct { 5426843Smckusick u_char vers; /* protocol version */ 5526843Smckusick u_char type; /* type of request message, see below */ 5626843Smckusick u_char answer; /* respose to request message, see below */ 5726843Smckusick u_char pad; 5826843Smckusick u_long id_num; /* message id */ 5938637Skarels struct osockaddr addr; /* address for establishing conversation */ 6026843Smckusick } CTL_RESPONSE; 6116344Skarels 6226843Smckusick #define TALK_VERSION 1 /* protocol version */ 6316344Skarels 6426843Smckusick /* message type values */ 6526843Smckusick #define LEAVE_INVITE 0 /* leave invitation with server */ 6626843Smckusick #define LOOK_UP 1 /* check for invitation by callee */ 6726843Smckusick #define DELETE 2 /* delete invitation by caller */ 6826843Smckusick #define ANNOUNCE 3 /* announce invitation by caller */ 6926843Smckusick 7016363Skarels /* answer values */ 7126843Smckusick #define SUCCESS 0 /* operation completed properly */ 7226843Smckusick #define NOT_HERE 1 /* callee not logged in */ 7326843Smckusick #define FAILED 2 /* operation failed for unexplained reason */ 7426843Smckusick #define MACHINE_UNKNOWN 3 /* caller's machine name unknown */ 7526843Smckusick #define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */ 7626843Smckusick #define UNKNOWN_REQUEST 5 /* request has invalid type value */ 7726843Smckusick #define BADVERSION 6 /* request has invalid protocol version */ 7826843Smckusick #define BADADDR 7 /* request has invalid addr value */ 7926843Smckusick #define BADCTLADDR 8 /* request has invalid ctl_addr value */ 8016344Skarels 8126843Smckusick /* 8226843Smckusick * Operational parameters. 8326843Smckusick */ 8426843Smckusick #define MAX_LIFE 60 /* max time daemon saves invitations */ 8526843Smckusick /* RING_WAIT should be 10's of seconds less than MAX_LIFE */ 8626843Smckusick #define RING_WAIT 30 /* time to wait before resending invitation */ 8747775Sbostic 8847775Sbostic #endif /* !_TALKD_H_ */ 89