xref: /illumos-gate/usr/src/head/listen.h (revision 7c478bd9)
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 (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 #ifndef	_LISTEN_H
27 #define	_LISTEN_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.4.3.1 */
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * listen.h:	Include file for network listener related user programs
37  *
38  */
39 
40 /*
41  * The NLPS (Network Listener Process Service)
42  * protocol message sent by client machines to
43  * a listener process to request a service on the listener's
44  * machine. The message is sent to "netnodename(r_nodename)"
45  * where r_nodename is the nodename (see uname(2)) of the
46  * remote host. Note that client's need not know (or care)
47  * about the details of this message.  They use the "nls_connect(3)"
48  * library routine which uses this message.
49  *
50  * msg format:
51  *
52  *		"id:low:high:service_code"
53  *
54  *		id = "NLPS"
55  *		low:high = version number of listener (see prot msg)
56  *		service_code is ASCII/decimal
57  *
58  * the following prot string can be run through sprintf with a service code
59  * to generate the message:
60  *
61  *	len = sprintf(buf,nls_prot_msg,svc_code);
62  *	t_snd(fd, buf, len, ...);
63  *
64  * See also:  listen(1), nlsrequest(3)
65  *
66  * and on the UNIX PC STARLAN NETWORK:
67  * See also:  nlsname(3), nlsconnect(3), nlsestablish(3)
68  */
69 
70 /*
71  * defines for compatability purposes
72  */
73 
74 #define	nls_prot_msg	nls_v0_d
75 #define	nls_v2_msg	nls_v2_s
76 
77 static char *nls_v0_d = "NLPS:000:001:%d";
78 static char *nls_v0_s = "NLPS:000:001:%s";
79 static char *nls_v2_d = "NLPS:002:002:%d";
80 static char *nls_v2_s = "NLPS:002:002:%s";
81 
82 #define	NLSSTART	0
83 #define	NLSFORMAT	2
84 #define	NLSUNKNOWN	3
85 #define	NLSDISABLED	4
86 
87 #define	SVC_CODE_SZ	14
88 
89 /*
90  * Structure for handling multiple connection requests on the same stream.
91  */
92 
93 struct callsave {
94 	struct t_call *c_cp;
95 	struct callsave *c_np;
96 };
97 
98 struct call_list {
99 	struct callsave *cl_head;
100 	struct callsave *cl_tail;
101 };
102 
103 
104 #define	EMPTYLIST(p)	(p->cl_head == (struct callsave *) NULL)
105 
106 /*
107  * Ridiculously high value for maximum number of connects per stream.
108  * Transport Provider will determine actual maximum to be used.
109  */
110 
111 #define	MAXCON		100
112 
113 /*
114  * these are names of environment variables that the listener
115  * adds to the servers environment before the exec(2).
116  *
117  * the variables should be accessed via library routines.
118  *
119  * see nlsgetcall(3X) and nlsprovider(3X).
120  */
121 
122 #define	NLSADDR		"NLSADDR"
123 #define	NLSOPT		"NLSOPT"
124 #define	NLSUDATA	"NLSUDATA"
125 #define	NLSPROVIDER	"NLSPROVIDER"
126 
127 /*
128  * the following variables can be accessed "normally"
129  */
130 
131 #define	HOME		"HOME"
132 #define	PATH		"PATH"
133 
134 #ifdef	__cplusplus
135 }
136 #endif
137 
138 #endif	/* _LISTEN_H */
139