Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


talkd.h
001: /*
002:  * Copyright (c) 1983, 1993
003:  *      The Regents of the University of California.  All rights reserved.
004:  *
005:  * Redistribution and use in source and binary forms, with or without
006:  * modification, are permitted provided that the following conditions
007:  * are met:
008:  * 1. Redistributions of source code must retain the above copyright
009:  *    notice, this list of conditions and the following disclaimer.
010:  * 2. Redistributions in binary form must reproduce the above copyright
011:  *    notice, this list of conditions and the following disclaimer in the
012:  *    documentation and/or other materials provided with the distribution.
013:  * 4. Neither the name of the University nor the names of its contributors
014:  *    may be used to endorse or promote products derived from this software
015:  *    without specific prior written permission.
016:  *
017:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
018:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
019:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
020:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
021:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
022:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
023:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
024:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
025:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
026:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
027:  * SUCH DAMAGE.
028:  *
029:  *      @(#)talkd.h     8.1 (Berkeley) 6/2/93
030:  */
031: 
032: #ifndef _PROTOCOLS_TALKD_H
033: #define _PROTOCOLS_TALKD_H 1
034: 
035: /*
036:  * This describes the protocol used by the talk server and clients.
037:  *
038:  * The talk server acts a repository of invitations, responding to
039:  * requests by clients wishing to rendezvous for the purpose of
040:  * holding a conversation.  In normal operation, a client, the caller,
041:  * initiates a rendezvous by sending a CTL_MSG to the server of
042:  * type LOOK_UP.  This causes the server to search its invitation
043:  * tables to check if an invitation currently exists for the caller
044:  * (to speak to the callee specified in the message).  If the lookup
045:  * fails, the caller then sends an ANNOUNCE message causing the server
046:  * to broadcast an announcement on the callee's login ports requesting
047:  * contact.  When the callee responds, the local server uses the
048:  * recorded invitation to respond with the appropriate rendezvous
049:  * address and the caller and callee client programs establish a
050:  * stream connection through which the conversation takes place.
051:  */
052: 
053: #include <sys/types.h>
054: #include <sys/socket.h>
055: 
056: /*
057:  * Client->server request message format.
058:  */
059: typedef struct {
060:         u_char  vers;           /* protocol version */
061:         u_char  type;           /* request type, see below */
062:         u_char  answer;         /* not used */
063:         u_char  pad;
064:         u_int32_t id_num;       /* message id */
065:         struct  osockaddr addr;         /* old (4.3) style */
066:         struct  osockaddr ctl_addr;     /* old (4.3) style */
067:         int32_t pid;            /* caller's process id */
068: #define NAME_SIZE       12
069:         char    l_name[NAME_SIZE];/* caller's name */
070:         char    r_name[NAME_SIZE];/* callee's name */
071: #define TTY_SIZE        16
072:         char    r_tty[TTY_SIZE];/* callee's tty name */
073: } CTL_MSG;
074: 
075: /*
076:  * Server->client response message format.
077:  */
078: typedef struct {
079:         u_char  vers;           /* protocol version */
080:         u_char  type;           /* type of request message, see below */
081:         u_char  answer;         /* response to request message, see below */
082:         u_char  pad;
083:         u_int32_t id_num;       /* message id */
084:         struct  osockaddr addr; /* address for establishing conversation */
085: } CTL_RESPONSE;
086: 
087: #define TALK_VERSION    1               /* protocol version */
088: 
089: /* message type values */
090: #define LEAVE_INVITE    0       /* leave invitation with server */
091: #define LOOK_UP         1       /* check for invitation by callee */
092: #define DELETE          2       /* delete invitation by caller */
093: #define ANNOUNCE        3       /* announce invitation by caller */
094: 
095: /* answer values */
096: #define SUCCESS         0       /* operation completed properly */
097: #define NOT_HERE        1       /* callee not logged in */
098: #define FAILED          2       /* operation failed for unexplained reason */
099: #define MACHINE_UNKNOWN 3       /* caller's machine name unknown */
100: #define PERMISSION_DENIED 4     /* callee's tty doesn't permit announce */
101: #define UNKNOWN_REQUEST 5       /* request has invalid type value */
102: #define BADVERSION      6       /* request has invalid protocol version */
103: #define BADADDR         7       /* request has invalid addr value */
104: #define BADCTLADDR      8       /* request has invalid ctl_addr value */
105: 
106: /*
107:  * Operational parameters.
108:  */
109: #define MAX_LIFE        60      /* max time daemon saves invitations */
110: /* RING_WAIT should be 10's of seconds less than MAX_LIFE */
111: #define RING_WAIT       30      /* time to wait before resending invitation */
112: 
113: #endif /* protocols/talkd.h */
114: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/