klpdlib.c revision ddf7fe95b8ad67aa16deb427a0b78f4dd4ff22b1
/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "synonyms.h"
#include "priv_private.h"
#include "mtlib.h"
#include "libc.h"
#include <door.h>
#include <errno.h>
#include <priv.h>
#include <klpd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
typedef struct klpd_data {
void *kd_user_cookie;
int kd_doorfd;
} klpd_data_t;
typedef struct klpd_ctxt {
char *kc_path;
int kc_int;
int kc_type;
} klpd_ctxt_t;
/* ARGSUSED */
static void
{
klpd_data_t *p = kd_cookie;
int res;
klpd_arg_t *ka;
if (argp == DOOR_UNREF_DATA) {
}
case KLPDARG_NONE:
break;
case KLPDARG_VNODE:
break;
default:
break;
}
res = 0;
else
res = 1;
}
void *
void *cookie)
{
if (p == NULL)
return (NULL);
if (p->kd_doorfd == -1)
goto out;
p->kd_user_cookie = cookie;
p->kd_callback = callback;
return (p);
out:
free(p);
return (NULL);
}
int
{
klpd_data_t *p = handle;
priv_data_t *d;
LOADPRIVDATA(d);
/* We really need to have the privilege set as argument here */
return (-1);
/* Registration for the current process? Then do the thing. */
}
return (0);
}
int
{
}
int
{
klpd_data_t *p = handle;
int err;
err = -1;
free(p);
return (err);
}
int
klpd_unregister(void *handle)
{
}
const char *
klpd_getpath(void *context)
{
klpd_ctxt_t *p = context;
if (p->kc_type != KLPDARG_VNODE)
return (p->kc_path);
}
int
{
klpd_ctxt_t *p = context;
switch (p->kc_type) {
case KLPDARG_TCPPORT:
*proto = IPPROTO_TCP;
break;
case KLPDARG_UDPPORT:
*proto = IPPROTO_UDP;
break;
case KLPDARG_SCTPPORT:
*proto = IPPROTO_SCTP;
break;
case KLPDARG_SDPPORT:
break;
default:
return (-1);
}
return (p->kc_int);
}
/*ARGSUSED*/
int
{
return (door_ucred(uc));
}