/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* clnt_doors.c, Client side for doors IPC based RPC.
*/
#include "mt.h"
#include "rpc_mt.h"
#include <errno.h>
#include <syslog.h>
#include <door.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <alloca.h>
#include <atomic.h>
static struct clnt_ops *clnt_door_ops();
extern int __rpc_default_door_buf_size;
extern int __rpc_min_door_buf_size;
/*
* Private data kept per client handle
*/
struct cu_data {
};
/*
* Door IPC based client creation routine.
*
* NB: The rpch->cl_auth is initialized to null authentication.
* Caller may wish to set this something more useful.
*
* sendsz is the maximum allowable packet size that can be sent.
* 0 will cause default to be used.
*/
CLIENT *
{
int did;
(int)version);
return (NULL);
}
return (NULL);
}
/*
* Determine send size
*/
if (sendsz < __rpc_min_door_buf_size)
else
goto err;
}
/*
* Precreate RPC header for performance reasons.
*/
goto err;
}
goto err;
}
goto err;
}
return (cl);
err:
if (cl) {
if (cu)
}
return (NULL);
}
/* ARGSUSED */
static enum clnt_stat
{
/* LINTED pointer alignment */
char *outbuf_ref;
rpc_callerr.re_errno = 0;
rpc_callerr.re_terrno = 0;
rpc_callerr.re_terrno = 0;
}
rpc_callerr.re_terrno = 0;
}
/* Increment XID (not really needed for RPC over doors...) */
/* LINTED pointer alignment */
/* LINTED pointer alignment */
}
}
}
/* LINTED pointer alignment */
goto done;
}
else
}
(void) xdr_opaque_auth(&xdrs,
}
}
/*
* If unsuccesful AND error is an authentication error
* then refresh credentials and try again, else break
*/
/*
* maybe our credentials need to be refreshed ...
*/
if (nrefreshes-- &&
if (need_to_unmap)
goto call_again;
} else
/*
* We are setting rpc_callerr here given that
* libnsl is not reentrant thereby
* reinitializing the TSD. If not set here then
* success could be returned even though refresh
* failed.
*/
}
} else
done:
if (need_to_unmap)
return (rpc_callerr.re_status);
}
/* ARGSUSED */
static enum clnt_stat
{
/* send() call not supported on doors */
rpc_callerr.re_terrno = 0;
}
static void
{
/* LINTED pointer alignment */
*errp = rpc_callerr;
}
/* ARGSUSED */
static bool_t
{
}
static void
{
}
static bool_t
{
/* LINTED pointer alignment */
switch (request) {
case CLSET_FD_CLOSE:
return (TRUE);
case CLSET_FD_NCLOSE:
return (TRUE);
}
/* for other requests which use info */
return (FALSE);
switch (request) {
case CLGET_FD:
/* LINTED pointer alignment */
break;
case CLGET_XID:
/*
* use the knowledge that xid is the
* first element in the call structure *.
* This will get the xid of the PREVIOUS call
*/
/* LINTED pointer alignment */
break;
case CLSET_XID:
/* This will set the xid of the NEXT call */
/* LINTED pointer alignment */
/* decrement by 1 as clnt_door_call() increments once */
break;
case CLGET_VERS:
/*
* This RELIES on the information that, in the call body,
* the version number field is the fifth field from the
* begining of the RPC header. MUST be changed if the
* call_struct is changed
*/
/* LINTED pointer alignment */
4 * BYTES_PER_XDR_UNIT));
break;
case CLSET_VERS:
/* LINTED pointer alignment */
/* LINTED pointer alignment */
break;
case CLGET_PROG:
/*
* This RELIES on the information that, in the call body,
* the program number field is the fourth field from the
* begining of the RPC header. MUST be changed if the
* call_struct is changed
*/
/* LINTED pointer alignment */
3 * BYTES_PER_XDR_UNIT));
break;
case CLSET_PROG:
/* LINTED pointer alignment */
/* LINTED pointer alignment */
break;
default:
return (FALSE);
}
return (TRUE);
}
static void
{
/* LINTED pointer alignment */
if (cu->cu_closeit)
}
static struct clnt_ops *
clnt_door_ops(void)
{
}
return (&ops);
}
int
{
/* LINTED pointer alignment */
/* Make sure that the right door id is used in door_call. */
return (0);
}
return (0);
}
return (1);
}