27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
5ae115bcmrj * Common Development and Distribution License (the "License").
6ae115bcmrj * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
22dedec47Jack Meng * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bdstevel@tonic-gate * Use is subject to license terms.
247c478bdstevel@tonic-gate */
267c478bdstevel@tonic-gate#ifndef	_BOOTPROPS_H
277c478bdstevel@tonic-gate#define	_BOOTPROPS_H
297c478bdstevel@tonic-gate#include <sys/types.h>
306cefaaeJack Meng#include <netinet/in.h>
316cefaaeJack Meng#include <sys/t_kuser.h>
337c478bdstevel@tonic-gate#ifdef	__cplusplus
347c478bdstevel@tonic-gateextern "C" {
387c478bdstevel@tonic-gate * Boot properties related to netboot:
397c478bdstevel@tonic-gate */
407c478bdstevel@tonic-gate#define	BP_HOST_IP			"host-ip"
417c478bdstevel@tonic-gate#define	BP_SUBNET_MASK			"subnet-mask"
427c478bdstevel@tonic-gate#define	BP_ROUTER_IP			"router-ip"
437c478bdstevel@tonic-gate#define	BP_BOOT_MAC			"boot-mac"
447c478bdstevel@tonic-gate#define	BP_SERVER_IP			"server-ip"
457c478bdstevel@tonic-gate#define	BP_SERVER_NAME			"server-name"
467c478bdstevel@tonic-gate#define	BP_SERVER_PATH			"server-path"
477c478bdstevel@tonic-gate#define	BP_SERVER_ROOTOPTS		"server-rootopts"
487c478bdstevel@tonic-gate#define	BP_BOOTP_RESPONSE		"bootp-response"
49dedec47Jack Meng
50dedec47Jack Meng/*
51dedec47Jack Meng * Boot properties related to iscsiboot:
52dedec47Jack Meng */
53ae115bcmrj#define	BP_NETWORK_INTERFACE		"network-interface"
54dedec47Jack Meng#define	BP_ISCSI_TARGET_NAME		"iscsi-target-name"
55dedec47Jack Meng#define	BP_ISCSI_TARGET_IP		"iscsi-target-ip"
56dedec47Jack Meng#define	BP_ISCSI_INITIATOR_ID		"iscsi-initiator-id"
57dedec47Jack Meng#define	BP_ISCSI_PORT			"iscsi-port"
58dedec47Jack Meng#define	BP_ISCSI_TPGT			"iscsi-tpgt"
59dedec47Jack Meng#define	BP_ISCSI_LUN			"iscsi-lun"
60dedec47Jack Meng#define	BP_ISCSI_PAR			"iscsi-partition"
61dedec47Jack Meng#define	BP_ISCSI_NETWORK_BOOTPATH	"iscsi-network-bootpath"
62dedec47Jack Meng#define	BP_ISCSI_DISK			"/iscsi-hba/disk"
63dedec47Jack Meng#define	BP_BOOTPATH			"bootpath"
64dedec47Jack Meng#define	BP_CHAP_USER			"chap-user"
65dedec47Jack Meng#define	BP_CHAP_PASSWORD		"chap-password"
66dedec47Jack Meng#define	BP_LOCAL_MAC_ADDRESS		"local-mac-address"
686cefaaeJack Meng/*
696cefaaeJack Meng * kifconf prototypes
706cefaaeJack Meng */
716cefaaeJack Mengint
726cefaaeJack Mengkdlifconfig(TIUSER *tiptr, int af, void *myIPaddr, void *mymask,
736cefaaeJack Meng    struct in_addr *mybraddr, struct in_addr *gateway, char *ifname);
746cefaaeJack Mengint
756cefaaeJack Mengksetifflags(TIUSER *tiptr, uint_t value, char *ifname);
766cefaaeJack Mengint
776cefaaeJack Mengkifioctl(TIUSER *tiptr, int cmd, struct netbuf *nbuf, char *ifname);
786cefaaeJack Meng
796cefaaeJack Meng/*
806cefaaeJack Meng * Boot properties related to iscsi boot:
816cefaaeJack Meng */
826cefaaeJack Meng#define	IB_BOOT_MACLEN		6
836cefaaeJack Meng#define	IB_IP_BUFLEN		16
846cefaaeJack Meng
856cefaaeJack Meng/*
866cefaaeJack Meng * iSCSI boot initiator's properties
876cefaaeJack Meng */
886cefaaeJack Mengtypedef struct _ib_ini_prop {
896cefaaeJack Meng	uchar_t		*ini_name;
90dedec47Jack Meng	size_t		ini_name_len;
916cefaaeJack Meng	uchar_t		*ini_chap_name;
92dedec47Jack Meng	size_t		ini_chap_name_len;
936cefaaeJack Meng	uchar_t		*ini_chap_sec;
94dedec47Jack Meng	size_t		ini_chap_sec_len;
956cefaaeJack Meng} ib_ini_prop_t;
966cefaaeJack Meng
976cefaaeJack Meng/*
986cefaaeJack Meng * iSCSI boot nic's properties
996cefaaeJack Meng */
1006cefaaeJack Mengtypedef struct _ib_nic_prop {
1016cefaaeJack Meng	uchar_t		nic_mac[6];
1026cefaaeJack Meng	uchar_t		nic_vlan[2];
1036cefaaeJack Meng	union {
1046cefaaeJack Meng		struct in_addr	u_in4;
1056cefaaeJack Meng		struct in6_addr	u_in6;
1066cefaaeJack Meng	} nic_ip_u;
1076cefaaeJack Meng	union {
1086cefaaeJack Meng		struct in_addr	u_in4;
1096cefaaeJack Meng		struct in6_addr	u_in6;
1106cefaaeJack Meng	} nic_gw_u;
1116cefaaeJack Meng	union {
1126cefaaeJack Meng		struct in_addr	u_in4;
1136cefaaeJack Meng		struct in6_addr	u_in6;
1146cefaaeJack Meng	} nic_dhcp_u;
1156cefaaeJack Meng	int		sin_family;
1166cefaaeJack Meng	uchar_t		sub_mask_prefix;
1176cefaaeJack Meng
1186cefaaeJack Meng} ib_nic_prop_t;
1196cefaaeJack Meng
1206cefaaeJack Meng/*
1216cefaaeJack Meng * iSCSI boot target's properties
1226cefaaeJack Meng */
1236cefaaeJack Mengtypedef struct _ib_tgt_prop {
1246cefaaeJack Meng	union {
1256cefaaeJack Meng		struct in_addr	u_in4;
1266cefaaeJack Meng		struct in6_addr	u_in6;
1276cefaaeJack Meng	}tgt_ip_u;
1286cefaaeJack Meng	int		sin_family;
1296cefaaeJack Meng	uint32_t	tgt_port;
1306cefaaeJack Meng	uchar_t		tgt_boot_lun[8];
1316cefaaeJack Meng	uchar_t		*tgt_name;
132dedec47Jack Meng	size_t		tgt_name_len;
1336cefaaeJack Meng	uchar_t		*tgt_chap_name;
134dedec47Jack Meng	size_t		tgt_chap_name_len;
1356cefaaeJack Meng	uchar_t		*tgt_chap_sec;
136dedec47Jack Meng	size_t		tgt_chap_sec_len;
1376cefaaeJack Meng	int		lun_online;
138dedec47Jack Meng	uchar_t		*tgt_boot_par;
139dedec47Jack Meng	size_t		tgt_boot_par_len;
140dedec47Jack Meng	uint16_t	tgt_tpgt;
1416cefaaeJack Meng} ib_tgt_prop_t;
1426cefaaeJack Meng
1436cefaaeJack Meng/*
1446cefaaeJack Meng * iSCSI boot properties
1456cefaaeJack Meng */
1466cefaaeJack Mengtypedef struct _ib_boot_prop {
1476cefaaeJack Meng	ib_ini_prop_t	boot_init;
1486cefaaeJack Meng	ib_nic_prop_t	boot_nic;
1496cefaaeJack Meng	ib_tgt_prop_t	boot_tgt;
1506cefaaeJack Meng} ib_boot_prop_t;
1516cefaaeJack Meng
1526cefaaeJack Mengvoid
1536cefaaeJack Mengld_ib_prop();
1546cefaaeJack Meng
155dedec47Jack Mengvoid
156dedec47Jack Mengiscsi_boot_prop_free();
157dedec47Jack Meng
158dedec47Jack Mengvoid
159dedec47Jack Mengget_iscsi_bootpath_vhci(char *bootpath);
160dedec47Jack Meng
161dedec47Jack Mengvoid
162dedec47Jack Mengget_iscsi_bootpath_phy(char *bootpath);
163dedec47Jack Meng
1647c478bdstevel@tonic-gate#ifdef	__cplusplus
1687c478bdstevel@tonic-gate#endif	/* _BOOTPROPS_H */