1
2/*
3 * Copyright (c) 2001-2002 Apple Inc. All rights reserved.
4 *
5 * @APPLE_LICENSE_HEADER_START@
6 *
7 * This file contains Original Code and/or Modifications of Original Code
8 * as defined in and that are subject to the Apple Public Source License
9 * Version 2.0 (the 'License'). You may not use this file except in
10 * compliance with the License. Please obtain a copy of the License at
11 * http://www.opensource.apple.com/apsl/ and read it before using this
12 * file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
19 * Please see the License for the specific language governing rights and
20 * limitations under the License.
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24
25/*
26 * nbimages.h
27 * - NetBoot image list routines
28 */
29
30#ifndef _S_NBIMAGES_H
31#define _S_NBIMAGES_H
32
33#include <net/ethernet.h>
34#include "nbsp.h"
35#include "bsdp.h"
36#include <sys/types.h>
37
38typedef enum {
39    kNBImageTypeNone = 0,
40    kNBImageTypeClassic,
41    kNBImageTypeNFS,
42    kNBImageTypeHTTP,
43    kNBImageTypeBootFileOnly,
44} NBImageType;
45
46typedef union {
47    struct {
48	boolean_t	indirect;
49	const char *	root_path;
50    } nfs;
51    struct {
52	boolean_t	indirect;
53	const char *	root_path;
54	const char *	root_path_esc;
55    } http;
56    struct {
57	const char *	shared;
58	const char *	private;
59    } classic;
60} NBImageTypeInfo;
61
62typedef struct {
63    NBSPEntryRef	sharepoint;
64    const char *	arch;
65    const char * *	archlist;
66    int			archlist_count;
67    char *		dir_name;	/* relative to sharepoint */
68    char *		dir_name_esc; 	/* spaces/etc. escaped e.g. %20 */
69    char *		name;
70    int			name_length;
71    bsdp_image_id_t	image_id;
72    const char *	bootfile;
73    boolean_t		ppc_bootfile_no_subdir;
74    NBImageType		type;
75    NBImageTypeInfo	type_info;
76    boolean_t		is_default;
77    boolean_t		diskless;
78    boolean_t		filter_only;
79    const char * *	sysids;
80    int			sysids_count;
81    const struct ether_addr *	enabled_mac_addresses;
82    int			enabled_mac_addresses_count;
83    const struct ether_addr *	disabled_mac_addresses;
84    int			disabled_mac_addresses_count;
85    struct in_addr	load_balance_ip;
86} NBImageEntry, * NBImageEntryRef;
87
88boolean_t	NBImageEntry_supported_sysid(NBImageEntryRef entry,
89					     const char * arch,
90					     const char * sysid,
91					     const struct ether_addr * ether_addr);
92struct NBImageList_s;
93typedef struct NBImageList_s * NBImageListRef;
94
95int		NBImageList_count(NBImageListRef list);
96NBImageEntryRef	NBImageList_element(NBImageListRef list, int i);
97NBImageEntryRef NBImageList_elementWithID(NBImageListRef list, bsdp_image_id_t);
98NBImageListRef	NBImageList_init(NBSPListRef sharepoints,
99				 boolean_t allow_diskless);
100void		NBImageList_free(NBImageListRef * list);
101void		NBImageList_print(NBImageListRef images);
102NBImageEntryRef NBImageList_default(NBImageListRef images,
103				    const char * arch, const char * sysid,
104				    const struct ether_addr * ether,
105				    const u_int16_t * attrs, int n_attrs);
106boolean_t	NBImageEntry_attributes_match(NBImageEntryRef entry,
107					      const u_int16_t * attrs,
108					      int n_attrs);
109
110#endif /* _S_NBIMAGES_H */
111