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