xref: /titanic_52/usr/src/uts/common/rpc/svc_soc.h (revision c0dd49bdd68c0d758a67d56f07826f3b45cfc664)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28 /*
29  * Portions of this source code were derived from Berkeley
30  * 4.3 BSD under license from the Regents of the University of
31  * California.
32  */
33 
34 /*
35  * svc_soc.h, Server-side remote procedure call interface.
36  *
37  * All the following declarations are only for backward compatibility
38  * with SUNOS 4.0.
39  */
40 
41 #ifndef _RPC_SVC_SOC_H
42 #define	_RPC_SVC_SOC_H
43 
44 #pragma ident	"%Z%%M%	%I%	%E% SMI"
45 
46 #ifndef _KERNEL
47 
48 #include <sys/socket.h>
49 #include <netinet/in.h>
50 #include <rpc/svc.h>
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 /*
57  *  Approved way of getting address of caller
58  */
59 #define	svc_getcaller(x)	((struct sockaddr_in *)(x)->xp_rtaddr.buf)
60 
61 /*
62  * Service registration and unregistration.
63  *
64  * svc_register(xprt, prog, vers, dispatch, protocol)
65  * svc_unregister(prog, vers);
66  */
67 #ifdef __STDC__
68 extern bool_t svc_register(SVCXPRT *, rpcprog_t, rpcvers_t,
69     void (*)(struct svc_req *, SVCXPRT *), int);
70 extern void svc_unregister(rpcprog_t, rpcvers_t);
71 
72 /*
73  * Memory based rpc for testing and timing.
74  */
75 extern SVCXPRT *svcraw_create(void);
76 
77 /*
78  * Udp based rpc. For compatibility reasons
79  */
80 extern SVCXPRT *svcudp_create(int);
81 extern SVCXPRT *svcudp_bufcreate(int, uint_t, uint_t);
82 
83 /*
84  * Tcp based rpc.
85  */
86 extern SVCXPRT *svctcp_create(int, uint_t, uint_t);
87 extern SVCXPRT *svcfd_create(int, uint_t, uint_t);
88 
89 /*
90  * For connectionless kind of transport. Obsoleted by rpc_reg()
91  *
92  * registerrpc(prognum, versnum, procnum, progname, inproc, outproc)
93  *      rpcprog_t prognum;
94  *      rpcvers_t versnum;
95  *      rpcproc_t procnum;
96  *      char *(*progname)();
97  *      xdrproc_t inproc, outproc;
98  */
99 extern int registerrpc(rpcprog_t, rpcvers_t, rpcproc_t, char *(*)(),
100 				xdrproc_t, xdrproc_t);
101 #else	/* __STDC__ */
102 extern bool_t svc_register();
103 extern void svc_unregister();
104 extern SVCXPRT *svcraw_create();
105 extern SVCXPRT *svcudp_create();
106 extern SVCXPRT *svcudp_bufcreate();
107 extern SVCXPRT *svctcp_create();
108 extern SVCXPRT *svcfd_create();
109 extern int registerrpc();
110 #endif	/* __STDC__ */
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 #endif	/* _KERNEL */
116 
117 #endif /* !_RPC_SVC_SOC_H */
118