#ifndef _S_BOOTPLIB_SUBNETS_H
#define _S_BOOTPLIB_SUBNETS_H
#include <stdbool.h>
#include <netinet/in.h>
#include <CoreFoundation/CFArray.h>
#include "dhcp.h"
#define SUBNET_PROP__CREATOR "_creator"
#define SUBNET_PROP_NAME "name"
#define SUBNET_PROP_NET_ADDRESS "net_address"
#define SUBNET_PROP_NET_MASK "net_mask"
#define SUBNET_PROP_NET_RANGE "net_range"
#define SUBNET_PROP_CLIENT_TYPES "client_types"
#define SUBNET_PROP_SUPERNET "supernet"
#define SUBNET_PROP_LEASE_MIN "lease_min"
#define SUBNET_PROP_LEASE_MAX "lease_max"
typedef bool (SubnetIsAddressInUseFunc)(void * private, struct in_addr ip);
typedef SubnetIsAddressInUseFunc * SubnetIsAddressInUseFuncRef;
typedef struct _SubnetList * SubnetListRef;
typedef struct _Subnet * SubnetRef;
void
SubnetListLogErrors(int level);
SubnetRef
SubnetListAcquireAddress(SubnetListRef list, struct in_addr * addr,
SubnetIsAddressInUseFuncRef func, void * arg);
SubnetRef
SubnetListGetSubnetForAddress(SubnetListRef list, struct in_addr addr,
bool in_range);
bool
SubnetListAreAddressesOnSameSupernet(SubnetListRef list,
struct in_addr addr,
struct in_addr other_addr);
SubnetListRef
SubnetListCreateWithArray(CFArrayRef list);
void
SubnetListFree(SubnetListRef * subnets);
void
SubnetListPrint(SubnetListRef subnets);
dhcp_lease_time_t
SubnetGetMaxLease(SubnetRef subnet);
dhcp_lease_time_t
SubnetGetMinLease(SubnetRef subnet);
const char *
SubnetGetOptionPtrAndLength(SubnetRef subnet, dhcptag_t tag,
int * option_length);
struct in_addr
SubnetGetMask(SubnetRef subnet);
bool
SubnetDoesAllocate(SubnetRef subnet);
#endif