18360efbdSAlfred Perlstein.\" @(#)rpc_svc_create.3n 1.26 93/08/26 SMI; from SVr4 28360efbdSAlfred Perlstein.\" Copyright 1989 AT&T 38360efbdSAlfred Perlstein.\" @(#)rpc_svc_create 1.3 89/06/28 SMI; 48360efbdSAlfred Perlstein.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. 58360efbdSAlfred Perlstein.\" $FreeBSD$ 68360efbdSAlfred Perlstein.Dd May 3, 1993 78360efbdSAlfred Perlstein.Dt RPC_SVC_CREATE 3 88360efbdSAlfred Perlstein.Os 98360efbdSAlfred Perlstein.Sh NAME 108360efbdSAlfred Perlstein.Nm rpc_svc_create , 118360efbdSAlfred Perlstein.Nm svc_control , 128360efbdSAlfred Perlstein.Nm svc_create , 138360efbdSAlfred Perlstein.Nm svc_destroy , 148360efbdSAlfred Perlstein.Nm svc_dg_create , 158360efbdSAlfred Perlstein.Nm svc_fd_create , 168360efbdSAlfred Perlstein.Nm svc_raw_create , 178360efbdSAlfred Perlstein.Nm svc_tli_create , 188360efbdSAlfred Perlstein.Nm svc_tp_create , 198360efbdSAlfred Perlstein.Nm svc_vc_create 208360efbdSAlfred Perlstein.Nd library routines for the creation of server handles 218360efbdSAlfred Perlstein.Sh LIBRARY 228360efbdSAlfred Perlstein.Lb libc 238360efbdSAlfred Perlstein.Sh SYNOPSIS 248360efbdSAlfred Perlstein.Fd #include <rpc/rpc.h> 258360efbdSAlfred Perlstein.Ft bool_t 268360efbdSAlfred Perlstein.Fn svc_control "SVCXPRT *svc" "const u_int req" "void *info" 278360efbdSAlfred Perlstein.Ft int 288360efbdSAlfred Perlstein.Fn svc_create "const void (*dispatch)(struct svc_req *, SVCXPRT *)" "const rpcprog_t prognum" "const rpcvers_t versnum" "const char *nettype" 298360efbdSAlfred Perlstein.Ft SVCXPRT *" 308360efbdSAlfred Perlstein.Fn svc_dg_create "const int fildes" "const u_int sendsz" "const u_int recvsz" 318360efbdSAlfred Perlstein.Ft void 328360efbdSAlfred Perlstein.Fn svc_destroy "SVCXPRT *xprt" 338360efbdSAlfred Perlstein.Ft "SVCXPRT *" 348360efbdSAlfred Perlstein.Fn svc_fd_create "const int fildes" "const u_int sendsz" "const u_int recvsz" 358360efbdSAlfred Perlstein.Ft "SVCXPRT *" 368360efbdSAlfred Perlstein.Fn svc_raw_create "void" 378360efbdSAlfred Perlstein.Ft "SVCXPRT *" 388360efbdSAlfred Perlstein.Fn svc_tli_create "const int fildes" "const struct netconfig *netconf" "const struct t_bind *bindaddr" "const u_int sendsz" "const u_int recvsz" 398360efbdSAlfred Perlstein.Ft "SVCXPRT *" 408360efbdSAlfred Perlstein.Fn svc_tp_create "const void (*dispatch)(const struct svc_reg *, const SVCXPRT *)" "const rpcprog_t prognum" "const rpcvers_t versnum" "const struct netconfig *netconf" 418360efbdSAlfred Perlstein.Ft "SVCXPRT *" 428360efbdSAlfred Perlstein.Fn svc_vc_create "const int fildes" "const u_int sendsz" "const u_int recvsz" 438360efbdSAlfred Perlstein.Sh DESCRIPTION 448360efbdSAlfred PerlsteinThese routines are part of the RPC 458360efbdSAlfred Perlsteinlibrary which allows C language programs to make procedure 468360efbdSAlfred Perlsteincalls on servers across the network. 478360efbdSAlfred PerlsteinThese routines deal with the creation of service handles. 488360efbdSAlfred PerlsteinOnce the handle is created, the server can be invoked by calling 498360efbdSAlfred Perlstein.Fn svc_run . 508360efbdSAlfred Perlstein.Sh Routines 518360efbdSAlfred PerlsteinSee 528360efbdSAlfred Perlstein.Xr rpc 3 538360efbdSAlfred Perlsteinfor the definition of the 548360efbdSAlfred Perlstein.Vt SVCXPRT 558360efbdSAlfred Perlsteindata structure. 568360efbdSAlfred Perlstein.Bl -tag -width XXXXX 578360efbdSAlfred Perlstein.It Fn svc_control 588360efbdSAlfred PerlsteinA function to change or retrieve various information 598360efbdSAlfred Perlsteinabout a service object. 608360efbdSAlfred Perlstein.Fa req 618360efbdSAlfred Perlsteinindicates the type of operation and 628360efbdSAlfred Perlstein.Fa info 638360efbdSAlfred Perlsteinis a pointer to the information. 648360efbdSAlfred PerlsteinThe supported values of 658360efbdSAlfred Perlstein.Fa req , 668360efbdSAlfred Perlsteintheir argument types, and what they do are: 678360efbdSAlfred Perlstein.Bl -tag -width SVCGET_XID 688360efbdSAlfred Perlstein.It Dv SVCGET_VERSQUIET 698360efbdSAlfred PerlsteinIf a request is received for a program number 708360efbdSAlfred Perlsteinserved by this server but the version number 718360efbdSAlfred Perlsteinis outside the range registered with the server, 728360efbdSAlfred Perlsteinan 738360efbdSAlfred Perlstein.Dv RPC_PROGVERSMISMATCH 748360efbdSAlfred Perlsteinerror will normally 758360efbdSAlfred Perlsteinbe returned. 768360efbdSAlfred Perlstein.Fa info 778360efbdSAlfred Perlsteinshould be a pointer to an 788360efbdSAlfred Perlsteininteger. 798360efbdSAlfred PerlsteinUpon successful completion of the 808360efbdSAlfred Perlstein.Dv SVCGET_VERSQUIET 818360efbdSAlfred Perlsteinrequest, 828360efbdSAlfred Perlstein.Fa *info 838360efbdSAlfred Perlsteincontains an 848360efbdSAlfred Perlsteininteger which describes the server's current 858360efbdSAlfred Perlsteinbehavior: 0 indicates normal server behavior 868360efbdSAlfred Perlstein(that is, an 878360efbdSAlfred Perlstein.Dv RPC_PROGVERSMISMATCH 888360efbdSAlfred Perlsteinerror 898360efbdSAlfred Perlsteinwill be returned); 1 indicates that the out of 908360efbdSAlfred Perlsteinrange request will be silently ignored. 918360efbdSAlfred Perlstein.It Dv SVCSET_VERSQUIET 928360efbdSAlfred PerlsteinIf a request is received for a program number 938360efbdSAlfred Perlsteinserved by this server but the version number 948360efbdSAlfred Perlsteinis outside the range registered with the server, 958360efbdSAlfred Perlsteinan 968360efbdSAlfred Perlstein.Dv RPC_PROGVERSMISMATCH 978360efbdSAlfred Perlsteinerror will normally 988360efbdSAlfred Perlsteinbe returned. 998360efbdSAlfred PerlsteinIt is sometimes desirable to 1008360efbdSAlfred Perlsteinchange this behavior. 1018360efbdSAlfred Perlstein.Fa info 1028360efbdSAlfred Perlsteinshould be a 1038360efbdSAlfred Perlsteinpointer to an integer which is either 0 1048360efbdSAlfred Perlstein(indicating normal server behavior - an 1058360efbdSAlfred Perlstein.Dv RPC_PROGVERSMISMATCH 1068360efbdSAlfred Perlsteinerror will be returned), 1078360efbdSAlfred Perlsteinor 1 (indicating that the out of range request 1088360efbdSAlfred Perlsteinshould be silently ignored). 1098360efbdSAlfred Perlstein.El 1108360efbdSAlfred Perlstein.It Fn svc_create 1118360efbdSAlfred Perlstein.Fn svc_create 1128360efbdSAlfred Perlsteincreates server handles for all the transports 1138360efbdSAlfred Perlsteinbelonging to the class 1148360efbdSAlfred Perlstein.Fa nettype . 1158360efbdSAlfred Perlstein.Fa nettype 1168360efbdSAlfred Perlsteindefines a class of transports which can be used 1178360efbdSAlfred Perlsteinfor a particular application. 1188360efbdSAlfred PerlsteinThe transports are tried in left to right order in 1198360efbdSAlfred Perlstein.Ev NETPATH 1208360efbdSAlfred Perlsteinvariable or in top to bottom order in the netconfig database. 1218360efbdSAlfred PerlsteinIf 1228360efbdSAlfred Perlstein.Fa nettype 1238360efbdSAlfred Perlsteinis 1248360efbdSAlfred Perlstein.Dv NULL , 1258360efbdSAlfred Perlsteinit defaults to 1268360efbdSAlfred Perlstein.Qq netpath . 1278360efbdSAlfred Perlstein.Pp 1288360efbdSAlfred Perlstein.Fn svc_create 1298360efbdSAlfred Perlsteinregisters itself with the rpcbind 1308360efbdSAlfred Perlsteinservice (see 1318360efbdSAlfred Perlstein.Xr rpcbind 8 ) . 1328360efbdSAlfred Perlstein.Fa dispatch 1338360efbdSAlfred Perlsteinis called when there is a remote procedure call for the given 1348360efbdSAlfred Perlstein.Fa prognum 1358360efbdSAlfred Perlsteinand 1368360efbdSAlfred Perlstein.Fa versnum ; 1378360efbdSAlfred Perlsteinthis requires calling 1388360efbdSAlfred Perlstein.Fn svc_run 1398360efbdSAlfred Perlstein(see 1408360efbdSAlfred Perlstein.Fn svc_run 1418360efbdSAlfred Perlsteinin 1428360efbdSAlfred Perlstein.Xr rpc_svc_reg 3 ) . 1438360efbdSAlfred PerlsteinIf 1448360efbdSAlfred Perlstein.Fn svc_create 1458360efbdSAlfred Perlsteinsucceeds, it returns the number of server 1468360efbdSAlfred Perlsteinhandles it created, 1478360efbdSAlfred Perlsteinotherwise it returns 0 and an error message is logged. 1488360efbdSAlfred Perlstein.It Fn svc_destroy 1498360efbdSAlfred PerlsteinA function macro that destroys the RPC 1508360efbdSAlfred Perlsteinservice handle 1518360efbdSAlfred Perlstein.Fa xprt . 1528360efbdSAlfred PerlsteinDestruction usually involves deallocation 1538360efbdSAlfred Perlsteinof private data structures, 1548360efbdSAlfred Perlsteinincluding 1558360efbdSAlfred Perlstein.Fa xprt 1568360efbdSAlfred Perlsteinitself. 1578360efbdSAlfred PerlsteinUse of 1588360efbdSAlfred Perlstein.Fa xprt 1598360efbdSAlfred Perlsteinis undefined after calling this routine. 1608360efbdSAlfred Perlstein.It Fn svc_dg_create 1618360efbdSAlfred PerlsteinThis routine creates a connectionless RPC 1628360efbdSAlfred Perlsteinservice handle, and returns a pointer to it. 1638360efbdSAlfred PerlsteinThis routine returns 1648360efbdSAlfred Perlstein.Dv NULL 1658360efbdSAlfred Perlsteinif it fails, and an error message is logged. 1668360efbdSAlfred Perlstein.Fa sendsz 1678360efbdSAlfred Perlsteinand 1688360efbdSAlfred Perlstein.Fa recvsz 1698360efbdSAlfred Perlsteinare parameters used to specify the size of the buffers. 1708360efbdSAlfred PerlsteinIf they are 0, suitable defaults are chosen. 1718360efbdSAlfred PerlsteinThe file descriptor 1728360efbdSAlfred Perlstein.Fa fildes 1738360efbdSAlfred Perlsteinshould be open and bound. 1748360efbdSAlfred PerlsteinThe server is not registered with 1758360efbdSAlfred Perlstein.Xr rpcbind 8 . 1768360efbdSAlfred Perlstein.Pp 1778360efbdSAlfred PerlsteinWarning: 1788360efbdSAlfred Perlsteinsince connectionless-based RPC 1798360efbdSAlfred Perlsteinmessages can only hold limited amount of encoded data, 1808360efbdSAlfred Perlsteinthis transport cannot be used for procedures 1818360efbdSAlfred Perlsteinthat take large arguments or return huge results. 1828360efbdSAlfred Perlstein.It Fn svc_fd_create 1838360efbdSAlfred PerlsteinThis routine creates a service on top of an open and bound file descriptor, 1848360efbdSAlfred Perlsteinand returns the handle to it. 1858360efbdSAlfred PerlsteinTypically, this descriptor is a connected file descriptor for a 1868360efbdSAlfred Perlsteinconnection-oriented transport. 1878360efbdSAlfred Perlstein.Fa sendsz 1888360efbdSAlfred Perlsteinand 1898360efbdSAlfred Perlstein.Fa recvsz 1908360efbdSAlfred Perlsteinindicate sizes for the send and receive buffers. 1918360efbdSAlfred PerlsteinIf they are 0, reasonable defaults are chosen. 1928360efbdSAlfred PerlsteinThis routine returns 1938360efbdSAlfred Perlstein.Dv NULL 1948360efbdSAlfred Perlsteinif it fails, and an error message is logged. 1958360efbdSAlfred Perlstein.It Fn svc_raw_create 1968360efbdSAlfred PerlsteinThis routine creates an RPC 1978360efbdSAlfred Perlsteinservice handle and returns a pointer to it. 1988360efbdSAlfred PerlsteinThe transport is really a buffer within the process's 1998360efbdSAlfred Perlsteinaddress space, so the corresponding RPC 2008360efbdSAlfred Perlsteinclient should live in the same address space; 2018360efbdSAlfred Perlstein(see 2028360efbdSAlfred Perlstein.Fn clnt_raw_create 2038360efbdSAlfred Perlsteinin 2048360efbdSAlfred Perlstein.Xr rpc_clnt_create 3 ) . 2058360efbdSAlfred PerlsteinThis routine allows simulation of RPC and acquisition of 2068360efbdSAlfred PerlsteinRPC overheads (such as round trip times), 2078360efbdSAlfred Perlsteinwithout any kernel and networking interference. 2088360efbdSAlfred PerlsteinThis routine returns 2098360efbdSAlfred Perlstein.Dv NULL 2108360efbdSAlfred Perlsteinif it fails, and an error message is logged. 2118360efbdSAlfred Perlstein.Pp 2128360efbdSAlfred PerlsteinNote: 2138360efbdSAlfred Perlstein.Fn svc_run 2148360efbdSAlfred Perlsteinshould not be called when the raw interface is being used. 2158360efbdSAlfred Perlstein.It Fn svc_tli_create 2168360efbdSAlfred PerlsteinThis routine creates an RPC 2178360efbdSAlfred Perlsteinserver handle, and returns a pointer to it. 2188360efbdSAlfred Perlstein.Fa fildes 2198360efbdSAlfred Perlsteinis the file descriptor on which the service is listening. 2208360efbdSAlfred PerlsteinIf 2218360efbdSAlfred Perlstein.Fa fildes 2228360efbdSAlfred Perlsteinis 2238360efbdSAlfred Perlstein.Dv RPC_ANYFD , 2248360efbdSAlfred Perlsteinit opens a file descriptor on the transport specified by 2258360efbdSAlfred Perlstein.Fa netconf . 2268360efbdSAlfred PerlsteinIf the file descriptor is unbound and 2278360efbdSAlfred Perlstein.Fa bindaddr 2288360efbdSAlfred Perlsteinis not 2298360efbdSAlfred Perlstein.Dv NULL , 2308360efbdSAlfred Perlstein.Fa fildes 2318360efbdSAlfred Perlsteinis bound to the address specified by 2328360efbdSAlfred Perlstein.Fa bindaddr , 2338360efbdSAlfred Perlsteinotherwise 2348360efbdSAlfred Perlstein.Fa fildes 2358360efbdSAlfred Perlsteinis bound to a default address chosen by the transport. 2368360efbdSAlfred Perlstein.Pp 2378360efbdSAlfred PerlsteinNote: the 2388360efbdSAlfred Perlstein.Vt t_bind 2398360efbdSAlfred Perlsteinstructure comes from the TLI/XTI SysV interface, which 2408360efbdSAlfred Perlstein.Nx 2418360efbdSAlfred Perlsteindoes not use. 2428360efbdSAlfred PerlsteinThe structure is defined in 2438360efbdSAlfred Perlstein.Aq Pa rpc/types.h 2448360efbdSAlfred Perlsteinfor compatibility as: 2458360efbdSAlfred Perlstein.Bd -literal 2468360efbdSAlfred Perlsteinstruct t_bind { 2478360efbdSAlfred Perlstein struct netbuf addr; /* network address, see rpc(3) */ 2488360efbdSAlfred Perlstein unsigned int qlen; /* queue length (for listen(2)) */ 2498360efbdSAlfred Perlstein}; 2508360efbdSAlfred Perlstein.Ed 2518360efbdSAlfred Perlstein.Pp 2528360efbdSAlfred PerlsteinIn the case where the default address is chosen, 2538360efbdSAlfred Perlsteinthe number of outstanding connect requests is set to 8 2548360efbdSAlfred Perlsteinfor connection-oriented transports. 2558360efbdSAlfred PerlsteinThe user may specify the size of the send and receive buffers 2568360efbdSAlfred Perlsteinwith the parameters 2578360efbdSAlfred Perlstein.Fa sendsz 2588360efbdSAlfred Perlsteinand 2598360efbdSAlfred Perlstein.Fa recvsz ; 2608360efbdSAlfred Perlsteinvalues of 0 choose suitable defaults. 2618360efbdSAlfred PerlsteinThis routine returns 2628360efbdSAlfred Perlstein.Dv NULL 2638360efbdSAlfred Perlsteinif it fails, 2648360efbdSAlfred Perlsteinand an error message is logged. 2658360efbdSAlfred PerlsteinThe server is not registered with the 2668360efbdSAlfred Perlstein.Xr rpcbind 8 2678360efbdSAlfred Perlsteinservice. 2688360efbdSAlfred Perlstein.It Fn svc_tp_create 2698360efbdSAlfred Perlstein.Fn svc_tp_create 2708360efbdSAlfred Perlsteincreates a server handle for the network 2718360efbdSAlfred Perlsteinspecified by 2728360efbdSAlfred Perlstein.Fa netconf , 2738360efbdSAlfred Perlsteinand registers itself with the rpcbind service. 2748360efbdSAlfred Perlstein.Fa dispatch 2758360efbdSAlfred Perlsteinis called when there is a remote procedure call 2768360efbdSAlfred Perlsteinfor the given 2778360efbdSAlfred Perlstein.Fa prognum 2788360efbdSAlfred Perlsteinand 2798360efbdSAlfred Perlstein.Fa versnum ; 2808360efbdSAlfred Perlsteinthis requires calling 2818360efbdSAlfred Perlstein.Fn svc_run . 2828360efbdSAlfred Perlstein.Fn svc_tp_create 2838360efbdSAlfred Perlsteinreturns the service handle if it succeeds, 2848360efbdSAlfred Perlsteinotherwise a 2858360efbdSAlfred Perlstein.Dv NULL 2868360efbdSAlfred Perlsteinis returned and an error message is logged. 2878360efbdSAlfred Perlstein.It Fn svc_vc_create 2888360efbdSAlfred PerlsteinThis routine creates a connection-oriented RPC 2898360efbdSAlfred Perlsteinservice and returns a pointer to it. 2908360efbdSAlfred PerlsteinThis routine returns 2918360efbdSAlfred Perlstein.Dv NULL 2928360efbdSAlfred Perlsteinif it fails, and an error message is logged. 2938360efbdSAlfred PerlsteinThe users may specify the size of the send and receive buffers 2948360efbdSAlfred Perlsteinwith the parameters 2958360efbdSAlfred Perlstein.Fa sendsz 2968360efbdSAlfred Perlsteinand 2978360efbdSAlfred Perlstein.Fa recvsz ; 2988360efbdSAlfred Perlsteinvalues of 0 choose suitable defaults. 2998360efbdSAlfred PerlsteinThe file descriptor 3008360efbdSAlfred Perlstein.Fa fildes 3018360efbdSAlfred Perlsteinshould be open and bound. 3028360efbdSAlfred PerlsteinThe server is not registered with the 3038360efbdSAlfred Perlstein.Xr rpcbind 8 3048360efbdSAlfred Perlsteinservice. 3058360efbdSAlfred Perlstein.El 3068360efbdSAlfred Perlstein.Sh SEE ALSO 3078360efbdSAlfred Perlstein.Xr rpc 3 , 3088360efbdSAlfred Perlstein.Xr rpc_svc_calls 3 , 3098360efbdSAlfred Perlstein.Xr rpc_svc_err 3 , 3108360efbdSAlfred Perlstein.Xr rpc_svc_reg 3 , 3118360efbdSAlfred Perlstein.Xr rpcbind 8 3128360efbdSAlfred Perlstein.\" @(#)rpc_svc_create.3n 1.26 93/08/26 SMI; from SVr4 3138360efbdSAlfred Perlstein.\" Copyright 1989 AT&T 3148360efbdSAlfred Perlstein.\" @(#)rpc_svc_create 1.3 89/06/28 SMI; 3158360efbdSAlfred Perlstein.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. 3168360efbdSAlfred Perlstein.\" $FreeBSD$ 3178360efbdSAlfred Perlstein.Dd May 3, 1993 3188360efbdSAlfred Perlstein.Dt RPC_SVC_CREATE 3 3198360efbdSAlfred Perlstein.Os 3208360efbdSAlfred Perlstein.Sh NAME 3218360efbdSAlfred Perlstein.Nm rpc_svc_create , 3228360efbdSAlfred Perlstein.Nm svc_control , 3238360efbdSAlfred Perlstein.Nm svc_create , 3248360efbdSAlfred Perlstein.Nm svc_destroy , 3258360efbdSAlfred Perlstein.Nm svc_dg_create , 3268360efbdSAlfred Perlstein.Nm svc_fd_create , 3278360efbdSAlfred Perlstein.Nm svc_raw_create , 3288360efbdSAlfred Perlstein.Nm svc_tli_create , 3298360efbdSAlfred Perlstein.Nm svc_tp_create , 3308360efbdSAlfred Perlstein.Nm svc_vc_create 3318360efbdSAlfred Perlstein.Nd library routines for the creation of server handles 3328360efbdSAlfred Perlstein.Sh LIBRARY 3338360efbdSAlfred Perlstein.Lb libc 3348360efbdSAlfred Perlstein.Sh SYNOPSIS 3358360efbdSAlfred Perlstein.Fd #include <rpc/rpc.h> 3368360efbdSAlfred Perlstein.Ft bool_t 3378360efbdSAlfred Perlstein.Fn svc_control "SVCXPRT *svc" "const u_int req" "void *info" 3388360efbdSAlfred Perlstein.Ft int 3398360efbdSAlfred Perlstein.Fn svc_create "const void (*dispatch)(struct svc_req *, SVCXPRT *)" "const rpcprog_t prognum" "const rpcvers_t versnum" "const char *nettype" 3408360efbdSAlfred Perlstein.Ft SVCXPRT *" 3418360efbdSAlfred Perlstein.Fn svc_dg_create "const int fildes" "const u_int sendsz" "const u_int recvsz" 3428360efbdSAlfred Perlstein.Ft void 3438360efbdSAlfred Perlstein.Fn svc_destroy "SVCXPRT *xprt" 3448360efbdSAlfred Perlstein.Ft "SVCXPRT *" 3458360efbdSAlfred Perlstein.Fn svc_fd_create "const int fildes" "const u_int sendsz" "const u_int recvsz" 3468360efbdSAlfred Perlstein.Ft "SVCXPRT *" 3478360efbdSAlfred Perlstein.Fn svc_raw_create "void" 3488360efbdSAlfred Perlstein.Ft "SVCXPRT *" 3498360efbdSAlfred Perlstein.Fn svc_tli_create "const int fildes" "const struct netconfig *netconf" "const struct t_bind *bindaddr" "const u_int sendsz" "const u_int recvsz" 3508360efbdSAlfred Perlstein.Ft "SVCXPRT *" 3518360efbdSAlfred Perlstein.Fn svc_tp_create "const void (*dispatch)(const struct svc_reg *, const SVCXPRT *)" "const rpcprog_t prognum" "const rpcvers_t versnum" "const struct netconfig *netconf" 3528360efbdSAlfred Perlstein.Ft "SVCXPRT *" 3538360efbdSAlfred Perlstein.Fn svc_vc_create "const int fildes" "const u_int sendsz" "const u_int recvsz" 3548360efbdSAlfred Perlstein.Sh DESCRIPTION 3558360efbdSAlfred PerlsteinThese routines are part of the RPC 3568360efbdSAlfred Perlsteinlibrary which allows C language programs to make procedure 3578360efbdSAlfred Perlsteincalls on servers across the network. 3588360efbdSAlfred PerlsteinThese routines deal with the creation of service handles. 3598360efbdSAlfred PerlsteinOnce the handle is created, the server can be invoked by calling 3608360efbdSAlfred Perlstein.Fn svc_run . 3618360efbdSAlfred Perlstein.Sh Routines 3628360efbdSAlfred PerlsteinSee 3638360efbdSAlfred Perlstein.Xr rpc 3 3648360efbdSAlfred Perlsteinfor the definition of the 3658360efbdSAlfred Perlstein.Vt SVCXPRT 3668360efbdSAlfred Perlsteindata structure. 3678360efbdSAlfred Perlstein.Bl -tag -width XXXXX 3688360efbdSAlfred Perlstein.It Fn svc_control 3698360efbdSAlfred PerlsteinA function to change or retrieve various information 3708360efbdSAlfred Perlsteinabout a service object. 3718360efbdSAlfred Perlstein.Fa req 3728360efbdSAlfred Perlsteinindicates the type of operation and 3738360efbdSAlfred Perlstein.Fa info 3748360efbdSAlfred Perlsteinis a pointer to the information. 3758360efbdSAlfred PerlsteinThe supported values of 3768360efbdSAlfred Perlstein.Fa req , 3778360efbdSAlfred Perlsteintheir argument types, and what they do are: 3788360efbdSAlfred Perlstein.Bl -tag -width SVCGET_XID 3798360efbdSAlfred Perlstein.It Dv SVCGET_VERSQUIET 3808360efbdSAlfred PerlsteinIf a request is received for a program number 3818360efbdSAlfred Perlsteinserved by this server but the version number 3828360efbdSAlfred Perlsteinis outside the range registered with the server, 3838360efbdSAlfred Perlsteinan 3848360efbdSAlfred Perlstein.Dv RPC_PROGVERSMISMATCH 3858360efbdSAlfred Perlsteinerror will normally 3868360efbdSAlfred Perlsteinbe returned. 3878360efbdSAlfred Perlstein.Fa info 3888360efbdSAlfred Perlsteinshould be a pointer to an 3898360efbdSAlfred Perlsteininteger. 3908360efbdSAlfred PerlsteinUpon successful completion of the 3918360efbdSAlfred Perlstein.Dv SVCGET_VERSQUIET 3928360efbdSAlfred Perlsteinrequest, 3938360efbdSAlfred Perlstein.Fa *info 3948360efbdSAlfred Perlsteincontains an 3958360efbdSAlfred Perlsteininteger which describes the server's current 3968360efbdSAlfred Perlsteinbehavior: 0 indicates normal server behavior 3978360efbdSAlfred Perlstein(that is, an 3988360efbdSAlfred Perlstein.Dv RPC_PROGVERSMISMATCH 3998360efbdSAlfred Perlsteinerror 4008360efbdSAlfred Perlsteinwill be returned); 1 indicates that the out of 4018360efbdSAlfred Perlsteinrange request will be silently ignored. 4028360efbdSAlfred Perlstein.It Dv SVCSET_VERSQUIET 4038360efbdSAlfred PerlsteinIf a request is received for a program number 4048360efbdSAlfred Perlsteinserved by this server but the version number 4058360efbdSAlfred Perlsteinis outside the range registered with the server, 4068360efbdSAlfred Perlsteinan 4078360efbdSAlfred Perlstein.Dv RPC_PROGVERSMISMATCH 4088360efbdSAlfred Perlsteinerror will normally 4098360efbdSAlfred Perlsteinbe returned. 4108360efbdSAlfred PerlsteinIt is sometimes desirable to 4118360efbdSAlfred Perlsteinchange this behavior. 4128360efbdSAlfred Perlstein.Fa info 4138360efbdSAlfred Perlsteinshould be a 4148360efbdSAlfred Perlsteinpointer to an integer which is either 0 4158360efbdSAlfred Perlstein(indicating normal server behavior - an 4168360efbdSAlfred Perlstein.Dv RPC_PROGVERSMISMATCH 4178360efbdSAlfred Perlsteinerror will be returned), 4188360efbdSAlfred Perlsteinor 1 (indicating that the out of range request 4198360efbdSAlfred Perlsteinshould be silently ignored). 4208360efbdSAlfred Perlstein.El 4218360efbdSAlfred Perlstein.It Fn svc_create 4228360efbdSAlfred Perlstein.Fn svc_create 4238360efbdSAlfred Perlsteincreates server handles for all the transports 4248360efbdSAlfred Perlsteinbelonging to the class 4258360efbdSAlfred Perlstein.Fa nettype . 4268360efbdSAlfred Perlstein.Fa nettype 4278360efbdSAlfred Perlsteindefines a class of transports which can be used 4288360efbdSAlfred Perlsteinfor a particular application. 4298360efbdSAlfred PerlsteinThe transports are tried in left to right order in 4308360efbdSAlfred Perlstein.Ev NETPATH 4318360efbdSAlfred Perlsteinvariable or in top to bottom order in the netconfig database. 4328360efbdSAlfred PerlsteinIf 4338360efbdSAlfred Perlstein.Fa nettype 4348360efbdSAlfred Perlsteinis 4358360efbdSAlfred Perlstein.Dv NULL , 4368360efbdSAlfred Perlsteinit defaults to 4378360efbdSAlfred Perlstein.Qq netpath . 4388360efbdSAlfred Perlstein.Pp 4398360efbdSAlfred Perlstein.Fn svc_create 4408360efbdSAlfred Perlsteinregisters itself with the rpcbind 4418360efbdSAlfred Perlsteinservice (see 4428360efbdSAlfred Perlstein.Xr rpcbind 8 ) . 4438360efbdSAlfred Perlstein.Fa dispatch 4448360efbdSAlfred Perlsteinis called when there is a remote procedure call for the given 4458360efbdSAlfred Perlstein.Fa prognum 4468360efbdSAlfred Perlsteinand 4478360efbdSAlfred Perlstein.Fa versnum ; 4488360efbdSAlfred Perlsteinthis requires calling 4498360efbdSAlfred Perlstein.Fn svc_run 4508360efbdSAlfred Perlstein(see 4518360efbdSAlfred Perlstein.Fn svc_run 4528360efbdSAlfred Perlsteinin 4538360efbdSAlfred Perlstein.Xr rpc_svc_reg 3 ) . 4548360efbdSAlfred PerlsteinIf 4558360efbdSAlfred Perlstein.Fn svc_create 4568360efbdSAlfred Perlsteinsucceeds, it returns the number of server 4578360efbdSAlfred Perlsteinhandles it created, 4588360efbdSAlfred Perlsteinotherwise it returns 0 and an error message is logged. 4598360efbdSAlfred Perlstein.It Fn svc_destroy 4608360efbdSAlfred PerlsteinA function macro that destroys the RPC 4618360efbdSAlfred Perlsteinservice handle 4628360efbdSAlfred Perlstein.Fa xprt . 4638360efbdSAlfred PerlsteinDestruction usually involves deallocation 4648360efbdSAlfred Perlsteinof private data structures, 4658360efbdSAlfred Perlsteinincluding 4668360efbdSAlfred Perlstein.Fa xprt 4678360efbdSAlfred Perlsteinitself. 4688360efbdSAlfred PerlsteinUse of 4698360efbdSAlfred Perlstein.Fa xprt 4708360efbdSAlfred Perlsteinis undefined after calling this routine. 4718360efbdSAlfred Perlstein.It Fn svc_dg_create 4728360efbdSAlfred PerlsteinThis routine creates a connectionless RPC 4738360efbdSAlfred Perlsteinservice handle, and returns a pointer to it. 4748360efbdSAlfred PerlsteinThis routine returns 4758360efbdSAlfred Perlstein.Dv NULL 4768360efbdSAlfred Perlsteinif it fails, and an error message is logged. 4778360efbdSAlfred Perlstein.Fa sendsz 4788360efbdSAlfred Perlsteinand 4798360efbdSAlfred Perlstein.Fa recvsz 4808360efbdSAlfred Perlsteinare parameters used to specify the size of the buffers. 4818360efbdSAlfred PerlsteinIf they are 0, suitable defaults are chosen. 4828360efbdSAlfred PerlsteinThe file descriptor 4838360efbdSAlfred Perlstein.Fa fildes 4848360efbdSAlfred Perlsteinshould be open and bound. 4858360efbdSAlfred PerlsteinThe server is not registered with 4868360efbdSAlfred Perlstein.Xr rpcbind 8 . 4878360efbdSAlfred Perlstein.Pp 4888360efbdSAlfred PerlsteinWarning: 4898360efbdSAlfred Perlsteinsince connectionless-based RPC 4908360efbdSAlfred Perlsteinmessages can only hold limited amount of encoded data, 4918360efbdSAlfred Perlsteinthis transport cannot be used for procedures 4928360efbdSAlfred Perlsteinthat take large arguments or return huge results. 4938360efbdSAlfred Perlstein.It Fn svc_fd_create 4948360efbdSAlfred PerlsteinThis routine creates a service on top of an open and bound file descriptor, 4958360efbdSAlfred Perlsteinand returns the handle to it. 4968360efbdSAlfred PerlsteinTypically, this descriptor is a connected file descriptor for a 4978360efbdSAlfred Perlsteinconnection-oriented transport. 4988360efbdSAlfred Perlstein.Fa sendsz 4998360efbdSAlfred Perlsteinand 5008360efbdSAlfred Perlstein.Fa recvsz 5018360efbdSAlfred Perlsteinindicate sizes for the send and receive buffers. 5028360efbdSAlfred PerlsteinIf they are 0, reasonable defaults are chosen. 5038360efbdSAlfred PerlsteinThis routine returns 5048360efbdSAlfred Perlstein.Dv NULL 5058360efbdSAlfred Perlsteinif it fails, and an error message is logged. 5068360efbdSAlfred Perlstein.It Fn svc_raw_create 5078360efbdSAlfred PerlsteinThis routine creates an RPC 5088360efbdSAlfred Perlsteinservice handle and returns a pointer to it. 5098360efbdSAlfred PerlsteinThe transport is really a buffer within the process's 5108360efbdSAlfred Perlsteinaddress space, so the corresponding RPC 5118360efbdSAlfred Perlsteinclient should live in the same address space; 5128360efbdSAlfred Perlstein(see 5138360efbdSAlfred Perlstein.Fn clnt_raw_create 5148360efbdSAlfred Perlsteinin 5158360efbdSAlfred Perlstein.Xr rpc_clnt_create 3 ) . 5168360efbdSAlfred PerlsteinThis routine allows simulation of RPC and acquisition of 5178360efbdSAlfred PerlsteinRPC overheads (such as round trip times), 5188360efbdSAlfred Perlsteinwithout any kernel and networking interference. 5198360efbdSAlfred PerlsteinThis routine returns 5208360efbdSAlfred Perlstein.Dv NULL 5218360efbdSAlfred Perlsteinif it fails, and an error message is logged. 5228360efbdSAlfred Perlstein.Pp 5238360efbdSAlfred PerlsteinNote: 5248360efbdSAlfred Perlstein.Fn svc_run 5258360efbdSAlfred Perlsteinshould not be called when the raw interface is being used. 5268360efbdSAlfred Perlstein.It Fn svc_tli_create 5278360efbdSAlfred PerlsteinThis routine creates an RPC 5288360efbdSAlfred Perlsteinserver handle, and returns a pointer to it. 5298360efbdSAlfred Perlstein.Fa fildes 5308360efbdSAlfred Perlsteinis the file descriptor on which the service is listening. 5318360efbdSAlfred PerlsteinIf 5328360efbdSAlfred Perlstein.Fa fildes 5338360efbdSAlfred Perlsteinis 5348360efbdSAlfred Perlstein.Dv RPC_ANYFD , 5358360efbdSAlfred Perlsteinit opens a file descriptor on the transport specified by 5368360efbdSAlfred Perlstein.Fa netconf . 5378360efbdSAlfred PerlsteinIf the file descriptor is unbound and 5388360efbdSAlfred Perlstein.Fa bindaddr 5398360efbdSAlfred Perlsteinis not 5408360efbdSAlfred Perlstein.Dv NULL , 5418360efbdSAlfred Perlstein.Fa fildes 5428360efbdSAlfred Perlsteinis bound to the address specified by 5438360efbdSAlfred Perlstein.Fa bindaddr , 5448360efbdSAlfred Perlsteinotherwise 5458360efbdSAlfred Perlstein.Fa fildes 5468360efbdSAlfred Perlsteinis bound to a default address chosen by the transport. 5478360efbdSAlfred Perlstein.Pp 5488360efbdSAlfred PerlsteinNote: the 5498360efbdSAlfred Perlstein.Vt t_bind 5508360efbdSAlfred Perlsteinstructure comes from the TLI/XTI SysV interface, which 5518360efbdSAlfred Perlstein.Nx 5528360efbdSAlfred Perlsteindoes not use. 5538360efbdSAlfred PerlsteinThe structure is defined in 5548360efbdSAlfred Perlstein.Aq Pa rpc/types.h 5558360efbdSAlfred Perlsteinfor compatibility as: 5568360efbdSAlfred Perlstein.Bd -literal 5578360efbdSAlfred Perlsteinstruct t_bind { 5588360efbdSAlfred Perlstein struct netbuf addr; /* network address, see rpc(3) */ 5598360efbdSAlfred Perlstein unsigned int qlen; /* queue length (for listen(2)) */ 5608360efbdSAlfred Perlstein}; 5618360efbdSAlfred Perlstein.Ed 5628360efbdSAlfred Perlstein.Pp 5638360efbdSAlfred PerlsteinIn the case where the default address is chosen, 5648360efbdSAlfred Perlsteinthe number of outstanding connect requests is set to 8 5658360efbdSAlfred Perlsteinfor connection-oriented transports. 5668360efbdSAlfred PerlsteinThe user may specify the size of the send and receive buffers 5678360efbdSAlfred Perlsteinwith the parameters 5688360efbdSAlfred Perlstein.Fa sendsz 5698360efbdSAlfred Perlsteinand 5708360efbdSAlfred Perlstein.Fa recvsz ; 5718360efbdSAlfred Perlsteinvalues of 0 choose suitable defaults. 5728360efbdSAlfred PerlsteinThis routine returns 5738360efbdSAlfred Perlstein.Dv NULL 5748360efbdSAlfred Perlsteinif it fails, 5758360efbdSAlfred Perlsteinand an error message is logged. 5768360efbdSAlfred PerlsteinThe server is not registered with the 5778360efbdSAlfred Perlstein.Xr rpcbind 8 5788360efbdSAlfred Perlsteinservice. 5798360efbdSAlfred Perlstein.It Fn svc_tp_create 5808360efbdSAlfred Perlstein.Fn svc_tp_create 5818360efbdSAlfred Perlsteincreates a server handle for the network 5828360efbdSAlfred Perlsteinspecified by 5838360efbdSAlfred Perlstein.Fa netconf , 5848360efbdSAlfred Perlsteinand registers itself with the rpcbind service. 5858360efbdSAlfred Perlstein.Fa dispatch 5868360efbdSAlfred Perlsteinis called when there is a remote procedure call 5878360efbdSAlfred Perlsteinfor the given 5888360efbdSAlfred Perlstein.Fa prognum 5898360efbdSAlfred Perlsteinand 5908360efbdSAlfred Perlstein.Fa versnum ; 5918360efbdSAlfred Perlsteinthis requires calling 5928360efbdSAlfred Perlstein.Fn svc_run . 5938360efbdSAlfred Perlstein.Fn svc_tp_create 5948360efbdSAlfred Perlsteinreturns the service handle if it succeeds, 5958360efbdSAlfred Perlsteinotherwise a 5968360efbdSAlfred Perlstein.Dv NULL 5978360efbdSAlfred Perlsteinis returned and an error message is logged. 5988360efbdSAlfred Perlstein.It Fn svc_vc_create 5998360efbdSAlfred PerlsteinThis routine creates a connection-oriented RPC 6008360efbdSAlfred Perlsteinservice and returns a pointer to it. 6018360efbdSAlfred PerlsteinThis routine returns 6028360efbdSAlfred Perlstein.Dv NULL 6038360efbdSAlfred Perlsteinif it fails, and an error message is logged. 6048360efbdSAlfred PerlsteinThe users may specify the size of the send and receive buffers 6058360efbdSAlfred Perlsteinwith the parameters 6068360efbdSAlfred Perlstein.Fa sendsz 6078360efbdSAlfred Perlsteinand 6088360efbdSAlfred Perlstein.Fa recvsz ; 6098360efbdSAlfred Perlsteinvalues of 0 choose suitable defaults. 6108360efbdSAlfred PerlsteinThe file descriptor 6118360efbdSAlfred Perlstein.Fa fildes 6128360efbdSAlfred Perlsteinshould be open and bound. 6138360efbdSAlfred PerlsteinThe server is not registered with the 6148360efbdSAlfred Perlstein.Xr rpcbind 8 6158360efbdSAlfred Perlsteinservice. 6168360efbdSAlfred Perlstein.El 6178360efbdSAlfred Perlstein.Sh SEE ALSO 6188360efbdSAlfred Perlstein.Xr rpc 3 , 6198360efbdSAlfred Perlstein.Xr rpc_svc_calls 3 , 6208360efbdSAlfred Perlstein.Xr rpc_svc_err 3 , 6218360efbdSAlfred Perlstein.Xr rpc_svc_reg 3 , 6228360efbdSAlfred Perlstein.Xr rpcbind 8 623