xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/in.talkd/ctl.h (revision 59d65d3175825093531e82f44269d948ed510a00)
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  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
28  * All Rights Reserved.
29  */
30 
31 /*
32  * University Copyright- Copyright (c) 1982, 1986, 1988
33  * The Regents of the University of California.
34  * All Rights Reserved.
35  *
36  * University Acknowledgment- Portions of this document are derived from
37  * software developed by the University of California, Berkeley, and its
38  * contributors.
39  */
40 
41 #ifndef	_CTL_H
42 #define	_CTL_H
43 
44 /*
45  * ctl.h describes the structure that talk and talkd pass back
46  * and forth.
47  */
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 #include <sys/types.h>
54 #include <sys/socket.h>
55 #include <netinet/in.h>
56 #include <netdb.h>
57 
58 #define	NAME_SIZE 9
59 #define	TTY_SIZE 16
60 #define	HOST_NAME_LENGTH 256
61 
62 /*
63  * Maximum time an invitation is saved by the talk daemons.
64  */
65 #define	MAX_LIFE 60
66 /*
67  * Time to wait before refreshing invitation should be 10's of seconds less
68  * than MAX_LIFE.
69  */
70 #define	RING_WAIT 30
71 
72 /*
73  * The values for type.
74  */
75 #define	LEAVE_INVITE 0
76 #define	LOOK_UP 1
77 #define	DELETE 2
78 #define	ANNOUNCE 3
79 
80 /*
81  * The values for answer.
82  */
83 #define	SUCCESS 0
84 #define	NOT_HERE 1
85 #define	FAILED 2
86 #define	MACHINE_UNKNOWN 3
87 #define	PERMISSION_DENIED 4
88 #define	UNKNOWN_REQUEST 5
89 
90 typedef struct ctl_response CTL_RESPONSE;
91 
92 struct ctl_response {
93     char type;
94     char answer;
95     int id_num;
96     struct sockaddr_in addr;
97 };
98 
99 typedef struct ctl_msg CTL_MSG;
100 
101 struct ctl_msg {
102     char type;
103     char l_name[NAME_SIZE];
104     char r_name[NAME_SIZE];
105     int id_num;
106     pid_t pid;
107     char r_tty[TTY_SIZE];
108     struct sockaddr_in addr;
109     struct sockaddr_in ctl_addr;
110 };
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* _CTL_H */
117