1
2#ifndef _S_BOOTPD_H
3#define _S_BOOTPD_H
4
5/*
6 * Copyright (c) 1999 Apple Inc. All rights reserved.
7 *
8 * @APPLE_LICENSE_HEADER_START@
9 *
10 * This file contains Original Code and/or Modifications of Original Code
11 * as defined in and that are subject to the Apple Public Source License
12 * Version 2.0 (the 'License'). You may not use this file except in
13 * compliance with the License. Please obtain a copy of the License at
14 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * file.
16 *
17 * The Original Code and all software distributed under the License are
18 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
19 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
20 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
22 * Please see the License for the specific language governing rights and
23 * limitations under the License.
24 *
25 * @APPLE_LICENSE_HEADER_END@
26 */
27
28#include "dhcp_options.h"
29#include <CoreFoundation/CFDictionary.h>
30#include <CoreFoundation/CFString.h>
31#include "netinfo.h"
32
33typedef struct {
34    interface_t *	if_p;
35    struct dhcp *	pkt;
36    int			pkt_length;
37    dhcpol_t *		options_p;
38    struct in_addr *	dstaddr_p;
39    struct timeval *	time_in_p;
40} request_t;
41
42/*
43 * bootpd.h
44 */
45int
46add_subnet_options(char * hostname,
47		   struct in_addr iaddr,
48		   interface_t * intface, dhcpoa_t * options,
49		   const uint8_t * tags, int n);
50boolean_t
51bootp_add_bootfile(const char * request_file, const char * hostname,
52		   const char * bootfile, char * reply_file,
53		   int reply_file_size);
54void
55host_parms_from_proplist(ni_proplist * pl_p, int index, struct in_addr * ip,
56			 char * * name, char * * bootfile);
57
58boolean_t
59subnetAddressAndMask(struct in_addr giaddr, interface_t * intface,
60		     struct in_addr * addr, struct in_addr * mask);
61boolean_t
62subnet_match(void * arg, struct in_addr iaddr);
63
64boolean_t
65sendreply(interface_t * intf, struct bootp * bp, int n,
66	  boolean_t broadcast, struct in_addr * dest_p);
67boolean_t
68ip_address_reachable(struct in_addr ip, struct in_addr giaddr,
69		     interface_t * intface);
70
71void
72set_number_from_plist(CFDictionaryRef plist, CFStringRef prop_name_cf,
73		      const char * prop_name, uint32_t * val_p);
74
75#define NI_DHCP_OPTION_PREFIX	"dhcp_"
76#include "globals.h"
77
78typedef struct subnet_match_args {
79    struct in_addr	giaddr;
80    struct in_addr	ciaddr;
81    interface_t *	if_p;
82    boolean_t		has_binding;
83} subnet_match_args_t;
84
85extern void
86my_log(int priority, const char *message, ...);
87
88#endif /* _S_BOOTPD_H */
89