xref: /illumos-gate/usr/src/uts/common/rpc/svc_soc.h (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
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 #ifndef _KERNEL
45 
46 #include <sys/socket.h>
47 #include <netinet/in.h>
48 #include <rpc/svc.h>
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /*
55  *  Approved way of getting address of caller
56  */
57 #define	svc_getcaller(x)	((struct sockaddr_in *)(x)->xp_rtaddr.buf)
58 
59 /*
60  * Service registration and unregistration.
61  *
62  * svc_register(xprt, prog, vers, dispatch, protocol)
63  * svc_unregister(prog, vers);
64  */
65 #ifdef __STDC__
66 extern bool_t svc_register(SVCXPRT *, rpcprog_t, rpcvers_t,
67     void (*)(struct svc_req *, SVCXPRT *), int);
68 extern void svc_unregister(rpcprog_t, rpcvers_t);
69 
70 /*
71  * Memory based rpc for testing and timing.
72  */
73 extern SVCXPRT *svcraw_create(void);
74 
75 /*
76  * Udp based rpc. For compatibility reasons
77  */
78 extern SVCXPRT *svcudp_create(int);
79 extern SVCXPRT *svcudp_bufcreate(int, uint_t, uint_t);
80 
81 /*
82  * Tcp based rpc.
83  */
84 extern SVCXPRT *svctcp_create(int, uint_t, uint_t);
85 extern SVCXPRT *svcfd_create(int, uint_t, uint_t);
86 
87 /*
88  * For connectionless kind of transport. Obsoleted by rpc_reg()
89  *
90  * registerrpc(prognum, versnum, procnum, progname, inproc, outproc)
91  *      rpcprog_t prognum;
92  *      rpcvers_t versnum;
93  *      rpcproc_t procnum;
94  *      char *(*progname)();
95  *      xdrproc_t inproc, outproc;
96  */
97 extern int registerrpc(rpcprog_t, rpcvers_t, rpcproc_t, char *(*)(),
98 				xdrproc_t, xdrproc_t);
99 #else	/* __STDC__ */
100 extern bool_t svc_register();
101 extern void svc_unregister();
102 extern SVCXPRT *svcraw_create();
103 extern SVCXPRT *svcudp_create();
104 extern SVCXPRT *svcudp_bufcreate();
105 extern SVCXPRT *svctcp_create();
106 extern SVCXPRT *svcfd_create();
107 extern int registerrpc();
108 #endif	/* __STDC__ */
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 #endif	/* _KERNEL */
114 
115 #endif /* !_RPC_SVC_SOC_H */
116