|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1983 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that: (1) source distributions retain this entire copyright ! 7: * notice and comment, and (2) distributions including binaries display ! 8: * the following acknowledgement: ``This product includes software ! 9: * developed by the University of California, Berkeley and its contributors'' ! 10: * in the documentation or other materials provided with the distribution ! 11: * and in all advertising materials mentioning features or use of this ! 12: * software. Neither the name of the University nor the names of its ! 13: * contributors may be used to endorse or promote products derived ! 14: * from this software without specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: * ! 19: * @(#)talkd.h 5.5 (Berkeley) 6/1/90 ! 20: */ ! 21: ! 22: #include <sys/types.h> ! 23: #include <sys/socket.h> ! 24: /* ! 25: * This describes the protocol used by the talk server and clients. ! 26: * ! 27: * The talk server acts a repository of invitations, responding to ! 28: * requests by clients wishing to rendezvous for the purpose of ! 29: * holding a conversation. In normal operation, a client, the caller, ! 30: * initiates a rendezvous by sending a CTL_MSG to the server of ! 31: * type LOOK_UP. This causes the server to search its invitation ! 32: * tables to check if an invitation currently exists for the caller ! 33: * (to speak to the callee specified in the message). If the lookup ! 34: * fails, the caller then sends an ANNOUNCE message causing the server ! 35: * to broadcast an announcement on the callee's login ports requesting ! 36: * contact. When the callee responds, the local server uses the ! 37: * recorded invitation to respond with the appropriate rendezvous ! 38: * address and the caller and callee client programs establish a ! 39: * stream connection through which the conversation takes place. ! 40: */ ! 41: ! 42: /* ! 43: * Client->server request message format. ! 44: */ ! 45: typedef struct { ! 46: u_char vers; /* protocol version */ ! 47: u_char type; /* request type, see below */ ! 48: u_char answer; /* not used */ ! 49: u_char pad; ! 50: u_long id_num; /* message id */ ! 51: struct osockaddr addr; /* old (4.3) style */ ! 52: struct osockaddr ctl_addr; /* old (4.3) style */ ! 53: long pid; /* caller's process id */ ! 54: #define NAME_SIZE 12 ! 55: char l_name[NAME_SIZE];/* caller's name */ ! 56: char r_name[NAME_SIZE];/* callee's name */ ! 57: #define TTY_SIZE 16 ! 58: char r_tty[TTY_SIZE];/* callee's tty name */ ! 59: } CTL_MSG; ! 60: ! 61: /* ! 62: * Server->client response message format. ! 63: */ ! 64: typedef struct { ! 65: u_char vers; /* protocol version */ ! 66: u_char type; /* type of request message, see below */ ! 67: u_char answer; /* respose to request message, see below */ ! 68: u_char pad; ! 69: u_long id_num; /* message id */ ! 70: struct osockaddr addr; /* address for establishing conversation */ ! 71: } CTL_RESPONSE; ! 72: ! 73: #define TALK_VERSION 1 /* protocol version */ ! 74: ! 75: /* message type values */ ! 76: #define LEAVE_INVITE 0 /* leave invitation with server */ ! 77: #define LOOK_UP 1 /* check for invitation by callee */ ! 78: #define DELETE 2 /* delete invitation by caller */ ! 79: #define ANNOUNCE 3 /* announce invitation by caller */ ! 80: ! 81: /* answer values */ ! 82: #define SUCCESS 0 /* operation completed properly */ ! 83: #define NOT_HERE 1 /* callee not logged in */ ! 84: #define FAILED 2 /* operation failed for unexplained reason */ ! 85: #define MACHINE_UNKNOWN 3 /* caller's machine name unknown */ ! 86: #define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */ ! 87: #define UNKNOWN_REQUEST 5 /* request has invalid type value */ ! 88: #define BADVERSION 6 /* request has invalid protocol version */ ! 89: #define BADADDR 7 /* request has invalid addr value */ ! 90: #define BADCTLADDR 8 /* request has invalid ctl_addr value */ ! 91: ! 92: /* ! 93: * Operational parameters. ! 94: */ ! 95: #define MAX_LIFE 60 /* max time daemon saves invitations */ ! 96: /* RING_WAIT should be 10's of seconds less than MAX_LIFE */ ! 97: #define RING_WAIT 30 /* time to wait before resending invitation */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.