/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* BSD 3 Clause License
*
* Copyright (c) 2007, The Storage Networking Industry Association.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* - Neither the name of The Storage Networking Industry Association (SNIA)
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* This file contains all the door server code */
#include <door.h>
#include <alloca.h>
#include <errno.h>
#include <note.h>
#include <libintl.h>
#include <ndmpd_door.h>
#include "ndmpd.h"
/* static variables */
/* static routines */
/*
* Statistics used in ndmpstat command
*/
int
ndmp_door_init(void)
{
int fd;
(void) mutex_lock(&ndmp_doorsrv_mutex);
if (ndmp_door_fildes != -1) {
"ndmp_door_init: ndmpd service is already running.");
(void) mutex_unlock(&ndmp_doorsrv_mutex);
return (0);
}
NULL, DOOR_UNREF)) < 0) {
(void) mutex_unlock(&ndmp_doorsrv_mutex);
return (-1);
}
(void) unlink(NDMP_DOOR_SVC);
(void) door_revoke(ndmp_door_fildes);
ndmp_door_fildes = -1;
(void) mutex_unlock(&ndmp_doorsrv_mutex);
return (-1);
}
(void) fdetach(NDMP_DOOR_SVC);
(void) door_revoke(ndmp_door_fildes);
ndmp_door_fildes = -1;
(void) mutex_unlock(&ndmp_doorsrv_mutex);
return (-1);
}
(void) mutex_unlock(&ndmp_doorsrv_mutex);
return (0);
}
void
ndmp_door_fini(void)
{
(void) mutex_lock(&ndmp_doorsrv_mutex);
if (ndmp_door_fildes != -1) {
(void) fdetach(NDMP_DOOR_SVC);
(void) door_revoke(ndmp_door_fildes);
ndmp_door_fildes = -1;
}
(void) mutex_unlock(&ndmp_doorsrv_mutex);
}
ndmp_door_check(void)
{
int door;
return (0);
return (0);
}
return (1);
}
return (0);
}
/* door server */
/*ARGSUSED*/
void
{
int req_type;
char *buf;
int buflen;
unsigned int used;
unsigned int dec_status;
unsigned int enc_status;
if (dec_ctx == 0)
return;
(void) ndmp_door_decode_finish(dec_ctx);
return;
}
if (enc_ctx == 0) {
(void) ndmp_door_decode_finish(dec_ctx);
return;
}
if (req_type != NDMP_GET_STAT)
switch (req_type) {
case NDMP_GET_DOOR_STATUS: {
break;
}
case NDMP_DEVICES_GET_INFO: {
break;
}
case NDMP_SHOW: {
break;
}
case NDMP_TERMINATE_SESSION_ID: {
else
break;
}
case NDMP_GET_STAT:
break;
default:
"ndmp_door_server: Invalid request type 0x%x", req_type);
goto decode_error;
}
goto decode_error;
goto encode_error;
return;
return;
}