ipc_action.c revision d04ccbb3f3163ae5962a8b7465d9796bff6ca434
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <dhcpmsg.h>
#include <dhcpagent_ipc.h>
#include "agent.h"
#include "states.h"
#include "interface.h"
#include "ipc_action.h"
#include "util.h"
static iu_tq_callback_t ipc_action_timeout;
/*
* ipc_action_init(): initializes the ipc_action structure
*
* input: ipc_action_t *: the structure to initialize
* output: void
*/
void
{
}
/*
* ipc_action_start(): starts an ipc_action request on a DHCP state machine
*
* input: dhcp_smach_t *: the state machine to start the action on
* ipc_action_t *: request structure
* output: B_TRUE if the request is started successfully, B_FALSE otherwise
* original request is still valid on failure, consumed otherwise.
*/
{
return (B_FALSE);
}
if (!async_cancel(dsmp)) {
return (B_FALSE);
}
} else {
"timer for %s on %s",
return (B_FALSE);
}
}
/* We've taken ownership, so the input request is now invalid */
/* This cannot fail due to the async_cancel above */
return (B_TRUE);
}
/*
* ipc_action_finish(): completes an ipc_action request on an interface
*
* input: dhcp_smach_t *: the state machine to complete the action on
* int: the reason why the action finished (nonzero on error)
* output: void
*/
void
{
"ipc_action_finish: attempted to finish unknown action "
return;
}
"ipc_action_finish: finished %s (command %d) on %s: %d",
/*
* if we can't cancel this timer, we're really in the
* twilight zone. however, as long as we don't drop the
* reference to the state machine, it shouldn't hurt us
*/
}
if (reason == 0)
else
}
/*
* ipc_action_timeout(): times out an ipc_action on a state machine (the
* request continues asynchronously, however)
*
* input: iu_tq_t *: unused
* void *: the dhcp_smach_t * the ipc_action was pending on
* output: void
*/
/* ARGSUSED */
static void
{
}
/*
* send_ok_reply(): sends an "ok" reply to a request and closes the ipc
* connection
*
* input: ipc_action_t *: the request to reply to
* output: void
* note: the request is freed (thus the request must be on the heap).
*/
void
{
send_error_reply(ia, 0);
}
/*
* send_error_reply(): sends an "error" reply to a request and closes the ipc
* connection
*
* input: ipc_action_t *: the request to reply to
* int: the error to send back on the ipc connection
* output: void
* note: the request is freed (thus the request must be on the heap).
*/
void
{
}
/*
* send_data_reply(): sends a reply to a request and closes the ipc connection
*
* input: ipc_action_t *: the request to reply to
* int: the status to send back on the ipc connection (zero for
* success, DHCP_IPC_E_* otherwise).
* dhcp_data_type_t: the type of the payload in the reply
* const void *: the payload for the reply, or NULL if there is no
* payload
* size_t: the size of the payload
* output: void
* note: the request is freed (thus the request must be on the heap).
*/
void
{
int retval;
return;
type);
}
/*
* free the request since we've now used it to send our reply.
* we can also close the socket since the reply has been sent.
*/
}