/*
* 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
*/
/*
*/
#ifndef _DHCPAGENT_IPC_H
#define _DHCPAGENT_IPC_H
#include <stddef.h>
#include <limits.h>
#include <dhcp_impl.h>
/*
* dhcpagent_ipc.[ch] comprise the interface used to perform
* interprocess communication with the agent. see dhcpagent_ipc.c for
* documentation on how to use the exported functions.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Solaris 10 Branded Zones also use this, so it cannot be changed to
*/
/*
* return values which should be used by programs which talk to the
* agent (for uniformity).
*/
#define DHCP_EXIT_SUCCESS 0
/*
* opaque types for requests and replies. users of this api do not
* need to understand their contents.
*/
/* payloads that can be passed in a request or reply */
typedef enum {
/*
* requests that can be sent to the agent
*
* code in dhcpagent relies on the numeric values of these
* requests -- but there's no sane reason to change them anyway.
*
* If any commands are changed, added, or removed, see the ipc_typestr[]
* array in dhcpagent_ipc.c.
*/
typedef enum {
/* structure passed with the DHCP_GET_TAG request */
typedef struct {
/* special timeout values for dhcp_ipc_make_request() */
/*
* errors that can be returned from the provided functions.
* note: keep in sync with dhcp_ipc_strerror()
*/
enum {
/* System call errors must be kept contiguous */
/* All others follow */
};
/*
* low-level public dhcpagent ipc functions -- these are for use by
* programs that need to communicate with the dhcpagent. these will
* remain relatively stable.
*/
extern const char *dhcp_ipc_strerror(int);
const void *, uint32_t, dhcp_data_type_t);
dhcp_data_type_t *);
extern int dhcp_ipc_make_request(dhcp_ipc_request_t *,
dhcp_ipc_reply_t **, int32_t);
extern const char *dhcp_ipc_type_to_string(dhcp_ipc_type_t);
/*
* high-level public dhcpagent ipc functions
*/
/*
* private dhcpagent ipc "server side" functions -- these are only for
* use by dhcpagent(1M) and are subject to change.
*/
extern int dhcp_ipc_init(int *);
extern int dhcp_ipc_accept(int, int *, int *);
extern int dhcp_ipc_recv_request(int, dhcp_ipc_request_t **, int);
const void *, uint32_t, dhcp_data_type_t);
extern int dhcp_ipc_send_reply(int, dhcp_ipc_reply_t *);
extern int dhcp_ipc_close(int);
/*
* values for if_state in the dhcp_status_t
*
* code in this library and dhcpagent rely on the numeric values of these
* requests -- but there's no sane reason to change them anyway.
*/
typedef enum {
} DHCPSTATE;
/* values for if_dflags in the dhcp_status_t */
/*
* structure passed with the DHCP_STATUS replies
*
* when parsing a dhcp_status_t, `version' should always be checked
* if there is a need to access any fields which were not defined in
* version 1 of this structure.
*
* as new fields are added to the dhcp_status_t, they should be
* appended to the structure and the version number incremented.
*/
typedef struct dhcp_status {
/*
* these three fields are initially zero, and get incremented
* as if_state goes from INIT -> BOUND (or INIT ->
* INFORMATION). if and when the interface moves to the
* RENEWING state, these fields are reset, so they always
* either indicate the number of packets sent, received, and
* declined while obtaining the current lease (if BOUND), or
* the number of packets sent, received, and declined while
* attempting to obtain a future lease (if any other state).
*/
/*
* if_cid contains the client identifier, either obtained
* from the config file or generated by the dhcpagent.
* if_cidlen contains the length of if_cid.
*/
sizeof (uint32_t))
/*
* the remainder of this file contains implementation-specific
* artifacts which may change. note that a `dhcp_ipc_request_t' and a
* `dhcp_ipc_reply_t' are incomplete types as far as consumers of this
* api are concerned. use these details at your own risk.
*/
/*
* note: the first 4 fields of the dhcp_ipc_request_t and dhcp_ipc_reply_t
* are intentionally identical; code in dhcpagent_ipc.c counts on it!
*/
struct dhcp_ipc_request {
};
struct dhcp_ipc_reply {
};
/*
* since ansi c won't let us define arrays with 0 elements, the
*/
#ifdef __cplusplus
}
#endif
#endif /* _DHCPAGENT_IPC_H */