packet.h revision e704a8f24a369484ba8f4a1cf49d4db00dd91166
/*
* 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.
*/
#ifndef _PACKET_H
#define _PACKET_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <dhcp_impl.h>
#include "common.h"
/*
* packet.[ch] contain routines for manipulating, setting, and
* how to use the exported functions.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* data type for recv_pkt(). needed because we may want to wait for
* several kinds of packets at once, and the existing enumeration of
* DHCP packet types does not provide a way to do that easily. here,
* we light a different bit in the enumeration for each type of packet
* we want to receive.
*
* Note that for DHCPv6, types 4 (CONFIRM), 5 (RENEW), 6 (REBIND), 12
* (RELAY-FORW, and 13 (RELAY-REPL) are not in the table. They're never
* received by a client, so there's no reason to process them. (SOLICIT,
* REQUEST, DECLINE, RELEASE, and INFORMATION-REQUEST are also never seen by
* clients, but are included for consistency.)
*
* Note also that the symbols are named for the DHCPv4 message types, and that
* DHCPv6 has analogous message types.
*/
typedef enum {
/*
* A dhcp_pkt_t is used by the output-side packet manipulation functions.
* While the structure is not strictly necessary, it allows a better separation
* of functionality since metadata about the packet (such as its current
* length) is stored along with the packet.
*
* Note that 'pkt' points to a dhcpv6_message_t if the packet is IPv6.
*/
typedef struct dhcp_pkt_s {
unsigned int pkt_max_len; /* its maximum length */
unsigned int pkt_cur_len; /* its current length */
} dhcp_pkt_t;
/*
* a `stop_func_t' is used by parts of dhcpagent that use the
* retransmission capability of send_pkt(). this makes it so the
* callers of send_pkt() decide when to stop retransmitting, which
* makes more sense than hardcoding their instance-specific cases into
* packet.c
*/
/*
* Default I/O and interface control sockets.
*/
extern int v6_sock_fd;
extern int v4_sock_fd;
extern const in6_addr_t ipv6_all_dhcp_relay_and_servers;
extern const in6_addr_t my_in6addr_any;
void free_pkt_entry(PKT_LIST *);
void free_pkt_list(PKT_LIST **);
const void *, uint_t);
void stop_pkt_retransmission(dhcp_smach_t *);
void retransmit_now(dhcp_smach_t *);
stop_func_t *);
boolean_t dhcp_ip_default(void);
#ifdef __cplusplus
}
#endif
#endif /* _PACKET_H */