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