rac.c revision 61961e0f20c7637a3846bb39786bb9dffa91dfb9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* rac.c
*/
#include "rac_private.h"
#include <ctype.h>
#include <sys/resource.h>
#include <netconfig.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
struct rpc_err rac_senderr;
void
{
}
enum clnt_stat
{
}
enum clnt_stat
{
}
void *
{
struct rac_send_req req;
}
/* Some utility functions for use by rpc */
/*
* Cache the result of getrlimit(), so we don't have to do an
* expensive call every time.
*/
int
__rpc_dtbsize(void)
{
static int tbsize = 0;
if (tbsize) {
return (tbsize);
}
}
/*
* Something wrong. I'll try to save face by returning a
* pessimistic number.
*/
return (32);
}
/*
* Find the appropriate buffer size
*/
{
if (bufsize == -2) {
/* transfer of data unsupported */
return ((uint_t)0);
}
if (size == 0) {
/*
* bufsize == -1 : No limit on the size
* bufsize == 0 : Concept of tsdu foreign. Choose
* a value.
*/
return ((uint_t)RPC_MAXDATASIZE);
} else {
}
}
}
/* Check whether the value is within the upper max limit */
}
/*
* Find the appropriate address buffer size
*/
{
if (size >= 0) {
}
if (size <= -2) {
return ((uint_t)0);
}
/*
* (size == -1) No limit on the size. we impose a limit here.
*/
return ((uint_t)RPC_MAXADDRSIZE);
}
/*
* For the given nettype (tcp or udp only), return the first structure found.
* This should be freed by calling freenetconfigent()
*/
struct netconfig *
__rpc_getconfip(char *nettype)
{
char *netid;
static char *netid_tcp;
static char *netid_udp;
void *confighandle;
if (!(confighandle = setnetconfig()))
return (NULL);
}
}
(void) endnetconfig(confighandle);
}
else {
return (NULL);
}
return (NULL);
return (getnetconfigent(netid));
}
struct handle {
int nflag; /* Whether NETPATH or NETCONFIG */
int nettype;
};
struct _rpcnettype {
const char *name;
const int type;
} _rpctypelist[] = {
"netpath", _RPC_NETPATH,
"visible", _RPC_VISIBLE,
"circuit_v", _RPC_CIRCUIT_V,
"datagram_v", _RPC_DATAGRAM_V,
"circuit_n", _RPC_CIRCUIT_N,
"datagram_n", _RPC_DATAGRAM_N,
"tcp", _RPC_TCP,
"udp", _RPC_UDP,
0, _RPC_NONE
};
static char *
strlocase(char *p)
{
char *t = p;
for (; *p; p++)
if (isupper(*p))
*p = tolower(*p);
return (t);
}
/*
* If nettype is NULL, it defaults to NETPATH.
*/
static int
getnettype(char *nettype)
{
int i;
return (_RPC_NETPATH); /* Default */
for (i = 0; _rpctypelist[i].name; i++)
return (_rpctypelist[i].type);
}
return (_rpctypelist[i].type);
}
/*
* Returns the type of the nettype, which should then be used with
* __rpc_getconf().
*/
void *
__rpc_setconf(char *nettype)
{
return (NULL);
case _RPC_NETPATH:
case _RPC_CIRCUIT_N:
case _RPC_DATAGRAM_N:
return (NULL);
}
break;
case _RPC_VISIBLE:
case _RPC_CIRCUIT_V:
case _RPC_DATAGRAM_V:
case _RPC_TCP:
case _RPC_UDP:
return (NULL);
}
break;
default:
return (NULL);
}
return (handle);
}
/*
* Returns the next netconfig struct for the given "net" type.
* __rpc_setconf() should have been called previously.
*/
struct netconfig *
__rpc_getconf(void *vhandle)
{
return (NULL);
/* CONSTCOND */
while (1) {
else
break;
continue;
case _RPC_VISIBLE:
continue;
/* FALLTHRU */
case _RPC_NETPATH: /* Be happy */
break;
case _RPC_CIRCUIT_V:
continue;
/* FALLTHRU */
case _RPC_CIRCUIT_N:
continue;
break;
case _RPC_DATAGRAM_V:
continue;
/* FALLTHRU */
case _RPC_DATAGRAM_N:
continue;
break;
case _RPC_TCP:
continue;
break;
case _RPC_UDP:
continue;
break;
}
break;
}
return (nconf);
}
void
__rpc_endconf(void *vhandle)
{
return;
} else {
}
}
/*
* Given an fd_set pointer and the number of bits to check in it,
* initialize the supplied pollfd array for RPC's use (RPC only
* polls for input events). We return the number of pollfd slots
* we initialized.
*/
int
{
long *in;
int j; /* loop counter */
ulong_t b; /* bits to test */
int n;
/*
* For each fd, if the appropriate bit is set convert it into
* the appropriate pollfd struct.
*/
if (b & 1) {
p->fd = n + j;
return (p - p0);
}
p++;
}
return (p - p0);
}
/*
* Convert from timevals (used by select) to milliseconds (used by poll).
*/
int
__rpc_timeval_to_msec(struct timeval *t)
{
/*
* We're really returning t->tv_sec * 1000 + (t->tv_usec / 1000)
* but try to do so efficiently. Note: 1000 = 1024 - 16 - 8.
*/
if (t->tv_usec)
return (t1);
}
/* ************************** Client utility routine ************* */
static void
{
switch (acpt_stat) {
case PROG_UNAVAIL:
return;
case PROG_MISMATCH:
return;
case PROC_UNAVAIL:
return;
case GARBAGE_ARGS:
return;
case SYSTEM_ERR:
return;
case SUCCESS:
return;
}
/* something's wrong, but we don't know what ... */
}
static void
{
switch (rjct_stat) {
case RPC_MISMATCH:
return;
case AUTH_ERROR:
return;
}
/* something's wrong, but we don't know what ... */
}
/*
* given a reply message, fills in the error
*/
void
{
/* optimized for normal, SUCCESSful case */
case MSG_ACCEPTED:
return;
};
break;
case MSG_DENIED:
break;
default:
break;
}
case RPC_VERSMISMATCH:
break;
case RPC_AUTHERROR:
break;
case RPC_PROGVERSMISMATCH:
break;
}
}