Blame inet/protocols/talkd.h

Packit 6c4009
/*
Packit 6c4009
 * Copyright (c) 1983, 1993
Packit 6c4009
 *	The Regents of the University of California.  All rights reserved.
Packit 6c4009
 *
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions
Packit 6c4009
 * are met:
Packit 6c4009
 * 1. Redistributions of source code must retain the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer.
Packit 6c4009
 * 2. Redistributions in binary form must reproduce the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer in the
Packit 6c4009
 *    documentation and/or other materials provided with the distribution.
Packit 6c4009
 * 4. Neither the name of the University nor the names of its contributors
Packit 6c4009
 *    may be used to endorse or promote products derived from this software
Packit 6c4009
 *    without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit 6c4009
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 6c4009
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 6c4009
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit 6c4009
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit 6c4009
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit 6c4009
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit 6c4009
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit 6c4009
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit 6c4009
 * SUCH DAMAGE.
Packit 6c4009
 *
Packit 6c4009
 *	@(#)talkd.h	8.1 (Berkeley) 6/2/93
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef _PROTOCOLS_TALKD_H
Packit 6c4009
#define	_PROTOCOLS_TALKD_H 1
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * This describes the protocol used by the talk server and clients.
Packit 6c4009
 *
Packit 6c4009
 * The talk server acts a repository of invitations, responding to
Packit 6c4009
 * requests by clients wishing to rendezvous for the purpose of
Packit 6c4009
 * holding a conversation.  In normal operation, a client, the caller,
Packit 6c4009
 * initiates a rendezvous by sending a CTL_MSG to the server of
Packit 6c4009
 * type LOOK_UP.  This causes the server to search its invitation
Packit 6c4009
 * tables to check if an invitation currently exists for the caller
Packit 6c4009
 * (to speak to the callee specified in the message).  If the lookup
Packit 6c4009
 * fails, the caller then sends an ANNOUNCE message causing the server
Packit 6c4009
 * to broadcast an announcement on the callee's login ports requesting
Packit 6c4009
 * contact.  When the callee responds, the local server uses the
Packit 6c4009
 * recorded invitation to respond with the appropriate rendezvous
Packit 6c4009
 * address and the caller and callee client programs establish a
Packit 6c4009
 * stream connection through which the conversation takes place.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <sys/types.h>
Packit 6c4009
#include <sys/socket.h>
Packit 6c4009
#include <stdint.h>
Packit 6c4009
#include <bits/types/struct_osockaddr.h>
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Client->server request message format.
Packit 6c4009
 */
Packit 6c4009
typedef struct {
Packit 6c4009
	unsigned char	vers;	/* protocol version */
Packit 6c4009
	unsigned char	type;	/* request type, see below */
Packit 6c4009
	unsigned char	answer;	/* not used */
Packit 6c4009
	unsigned char	pad;
Packit 6c4009
	uint32_t id_num;	/* message id */
Packit 6c4009
	struct	osockaddr addr;		/* old (4.3) style */
Packit 6c4009
	struct	osockaddr ctl_addr;	/* old (4.3) style */
Packit 6c4009
	int32_t	pid;		/* caller's process id */
Packit 6c4009
#define	NAME_SIZE	12
Packit 6c4009
	char	l_name[NAME_SIZE];/* caller's name */
Packit 6c4009
	char	r_name[NAME_SIZE];/* callee's name */
Packit 6c4009
#define	TTY_SIZE	16
Packit 6c4009
	char	r_tty[TTY_SIZE];/* callee's tty name */
Packit 6c4009
} CTL_MSG;
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Server->client response message format.
Packit 6c4009
 */
Packit 6c4009
typedef struct {
Packit 6c4009
	unsigned char	vers;	/* protocol version */
Packit 6c4009
	unsigned char	type;	/* type of request message, see below */
Packit 6c4009
	unsigned char	answer;	/* response to request message, see below */
Packit 6c4009
	unsigned char	pad;
Packit 6c4009
	uint32_t	id_num;	/* message id */
Packit 6c4009
	struct	osockaddr addr;	/* address for establishing conversation */
Packit 6c4009
} CTL_RESPONSE;
Packit 6c4009
Packit 6c4009
#define	TALK_VERSION	1		/* protocol version */
Packit 6c4009
Packit 6c4009
/* message type values */
Packit 6c4009
#define LEAVE_INVITE	0	/* leave invitation with server */
Packit 6c4009
#define LOOK_UP		1	/* check for invitation by callee */
Packit 6c4009
#define DELETE		2	/* delete invitation by caller */
Packit 6c4009
#define ANNOUNCE	3	/* announce invitation by caller */
Packit 6c4009
Packit 6c4009
/* answer values */
Packit 6c4009
#define SUCCESS		0	/* operation completed properly */
Packit 6c4009
#define NOT_HERE	1	/* callee not logged in */
Packit 6c4009
#define FAILED		2	/* operation failed for unexplained reason */
Packit 6c4009
#define MACHINE_UNKNOWN	3	/* caller's machine name unknown */
Packit 6c4009
#define PERMISSION_DENIED 4	/* callee's tty doesn't permit announce */
Packit 6c4009
#define UNKNOWN_REQUEST	5	/* request has invalid type value */
Packit 6c4009
#define	BADVERSION	6	/* request has invalid protocol version */
Packit 6c4009
#define	BADADDR		7	/* request has invalid addr value */
Packit 6c4009
#define	BADCTLADDR	8	/* request has invalid ctl_addr value */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Operational parameters.
Packit 6c4009
 */
Packit 6c4009
#define MAX_LIFE	60	/* max time daemon saves invitations */
Packit 6c4009
/* RING_WAIT should be 10's of seconds less than MAX_LIFE */
Packit 6c4009
#define RING_WAIT	30	/* time to wait before resending invitation */
Packit 6c4009
Packit 6c4009
#endif /* protocols/talkd.h */