talkd.h revision 2163
11539Srgrimes/* 21539Srgrimes * Copyright (c) 1983, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * 51539Srgrimes * Redistribution and use in source and binary forms, with or without 61539Srgrimes * modification, are permitted provided that the following conditions 71539Srgrimes * are met: 81539Srgrimes * 1. Redistributions of source code must retain the above copyright 91539Srgrimes * notice, this list of conditions and the following disclaimer. 101539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111539Srgrimes * notice, this list of conditions and the following disclaimer in the 121539Srgrimes * documentation and/or other materials provided with the distribution. 131539Srgrimes * 3. All advertising materials mentioning features or use of this software 141539Srgrimes * must display the following acknowledgement: 151539Srgrimes * This product includes software developed by the University of 161539Srgrimes * California, Berkeley and its contributors. 171539Srgrimes * 4. Neither the name of the University nor the names of its contributors 181539Srgrimes * may be used to endorse or promote products derived from this software 191539Srgrimes * without specific prior written permission. 201539Srgrimes * 211539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311539Srgrimes * SUCH DAMAGE. 321539Srgrimes * 331539Srgrimes * @(#)talkd.h 8.1 (Berkeley) 6/2/93 341539Srgrimes */ 351539Srgrimes 362163Spaul#ifndef _PROTOCOLS_TALKD_H_ 372163Spaul#define _PROTOCOLS_TALKD_H_ 381539Srgrimes 391539Srgrimes/* 401539Srgrimes * This describes the protocol used by the talk server and clients. 411539Srgrimes * 421539Srgrimes * The talk server acts a repository of invitations, responding to 431539Srgrimes * requests by clients wishing to rendezvous for the purpose of 441539Srgrimes * holding a conversation. In normal operation, a client, the caller, 451539Srgrimes * initiates a rendezvous by sending a CTL_MSG to the server of 461539Srgrimes * type LOOK_UP. This causes the server to search its invitation 471539Srgrimes * tables to check if an invitation currently exists for the caller 481539Srgrimes * (to speak to the callee specified in the message). If the lookup 491539Srgrimes * fails, the caller then sends an ANNOUNCE message causing the server 501539Srgrimes * to broadcast an announcement on the callee's login ports requesting 511539Srgrimes * contact. When the callee responds, the local server uses the 521539Srgrimes * recorded invitation to respond with the appropriate rendezvous 531539Srgrimes * address and the caller and callee client programs establish a 541539Srgrimes * stream connection through which the conversation takes place. 551539Srgrimes */ 561539Srgrimes 571539Srgrimes/* 581539Srgrimes * Client->server request message format. 591539Srgrimes */ 601539Srgrimestypedef struct { 611539Srgrimes u_char vers; /* protocol version */ 621539Srgrimes u_char type; /* request type, see below */ 631539Srgrimes u_char answer; /* not used */ 641539Srgrimes u_char pad; 651539Srgrimes u_long id_num; /* message id */ 661539Srgrimes struct osockaddr addr; /* old (4.3) style */ 671539Srgrimes struct osockaddr ctl_addr; /* old (4.3) style */ 681539Srgrimes long pid; /* caller's process id */ 691539Srgrimes#define NAME_SIZE 12 701539Srgrimes char l_name[NAME_SIZE];/* caller's name */ 711539Srgrimes char r_name[NAME_SIZE];/* callee's name */ 721539Srgrimes#define TTY_SIZE 16 731539Srgrimes char r_tty[TTY_SIZE];/* callee's tty name */ 741539Srgrimes} CTL_MSG; 751539Srgrimes 761539Srgrimes/* 771539Srgrimes * Server->client response message format. 781539Srgrimes */ 791539Srgrimestypedef struct { 801539Srgrimes u_char vers; /* protocol version */ 811539Srgrimes u_char type; /* type of request message, see below */ 821539Srgrimes u_char answer; /* respose to request message, see below */ 831539Srgrimes u_char pad; 841539Srgrimes u_long id_num; /* message id */ 851539Srgrimes struct osockaddr addr; /* address for establishing conversation */ 861539Srgrimes} CTL_RESPONSE; 871539Srgrimes 881539Srgrimes#define TALK_VERSION 1 /* protocol version */ 891539Srgrimes 901539Srgrimes/* message type values */ 911539Srgrimes#define LEAVE_INVITE 0 /* leave invitation with server */ 921539Srgrimes#define LOOK_UP 1 /* check for invitation by callee */ 931539Srgrimes#define DELETE 2 /* delete invitation by caller */ 941539Srgrimes#define ANNOUNCE 3 /* announce invitation by caller */ 951539Srgrimes 961539Srgrimes/* answer values */ 971539Srgrimes#define SUCCESS 0 /* operation completed properly */ 981539Srgrimes#define NOT_HERE 1 /* callee not logged in */ 991539Srgrimes#define FAILED 2 /* operation failed for unexplained reason */ 1001539Srgrimes#define MACHINE_UNKNOWN 3 /* caller's machine name unknown */ 1011539Srgrimes#define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */ 1021539Srgrimes#define UNKNOWN_REQUEST 5 /* request has invalid type value */ 1031539Srgrimes#define BADVERSION 6 /* request has invalid protocol version */ 1041539Srgrimes#define BADADDR 7 /* request has invalid addr value */ 1051539Srgrimes#define BADCTLADDR 8 /* request has invalid ctl_addr value */ 1061539Srgrimes 1071539Srgrimes/* 1081539Srgrimes * Operational parameters. 1091539Srgrimes */ 1101539Srgrimes#define MAX_LIFE 60 /* max time daemon saves invitations */ 1111539Srgrimes/* RING_WAIT should be 10's of seconds less than MAX_LIFE */ 1121539Srgrimes#define RING_WAIT 30 /* time to wait before resending invitation */ 1131539Srgrimes 1141539Srgrimes#endif /* !_TALKD_H_ */ 115