omapi.c revision 499b34cea04a46823d003d4c0520c8b03e8513cb
/*
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: omapi.c,v 1.30 2001/01/09 21:39:59 bwelling Exp $ */
/*
* Principal Author: DCL
*/
#include <config.h>
#include <string.h>
/*
* The control_object structure is used for receiving commands that
* request the server to perform some action, but that do not set or
* get any state.
*/
typedef struct control_object {
static control_object_t control;
static omapi_objecttype_t *control_type;
/*
* Ok, kind of gross. Sorry. A little.
*/
/*
* This is the function that is called when an incoming OMAPI_OP_OPEN
* message is received with either the create or update option set.
* value list.
*/
static isc_result_t
{
char *args;
"received control channel command '%.*s'",
REGION_FMT(®ion));
return (ISC_R_FAILURE); /* XXX can this happen? */
return (ISC_R_NOMEMORY);
/*
* Compare the 'name' parameter against all known control commands.
*/
} else if (omapi_string_strcmp(name,
NS_OMAPI_COMMAND_RELOADCONFIG) == 0 ||
NS_OMAPI_COMMAND_RELOADZONES) == 0) {
"unimplemented channel command '%.*s'",
REGION_FMT(®ion));
== 0) {
} else {
"unknown control channel command '%.*s'",
REGION_FMT(®ion));
}
return (result);
}
/*
* This is the function that is called by the library's internal
* message_process function when an incoming OMAPI_OP_OPEN message is received.
* It is supposed to look up the object in the server that corresponds to the
*/
static isc_result_t
/*
* There is only one control object so no key is needed to look it up.
*/
return (ISC_R_SUCCESS);
}
/*
* This function is called when the server is sending a reply to a client
* that opened an object of its type. It needs to output all published
* for any inner objects (but in this program, there will be no inner
* objects). The handle parameter is an object of the type registered
* in ns_omapi_listen.
*/
static isc_result_t
/*
* Currently the server has no values to publish, but it needs
* to publish something for its OMAPI_OP_UPDATE function to work
* when received by the client.
*/
}
ns_omapi_init(void) {
if (result == ISC_R_SUCCESS)
/*
* Register the control_object. NS_OMAPI_CONTROL is
* what a client would need to specify as a value for
* the value of "type" in a message when contacting
* the server to perform a control function.
*/
NULL, /* getvalue */
NULL, /* destroy */
NULL, /* signalhandler */
NULL, /* create */
NULL); /* remove */
if (result == ISC_R_SUCCESS) {
/*
* Initialize the static control object.
*/
}
return (result);
}