xref: /illumos-gate/usr/src/cmd/cmd-inet/sbin/dhcpagent/ipc_action.h (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	IPC_ACTION_H
27 #define	IPC_ACTION_H
28 
29 #include <sys/types.h>
30 #include <netinet/in.h>
31 #include <netinet/dhcp.h>
32 #include <dhcpagent_ipc.h>
33 #include <libinetutil.h>
34 
35 #include "common.h"
36 
37 /*
38  * ipc_action.[ch] make up the interface used to control the current
39  * pending interprocess communication transaction taking place.  see
40  * ipc_action.c for documentation on how to use the exported functions.
41  */
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 typedef struct ipc_action {
48 	dhcp_ipc_type_t		ia_cmd;		/* command/action requested  */
49 	int			ia_fd;		/* ipc channel descriptor */
50 	iu_timer_id_t		ia_tid;		/* ipc timer id */
51 	iu_event_id_t		ia_eid;		/* ipc event ID */
52 	dhcp_ipc_request_t	*ia_request;	/* ipc request pointer */
53 } ipc_action_t;
54 
55 void		ipc_action_init(ipc_action_t *);
56 boolean_t	ipc_action_start(dhcp_smach_t *, ipc_action_t *);
57 void		ipc_action_finish(dhcp_smach_t *, int);
58 void		send_error_reply(ipc_action_t *, int);
59 void		send_ok_reply(ipc_action_t *);
60 void		send_data_reply(ipc_action_t *, int, dhcp_data_type_t,
61 		    const void *, size_t);
62 
63 #ifdef	__cplusplus
64 }
65 #endif
66 
67 #endif	/* IPC_ACTION_H */
68