1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1990 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 /*
31  * University Copyright- Copyright (c) 1982, 1986, 1988
32  * The Regents of the University of California
33  * All Rights Reserved
34  *
35  * University Acknowledgment- Portions of this document are derived from
36  * software developed by the University of California, Berkeley, and its
37  * contributors.
38  */
39 
40 /* ctl.h describes the structure that talk and talkd pass back
41    and forth
42  */
43 
44 #include <sys/types.h>
45 #include <sys/socket.h>
46 #include <netinet/in.h>
47 #include <netdb.h>
48 
49 #define NAME_SIZE 9
50 #define TTY_SIZE 16
51 #define HOST_NAME_LENGTH 256
52 
53 #define MAX_LIFE 60 /* maximum time an invitation is saved by the
54 			 talk daemons */
55 #define RING_WAIT 30  /* time to wait before refreshing invitation
56 			 should be 10's of seconds less than MAX_LIFE */
57 
58     /* the values for type */
59 
60 #define LEAVE_INVITE 0
61 #define LOOK_UP 1
62 #define DELETE 2
63 #define ANNOUNCE 3
64 
65     /* the values for answer */
66 
67 #define SUCCESS 0
68 #define NOT_HERE 1
69 #define FAILED 2
70 #define MACHINE_UNKNOWN 3
71 #define PERMISSION_DENIED 4
72 #define UNKNOWN_REQUEST 5
73 
74 typedef struct ctl_response CTL_RESPONSE;
75 
76 struct ctl_response {
77     char type;
78     char answer;
79     int id_num;
80     struct sockaddr_in addr;
81 };
82 
83 typedef struct ctl_msg CTL_MSG;
84 
85 struct ctl_msg {
86     char type;
87     char l_name[NAME_SIZE];
88     char r_name[NAME_SIZE];
89     int id_num;
90     pid_t pid;
91     char r_tty[TTY_SIZE];
92     struct sockaddr_in addr;
93     struct sockaddr_in ctl_addr;
94 };
95