Definition in file pcdhcp.c.
Go to the source code of this file.
Functions | |
| void | DHCP_state_INIT (int event) |
| DHCP state machine: state INIT. | |
| void | DHCP_state_BOUND (int event) |
| DHCP state machine: state BOUND. | |
| void | DHCP_state_RENEWING (int event) |
| DHCP state machine: state RENEWING. | |
| void | DHCP_state_REQUESTING (int event) |
| DHCP state machine: state REQUESTING. | |
| void | DHCP_state_SELECTING (int event) |
| DHCP state machine: state SELECTING. | |
| void | DHCP_state_REBINDING (int event) |
| DHCP state machine: state REBINDING. | |
| void | dhcp_fsm (void) |
| DHCP state machine: the event driver. | |
| void | dhcp_options_add (const BYTE *opt, unsigned max) |
| Add options from a DHCP_OPT_OVERLOAD tag to 'extra_options' list. | |
| void | dhcp_set_timers (void) |
| Set all timers required by the DHCP state machine. | |
| void | change_ip_addr (void) |
| Change my_ip_addr of all tcp/udp sockets. | |
| BYTE * | put_request_list (BYTE *opt, int filled) |
| Append options from 'request_list' to 'opt'. | |
| int | write_config (void) |
| Write the transient DHCP configuration, either to file or via user-defined function. | |
| void | erase_config (void) |
| Erase the transient configuration. | |
| const char * | state_name (void) |
| Return name of current DHCP state function. | |
| const char * | period (DWORD sec) |
| Return nicely formatted string for a time-period. | |
| BYTE * | make_boot_header (void) |
| Format a BOOTP header. | |
| BYTE * | put_hardware_opt (BYTE *opt) |
| Fill in the hardware type/len in Client ID option tag. | |
| int | DHCP_discover (void) |
| Send a DHCP discover message. | |
| int | DHCP_request (BOOL renew) |
| Send a DHCP request message. | |
| int | DHCP_release_decline (int msg_type, const char *msg) |
| Send a DHCP release or decline message. | |
| BOOL | DHCP_arp_check (DWORD my_ip) |
| Send an ARP reply to announce our new IP-address. | |
| int | DHCP_offer (const struct dhcp *in) |
| Parse DHCP offer reply. | |
| int | DHCP_is_ack (void) |
| Return TRUE if DHCP message is an ACK. | |
| int | DHCP_is_nack (void) |
| Return TRUE if DHCP message is a NACK. | |
| void | DHCP_release (BOOL force) |
| Possibly send a DHCP release. | |
| DWORD | DHCP_get_server (void) |
| Return current DHCP server address. | |
| sock_type * | dhcp_open (const char *msg, BOOL use_broadcast) |
| Allocate and open a UDP socket for DHCP message exchange. | |
| void | arp_add_server (void) |
| Add MAC address of DHCP sever to our ARP cache. | |
| void | DHCP_state_REBOOTING (int event) |
| DHCP state machine: Combined BOOT and BOOTING state. | |
| int | DHCP_do_boot (void) |
| Our first time DHCP handler. | |
| int | set_request_list (char *options) |
| Parse a list of DHCP-request options from config-file. | |
| int | set_user_class (const char *value) |
| Parse user-class as specified in config-file. | |
| int | set_vend_class (const char *value) |
| Set vendor class option. | |
| void | DHCP_cfg_hook (const char *name, const char *value) |
| Parser for DHCP configuration. | |
| void | DHCP_exit (void) |
| Free allocated memory. | |
| void | DHCP_init (void) |
| Initialises the DHCP config-parser. | |
| void | set_my_ip (const char *value) |
| Functions called by config-file parser while reading C:.TMP. | |
| void | set_netmask (const char *value) |
| void | set_gateway (const char *value) |
| void | set_nameserv (const char *value) |
| void | set_server (const char *value) |
| void | set_domain (const char *value) |
| void | set_lease (const char *value) |
| void | set_renew (const char *value) |
| void | set_rebind (const char *value) |
| BOOL | eval_timers (void) |
| Check timers read from config-file and set state according to following rules: now < renewal => BOUND now > renewal && now < rebind => RENEWING now >= rebind && now < lease-end => REBINDING now >= lease-end => INIT-REBOOT. | |
| const char * | get_config_file (void) |
| void | std_erase_config (void) |
| int | std_read_config (void) |
| int | std_write_config (void) |
| Write the transient DHCP configuration to file. | |
| void | usr_erase_config (void) |
| int | usr_read_config (void) |
| int | usr_write_config (void) |
| int | DHCP_read_config (void) |
| Called from watt_sock_init() after "\c WATTCP.CFG" has been parsed. | |
| WattDHCPConfigFunc | dhcp_set_config_func (WattDHCPConfigFunc fn) |
| Sets up an application hook for doing DHCP operations (DHCP_config_op). | |
Variables | |
| BOOL | dhcp_did_gratuitous_arp = FALSE |
| WattDHCPConfigFunc | config_func = NULL |
| DWORD | exchange_id |
| DWORD | router |
| DWORD | nameserver |
| DWORD | dhcp_server = 0 |
| DWORD | dhcp_renewal = 0 |
| DWORD | dhcp_rebind = 0 |
| DWORD | dhcp_iplease = 0 |
| DWORD | suggest_lease = 0 |
| DWORD | old_ip_addr = 0 |
| BOOL | bcast_flag = TRUE |
| BOOL | got_offer = FALSE |
| BOOL | configured = FALSE |
| BOOL | arp_check_ip = FALSE |
| BOOL | cfg_read = FALSE |
| BOOL | cfg_saved = FALSE |
| int | dhcp_timeout = 10 |
| int | max_retries = 3 |
| int | discover_loops = 0 |
| dhcp dhcp_in | dhcp_out |
| void(* | DHCP_state )(int)=NULL |
| time_t | renewal_timeout |
| time_t | rebind_timeout |
| time_t | lease_timeout |
| DWORD | send_timeout |
| BOOL | trace_on = FALSE |
| char | config_file [MAX_VALUELEN+1] = "" |
| sock_type * | sock = NULL |
| const BYTE | default_request_list [] |
| DHCP_list | request_list |
| DHCP_list | extra_options = { NULL, 0 } |
| DHCP_list | user_class = { NULL, 0 } |
| DHCP_list | vend_class = { (BYTE*)"Watt-32", 7 } |
| void(* | prev_hook )(const char *, const char *)=NULL |
| time_t | cfg_dhcp_iplease |
| time_t | cfg_dhcp_renewal |
| time_t | cfg_dhcp_rebind |
| const struct config_table | transient_cfg [] |
| Open and parse Wattcp transient configuration. | |
|
|
Send an ARP reply to announce our new IP-address. This is in order to fill ARP cache of other hosts (gratuitous ARP). Optionally (if arp_check_ip is TRUE), send an ARP request to check if our assigned IP-address is really vacant. Definition at line 417 of file pcdhcp.c. References _arp_check_own_ip(), _arp_reply(), _pktserial, DWORD, eth_address, MAC_address(), and sin_mask. |
|
||||||||||||
|
Parser for DHCP configuration.
Matches all "\c DHCP.xx" values from References ARG_ATOI, ARG_FUNC, ARG_RESOLVE, ARG_STRCPY, parse_config_table(), set_request_list(), set_user_class(), and set_vend_class(). |
|
|
Our first time DHCP handler. Called if:
References addwattcpd(), dhcp_fsm(), dhcp_open(), DHCP_state_BOUND(), DHCP_state_INIT(), DHCP_state_REBINDING(), DHCP_state_RENEWING(), erase_config(), my_ip_addr, set_timeout(), sin_mask, tcp_tick(), and write_config(). |
|
|
Parse DHCP offer reply.
References _arp_add_gateway(), _arp_kill_gateways(), _default_ttl, _inet_ntoa(), BYTE, defaultdomain, dhcp::dh_file, dhcp::dh_opt, dhcp::dh_sname, dhcp_options_add(), DWORD, hostname, period(), setdomainname(), sin_mask, StrLcpy(), and tcp_keep_intvl. |
|
|
Called from watt_sock_init() after "\c WATTCP.CFG" has been parsed. Open and parse transient configuration from 'config_file' or call user-defined function to read transient configuration. Definition at line 1776 of file pcdhcp.c. References dhcp_open(), dhcp_set_timers(), eval_timers(), and sock_type::udp. |
|
|
Possibly send a DHCP release.
References delwattcpd(), dhcp_fsm(), DHCP_release_decline(), and sock_close(). |
|
||||||||||||
|
Send a DHCP release or decline message.
References BYTE, dhcp::dh_opt, DWORD, make_boot_header(), and set_timeout(). |
|
|
DHCP state machine: state BOUND.
References DHCP_request(), DHCP_state_RENEWING(), and my_ip_addr. |
|
|
DHCP state machine: state INIT.
References DHCP_discover(), DHCP_state_SELECTING(), and set_timeout(). |
|
|
DHCP state machine: state REBINDING.
References change_ip_addr(), DHCP_offer(), dhcp_set_timers(), DHCP_state_BOUND(), DHCP_state_INIT(), my_ip_addr, Random(), and set_timeout(). |
|
|
DHCP state machine: state RENEWING.
References change_ip_addr(), DHCP_offer(), DHCP_request(), dhcp_set_timers(), DHCP_state_BOUND(), DHCP_state_INIT(), DHCP_state_REBINDING(), my_ip_addr, Random(), and set_timeout(). |
|
|
DHCP state machine: state REQUESTING.
References arp_add_server(), DHCP_arp_check(), DHCP_offer(), DHCP_release_decline(), DHCP_request(), dhcp_set_timers(), DHCP_state_BOUND(), DHCP_state_INIT(), my_ip_addr, Random(), and set_timeout(). |
|
|
DHCP state machine: state SELECTING.
References dhcp::dh_yiaddr, DHCP_offer(), DHCP_state_INIT(), DHCP_state_REQUESTING(), my_ip_addr, Random(), and set_timeout(). |
|
|
Check timers read from config-file and set state according to following rules: now < renewal => BOUND now > renewal && now < rebind => RENEWING now >= rebind && now < lease-end => REBINDING now >= lease-end => INIT-REBOOT.
References DHCP_state_BOUND(), DHCP_state_RENEWING(), and DWORD. |
|
|
Parse a list of DHCP-request options from config-file. e.g DHCP_REQ_LIST = 1,23,24,28,36 Definition at line 1195 of file pcdhcp.c. References BYTE. |
|
|
Parse user-class as specified in config-file. Format is: "DHCP.USERCLASS = value1,value2,...". Build up user_class.data along the way. Definition at line 1261 of file pcdhcp.c. References BYTE, and dhcp::dh_opt. |
|
|
Set vendor class option.
|
|
|
Write the transient DHCP configuration to file. Append to file if found, else create the file.
References _default_ttl, _inet_ntoa(), DWORD, hostname, my_ip_addr, sin_mask, and tcp_keep_intvl. |
|
|
Initial value: Definition at line 145 of file pcdhcp.c. |
|
|
Initial value: Definition at line 170 of file pcdhcp.c. |
|
|
Initial value: Open and parse Wattcp transient configuration. i.e. values that must be known between consecutive runs of an Watt application. We should write the configured values to this file, and read back on next run to avoid doing DHCP boot/release for every program. Definition at line 1514 of file pcdhcp.c. |
1.3.8