840 lines
25 KiB
C
840 lines
25 KiB
C
/* ipdhcps.h - API of DHCP Server */
|
|
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdhcps.h,v $ $Revision: 1.40.10.1 $
|
|
* $Source: /home/interpeak/CVSRoot/ipdhcps/include/ipdhcps.h,v $
|
|
* $Author: zluo0 $ $Date: 2012-12-13 06:10:11 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
*
|
|
* Design and implementation by Jonas Rendel <jonas@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPDHCPS_H
|
|
#define IPDHCPS_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
This library contains the API for the DHCP Server
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipdhcps_config.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include <ipcom_cstyle.h>
|
|
/* #include <ipcom_tmo2.h> for 64-bit compile warning */
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
/*
|
|
*===========================================================================
|
|
* IPDHCPS_RELEASE
|
|
*===========================================================================
|
|
* IPDHCPS release version.
|
|
*/
|
|
#define IPDHCPS_RELEASE 60600
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* DHCPS Eternity constant
|
|
*===========================================================================
|
|
* To be used for setting certain timer constanst in ipdhcps_config.h
|
|
*/
|
|
#define IPDHCPS_ETERNITY (Ip_time_t)0xffffffff
|
|
|
|
/*
|
|
*===========================================================================
|
|
* DHCP hardware types
|
|
*===========================================================================
|
|
* Hardware types handled by the IPDHCPS.
|
|
*/
|
|
#define IPDHCPS_HWTYPE_ETHERNET 1
|
|
|
|
/*
|
|
*===========================================================================
|
|
* DHCP option codes
|
|
*===========================================================================
|
|
* DHCP option codes accepted by DHCPS for client configurations
|
|
*/
|
|
#define IPDHCPS_OPTCODE_SUBNET_MASK 1
|
|
#define IPDHCPS_OPTCODE_TIME_OFFSET 2
|
|
#define IPDHCPS_OPTCODE_ROUTERS 3
|
|
#define IPDHCPS_OPTCODE_TIME_SERVERS 4
|
|
#define IPDHCPS_OPTCODE_NAME_SERVERS 5
|
|
#define IPDHCPS_OPTCODE_DOMAIN_NAME_SERVERS 6
|
|
#define IPDHCPS_OPTCODE_LOG_SERVERS 7
|
|
#define IPDHCPS_OPTCODE_COOKIE_SERVERS 8
|
|
#define IPDHCPS_OPTCODE_LPR_SERVERS 9
|
|
#define IPDHCPS_OPTCODE_IMPRESS_SERVERS 10
|
|
#define IPDHCPS_OPTCODE_RESOURCE_LOCATION_SERVERS 11
|
|
#define IPDHCPS_OPTCODE_HOST_NAME 12
|
|
#define IPDHCPS_OPTCODE_BOOT_SIZE 13
|
|
#define IPDHCPS_OPTCODE_MERIT_DUMP 14
|
|
#define IPDHCPS_OPTCODE_DOMAIN_NAME 15
|
|
#define IPDHCPS_OPTCODE_SWAP_SERVER 16
|
|
#define IPDHCPS_OPTCODE_ROOT_PATH 17
|
|
#define IPDHCPS_OPTCODE_EXTENSIONS_PATH 18
|
|
#define IPDHCPS_OPTCODE_IP_FORWARDING 19
|
|
#define IPDHCPS_OPTCODE_NON_LOCAL_SOURCE_ROUTING 20
|
|
#define IPDHCPS_OPTCODE_POLICY_FILTER 21
|
|
#define IPDHCPS_OPTCODE_MAX_DGRAM_REASSEMBLY 22
|
|
#define IPDHCPS_OPTCODE_DEFAULT_IP_TTL 23
|
|
#define IPDHCPS_OPTCODE_PATH_MTU_AGING_TIMEOUT 24
|
|
#define IPDHCPS_OPTCODE_PATH_MTU_PLATEAU_TABLE 25
|
|
#define IPDHCPS_OPTCODE_INTERFACE_MTU 26
|
|
#define IPDHCPS_OPTCODE_ALL_SUBNETS_LOCAL 27
|
|
#define IPDHCPS_OPTCODE_BROADCAST_ADDRESS 28
|
|
#define IPDHCPS_OPTCODE_PERFORM_MASK_DISCOVERY 29
|
|
#define IPDHCPS_OPTCODE_MASK_SUPPLIER 30
|
|
#define IPDHCPS_OPTCODE_ROUTER_DISCOVERY 31
|
|
#define IPDHCPS_OPTCODE_ROUTER_SOLICITATION_ADDRESS 32
|
|
#define IPDHCPS_OPTCODE_STATIC_ROUTES 33
|
|
#define IPDHCPS_OPTCODE_TRAILER_ENCAPSULATION 34
|
|
#define IPDHCPS_OPTCODE_ARP_CACHE_TIMEOUT 35
|
|
#define IPDHCPS_OPTCODE_IEEE802_3_ENCAPSULATION 36
|
|
#define IPDHCPS_OPTCODE_DEFAULT_TCP_TTL 37
|
|
#define IPDHCPS_OPTCODE_TCP_KEEPALIVE_INTERVAL 38
|
|
#define IPDHCPS_OPTCODE_TCP_KEEPALIVE_GARBAGE 39
|
|
#define IPDHCPS_OPTCODE_NIS_DOMAIN 40
|
|
#define IPDHCPS_OPTCODE_NIS_SERVERS 41
|
|
#define IPDHCPS_OPTCODE_NTP_SERVERS 42
|
|
#define IPDHCPS_OPTCODE_VENDOR_ENCAPSULATED_OPTIONS 43
|
|
#define IPDHCPS_OPTCODE_NETBIOS_NAME_SERVERS 44
|
|
#define IPDHCPS_OPTCODE_NETBIOS_DD_SERVER 45
|
|
#define IPDHCPS_OPTCODE_NETBIOS_NODE_TYPE 46
|
|
#define IPDHCPS_OPTCODE_NETBIOS_SCOPE 47
|
|
#define IPDHCPS_OPTCODE_FONT_SERVERS 48
|
|
#define IPDHCPS_OPTCODE_X_DISPLAY_MANAGER 49
|
|
#define IPDHCPS_OPTCODE_VENDOR_CLASS 60
|
|
#define IPDHCPS_OPTCODE_CLIENT_IDENTIFIER 61
|
|
#define IPDHCPS_OPTCODE_NWIP_DOMAIN 62
|
|
#define IPDHCPS_OPTCODE_NWIP_SUBOPTIONS 63
|
|
#define IPDHCPS_OPTCODE_NISPLUS_DOMAIN 64
|
|
#define IPDHCPS_OPTCODE_NISPLUS_SERVERS 65
|
|
#define IPDHCPS_OPTCODE_HOME_AGENTS 68
|
|
#define IPDHCPS_OPTCODE_SMTP_SERVERS 69
|
|
#define IPDHCPS_OPTCODE_POP3_SERVERS 70
|
|
#define IPDHCPS_OPTCODE_NNTP_SERVERS 71
|
|
#define IPDHCPS_OPTCODE_WWW_SERVERS 72
|
|
#define IPDHCPS_OPTCODE_FINGER_SERVERS 73
|
|
#define IPDHCPS_OPTCODE_IRC_SERVERS 74
|
|
#define IPDHCPS_OPTCODE_STREETTALK_SERVERS 75
|
|
#define IPDHCPS_OPTCODE_STDA_SERVERS 76
|
|
#define IPDHCPS_OPTCODE_USER_CLASS 77
|
|
#define IPDHCPS_OPTCODE_RELAY_AGENT_INFO 82
|
|
|
|
#define IPDHCPS_OPTCODE_LIMIT 82
|
|
|
|
#define IPDHCPS_OPTCODE_UNUSED 254
|
|
#define IPDHCPS_OPTCODE_END 255
|
|
|
|
#define IPDHCPS_OPT_DHCP 0
|
|
/*
|
|
*===========================================================================
|
|
* DHCP RELAY AGENT IFNO SUBOPTIONS
|
|
*===========================================================================
|
|
* DHCP sub options used with IPDHCPS_OPTCODE_RELAY_AGENT_INFO (82)
|
|
*/
|
|
#define IPDHCPS_SUBOPTCODE_RA_CIRCUIT_ID 1
|
|
#define IPDHCPS_SUBOPTCODE_RA_REMOTE_ID 2
|
|
#define IPDHCPS_SUBOPTCODE_RA_AUTHENTICATION 8
|
|
#define IPDHCPS_SUBOPTCODE_RA_LINK_SELECTION 5 /* RFC3527 */
|
|
#define IPDHCPS_SUBOPTCODE_RA_SERVER_OVERRIDE 11/* RFC5107 */
|
|
|
|
/*
|
|
*===========================================================================
|
|
* CONFIG option codes
|
|
*===========================================================================
|
|
* Configuration option codes accepted by DHCPS for client and
|
|
* server configuration.
|
|
*/
|
|
#define IPDHCPS_OPT_CONF 0x8000
|
|
|
|
#define IPDHCPS_CONFCODE_LEASE_TIME_DFLT IPDHCPS_OPT_CONF + 1 /* Host Byte Order */
|
|
#define IPDHCPS_CONFCODE_LEASE_TIME_MAX IPDHCPS_OPT_CONF + 2 /* Host Byte Order */
|
|
#define IPDHCPS_CONFCODE_LEASE_TIME_MIN IPDHCPS_OPT_CONF + 3 /* Host Byte Order */
|
|
#define IPDHCPS_CONFCODE_RENEWAL_TIME IPDHCPS_OPT_CONF + 4 /* Host Byte Order */
|
|
#define IPDHCPS_CONFCODE_REBINDING_TIME IPDHCPS_OPT_CONF + 5 /* Host Byte Order */
|
|
#define IPDHCPS_CONFCODE_ALLOW_BOOTP IPDHCPS_OPT_CONF + 6
|
|
#define IPDHCPS_CONFCODE_ALLOW_DYNAMIC_BOOTP IPDHCPS_OPT_CONF + 7
|
|
#define IPDHCPS_CONFCODE_NEXT_SERVER_NAME IPDHCPS_OPT_CONF + 8
|
|
#define IPDHCPS_CONFCODE_NEXT_SERVER_IP IPDHCPS_OPT_CONF + 9 /* Network Byte Order */
|
|
#define IPDHCPS_CONFCODE_BOOT_FILE IPDHCPS_OPT_CONF + 10
|
|
#define IPDHCPS_CONFCODE_DO_ICMP_ADDRESS_CHECK IPDHCPS_OPT_CONF + 11
|
|
#define IPDHCPS_CONFCODE_AUTHORIZED_AGENTS IPDHCPS_OPT_CONF + 12
|
|
#define IPDHCPS_CONFCODE_RA_AUTHENTICATION IPDHCPS_OPT_CONF + 13
|
|
#define IPDHCPS_CONFCODE_RA_DROP IPDHCPS_OPT_CONF + 14
|
|
#define IPDHCPS_CONFCODE_END IPDHCPS_OPT_CONF + IPDHCPS_OPTCODE_END
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdhcps_open
|
|
*===========================================================================
|
|
*/
|
|
typedef struct Ipdhcps_open_struct
|
|
{
|
|
Ip_u32 api_version; /* Currently version 1. Used for future compability. */
|
|
}
|
|
Ipdhcps_open;
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdhcps_poolinfo
|
|
*===========================================================================
|
|
* Data structure used when configuring pools on subnets
|
|
*/
|
|
typedef struct Ipdhcps_poolinfo_struct
|
|
{
|
|
Ip_u32 first_addr; /* First address in pool. Network byte order */
|
|
Ip_u32 last_addr; /* Last address in pool. Network byte order */
|
|
char *classname; /* Allowed classname */
|
|
}
|
|
Ipdhcps_poolinfo;
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdhcps_classinfo
|
|
*===========================================================================
|
|
* Data structure used when configuring classes on subnets
|
|
*/
|
|
#define IPDHCPS_CLASSNAME_MAX 20
|
|
|
|
typedef struct Ipdhcps_classinfo_struct
|
|
{
|
|
Ip_bool data_is_string;
|
|
char *name;
|
|
Ip_u8 *data;
|
|
Ip_u16 priv_data_len;
|
|
}
|
|
Ipdhcps_classinfo;
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdhcps_init
|
|
*===========================================================================
|
|
* Description: Initiate IPDHCPS
|
|
* Parameters:
|
|
* Returns: IPCOM_SUCCESS - success
|
|
* other - failure
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_create(void);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdhcps_exit
|
|
*===========================================================================
|
|
* Description:
|
|
* Parameters:
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_start(void);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps_version
|
|
*===========================================================================
|
|
* Description:
|
|
* Parameters:
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_PUBLIC const char *ipdhcps_version(void);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_interface_status_set - set the status for an interface handled by
|
|
* IPDHCPS
|
|
*
|
|
* This routine sets the status for an interface handled by IPDHCPS. The
|
|
* interface is specified by its name.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <ifname>
|
|
* Name of interface.
|
|
* \i <status>
|
|
* Enable ('IP_TRUE') or disable ('IP_FALSE') the interface.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', on success, or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* No interface with specifie name found.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_GLOBAL Ip_err ipdhcps_interface_status_set
|
|
(
|
|
char* ifname,
|
|
Ip_bool status
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_class_add - add a new client class to a subnet
|
|
*
|
|
* This routine adds a new client class to an existing <subnet> specified by its
|
|
* address.
|
|
*
|
|
* If the address 'IP_INADDR_ANY' is used as the subnet address, the class will be
|
|
* configured on the defaults net.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* IPv4 address of the subnet, in network byte order.
|
|
* \i <client_class>
|
|
* Pointer to the class descriptor.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* <Subnet> does not exist.
|
|
* \i 'IPCOM_ERR_INVALID_ARG'
|
|
* Invalid net address.
|
|
* \i 'IPCOM_ERR_ALREADY_INSTALLED'
|
|
* <class> already exists on <subnet>
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* Out of memory.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_class_add
|
|
(
|
|
Ip_u32 subnet,
|
|
Ipdhcps_classinfo *client_class
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_class_delete - delete a client class from a subnet
|
|
*
|
|
* This routine deletes a client class from an existing <subnet> specified by its
|
|
* address.
|
|
*
|
|
* If the address 'IP_INADDR_ANY' is used as the subnet address, the class will be
|
|
* removed from the defaults net.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* IPv4 address of the subnet, in network byte order.
|
|
* \i <classname>
|
|
* The name of the client class
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* <Subnet> or <classname> does not exist.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_class_delete
|
|
(
|
|
Ip_u32 subnet,
|
|
char *classname
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_subnet_add - add a new subnet descriptor to the configuration database
|
|
*
|
|
* This routine adds a new subnet descriptor to the IPDHCPS configuration
|
|
* database.
|
|
*
|
|
* The subnet is defined by the subnet address. The net mask to be used by the
|
|
* subnet is given in the DHCP option list (option code
|
|
* 'IPDHCPS_OPTCODE_SUBNET_MASK').
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* IPv4 address of the subnet, in network byte order.
|
|
* \i <pools>
|
|
* Array of address pools to be mapped on the subnet.
|
|
* \i <n_pools>
|
|
* Number of elements in the array of address pools.
|
|
* \i <dhcps_options>
|
|
* Pointer to an array of DHCP options of standard DHCP format.
|
|
* \i <conf_options>
|
|
* Pointer to an array of config options of standard DHCP format.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'IPCOM_ERR_ALREADY_INSTALLED'
|
|
* Subnet already exists.
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* Out of memory.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_subnet_add
|
|
(
|
|
Ip_u32 subnet,
|
|
Ipdhcps_poolinfo pools[],
|
|
Ip_u32 n_pools,
|
|
Ip_u8 *dhcp_options,
|
|
Ip_u8 *conf_options
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_subnet_delete - delete a subnet descriptor from IPDHCPS configuration
|
|
* database
|
|
*
|
|
* This routine deletes a subnet descriptor from the IPDHCPS configuration
|
|
* database. The subnet is defined by its address.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <subnet>
|
|
* IPv4 address of the subnet, in network byte order.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* <Subnet> does not exist.
|
|
* \i 'IPCOM_ERR_INVALID_ARG'
|
|
* Invalid net address.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_subnet_delete
|
|
(
|
|
Ip_u32 subnet
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_host_add - add a new host descriptor to the IPDHCPS configuration
|
|
*
|
|
* This routine adds a new host descriptor to the IPDHCPS configuration.
|
|
*
|
|
* The host is defined by its IPv4 address and identified by either its
|
|
* link-layer address and/or by a client-identifier. The latter has to be
|
|
* attached to the list of DHCP options bound to the host (option code
|
|
* 'IPDHCPS_OPTCODE_CLIENT_IDENTIFIER').
|
|
*
|
|
* The hosts\' link-layer address can be left out if a client identifier is
|
|
* specified. IPDHCPS will then use this id only for client identification.
|
|
*
|
|
* If both link-layer address and a client identifier are specified the
|
|
* identification will be done first by the identifier and then by the address.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <addr>
|
|
* IPv4 address of the host (network byte order).
|
|
* \i <hwaddr>
|
|
* Pointer to hosts link-layer address.
|
|
* \i <hwlen>
|
|
* Length of link-layer address.
|
|
* \i <dhcp_options>
|
|
* List of hosts DHCP options of standard DHCP format.
|
|
* \i <config_options>
|
|
* List of hosts <config_options> of standard DHCP format.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'PCOM_ERR_ALREADY_INSTALLED'
|
|
* Host already exists.
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* Out of memory.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_host_add
|
|
(
|
|
Ip_u32 addr,
|
|
Ip_u8 *hwaddr,
|
|
Ip_u8 len,
|
|
Ip_u8 *dhcp_options,
|
|
Ip_u8 *conf_options
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_host_delete - delete a host descriptor from the IPDHCPS configuration
|
|
*
|
|
* This routine deletes a host descriptor from the IPDHCPS configuration. The
|
|
* host is defined by its IPv4 address.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <addr>
|
|
* IPv4 address of host.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* Host not found.
|
|
* \i 'IPCOM_ERR_INVALID_ARG'
|
|
* Invalid host address.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_host_delete
|
|
(
|
|
Ip_u32 addr
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_pool_add - add a new address pool to an existing subnet
|
|
*
|
|
* This routine adds a new address pool to an existing <subnet> specified by its
|
|
* address. The pool is defined by its first address and last address.
|
|
*
|
|
* If the address 'IP_INADDR_ANY' is used as the subnet address, the pool will be
|
|
* configured on the defaults net.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* IPv4 address of the subnet, in network byte order.
|
|
* \i <pool>
|
|
* Pointer to the pool descriptor.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* <Subnet> does not exist.
|
|
* \i 'IPCOM_ERR_INVALID_ARG'
|
|
* Invalid net address.
|
|
* \i 'IPCOM_ERR_ALREADY_INSTALLED'
|
|
* <Pool> already exists on <subnet> (in part or completely).
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_pool_add
|
|
(
|
|
Ip_u32 subnet,
|
|
Ipdhcps_poolinfo *pool
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_pool_delete - delete an existing address pool on a defined subnet
|
|
*
|
|
* This routine deletes an existing address <pool> on a defined subnet specified
|
|
* by its subnet address. The address <pool> is defined by its first address and
|
|
* last address.
|
|
*
|
|
* If the address 'IP_INADDR_ANY' is used as subnet address the pool will be
|
|
* deleted on the defaults net.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* IPv4 address of <subnet>.
|
|
* \i <pool>
|
|
* Pointer to <pool> descriptor.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* <Pool> not found on specified <subnet>.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_pool_delete
|
|
(
|
|
Ip_u32 subnet,
|
|
Ipdhcps_poolinfo *pool
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_option_add - add a new set of DHCP/CONFIG options to a subnet or host
|
|
*
|
|
* This routine adds a new set of DHCP or CONFIG options to a subnet or host as
|
|
* specified by the IPv4 address. An option with a code that already exists on
|
|
* the subnet/host will be replaced by the new one in the set.
|
|
*
|
|
* Using 'IP_INADDR_ANY' as address parameter will make IPDHCPS apply the
|
|
* operation to the system global default DHCP option list.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <addr>
|
|
* IPv4 address of either a host or subnet in network byte order.
|
|
* \i <classname>
|
|
* Name of specific client class. Set to IP_NULL if no client class
|
|
* \i <type>
|
|
* Option type. Either IPDHCPS_OPT_DHCP or IPDHCPS_OPT_CONF
|
|
* \i <options>
|
|
* List of DHCP or CONFIG options.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* IPDHCPS not started.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* No host or subnet with specified address found.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_option_add
|
|
(
|
|
Ip_u32 addr,
|
|
char *classname,
|
|
Ip_u16 type,
|
|
Ip_u8 *options
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_option_delete - delete a DHCP or CONFIG option
|
|
*
|
|
* Delete a DHCP option specified by its code and defined on a host or subnet as
|
|
* specified by the address.
|
|
*
|
|
* Using 'IP_INADDR_ANY' as address parameter will make IPDHCPS apply the
|
|
* operation to the system global default DHCP option list.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <addr>
|
|
* IPv4 address of host or subnet in network byte order.
|
|
* \i <class>
|
|
* Name of specific client class. Set to IP_NULL if no client class
|
|
* \i <type>
|
|
* Option type. Either IPDHCPS_OPT_DHCP or IPDHCPS_OPT_CONF
|
|
* \i <option_code>
|
|
* DHCP or CONFIG option code for option to be deleted.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_OPENED'
|
|
* PDHCPS not started.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* No host or subnet with specified address found.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_option_delete
|
|
(
|
|
Ip_u32 addr,
|
|
char *classname,
|
|
Ip_u16 type,
|
|
Ip_u8 option_code
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_lease_db_dump - dump entries in the lease database to a data buffer
|
|
*
|
|
* This routine dumps the current entries in the lease database to a data buffer.
|
|
*
|
|
* This function is part of the IPDHCPS lease dump API intended to let IPDHCPS
|
|
* utilize persistent storage of the lease database to make it survive a restart
|
|
* of the server.
|
|
*
|
|
* The function can for instance be used when the server is running on systems
|
|
* supplied with a file system or a non-volatile memory.
|
|
*
|
|
* Example: Call it from within the IPDHCPS stop hook, together with extra target
|
|
* specific code to let the server save its current lease database.
|
|
*
|
|
* It is important to know that the contents of the data buffer are created from
|
|
* the lease database only. It does not contain any configuration settings.
|
|
*
|
|
* The data buffer must be freed by the caller upon exit (using ipcom_free
|
|
* (buffer pointer)).
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <obj>
|
|
* Reference to pointer to dump buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_FAILED'
|
|
* Failure.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC int ipdhcps_lease_db_dump
|
|
(
|
|
void* obj
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps_lease_db_restore - initialize the IPDHCPS lease database
|
|
*
|
|
* This routine initializes the IPDHCPS lease database with data from an
|
|
* externally provided data buffer.
|
|
*
|
|
* This function is part of the IPDHCPS lease dump API intended to let IPDHCPS
|
|
* utilize persistent storage of the lease database to make it survive a restart
|
|
* of the server.
|
|
*
|
|
* The function can for instance be used when the server is running on systems
|
|
* supplied with a file system or a non-volatile memory.
|
|
*
|
|
* Example: Call it from the IPDHCPS start hook together with extra target
|
|
* specific code to let the server restore its lease database from a previous
|
|
* session.
|
|
*
|
|
* It is important that all configurations of subnets and address pools are done
|
|
* before restoring the lease database. The function will drop all leases that do
|
|
* not match the current configuration.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <obj>
|
|
* Reference to pointer to dump buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS,' , or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_FAILED'
|
|
* Failure.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps_lease_db_restore
|
|
(
|
|
void *obj
|
|
);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdhcps_cmd_dhcps
|
|
*===========================================================================
|
|
* Description: Install IPDHCPS shell commands
|
|
* Parameters:
|
|
* Returns:
|
|
*
|
|
*/
|
|
#ifdef IPDHCPS_INCLUDE_CMD
|
|
IP_GLOBAL int Ipdhcps_cmd_dhcps(int argc, char **argv);
|
|
#endif
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps_configure
|
|
*===========================================================================
|
|
* Description:
|
|
* Parameters:
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_PUBLIC Ip_err
|
|
ipdhcps_configure(void);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|