7 * Copyright (c) 2017, ETH Zurich.
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
16 #ifndef LIB_NET_INCLUDE_NETWORKING_DHCP_H_
17 #define LIB_NET_INCLUDE_NETWORKING_DHCP_H_
21 #define NET_CONFIG_IP_RECORD_FIELDS "{ ip: %d, gw: %d, netmask: %d }"
22 #define NET_CONFIG_CURRENT_IP_RECORD_FORMAT "net.ipconfig " NET_CONFIG_IP_RECORD_FIELDS
23 #define NET_CONFIG_CURRENT_IP_RECORD_REGEX "net.ipconfig {ip: _, gw: _, netmask: _}"
24 #define NET_CONFIG_STATIC_IP_RECORD_FORMAT "net.static_ip " NET_CONFIG_IP_RECORD_FIELDS
25 #define NET_CONFIG_STATIC_IP_RECORD_REGEX "net.static_ip {ip: _, gw: _, netmask: _}"
28 * @brief starts the dhcpd service on the interface
30 * @param flags flags to provide
32 * @return SYS_ERR_OK on success, errval on failure
34 errval_t dhcpd_start(net_flags_t flags);
38 * @brief stops the dhcpd service
40 errval_t dhcpd_stop(void);
43 /* functions for querying the current settings */
46 * @brief queries the current ip setting of the machine
48 * @param flags flags to provide
50 * @return SYS_ERR_OK on success, errval on failure
52 errval_t net_config_current_ip_query(net_flags_t flags);
56 * @brief queries the static ip setting of the machine
58 * @param flags flags to provide
60 * @return SYS_ERR_OK on success, errval on failure
62 errval_t net_config_static_ip_query(net_flags_t flags);
66 * @brief returns the IP configuration
68 * @param ip return the IP address
69 * @param gw returns the gateway
70 * @param nm returns the netmask
74 errval_t netif_get_ipconfig(struct in_addr *ip, struct in_addr *gw, struct in_addr *nm);
77 * @brief sets the IP configuration
79 * @param ip the IP address
80 * @param gw the Gateway
81 * @param nm the Netmask
83 * @return SYS_ERR_OK on success, errval on failure
85 errval_t netif_set_ipconfig(struct in_addr *ip, struct in_addr *gw, struct in_addr *nm);
87 #endif /* LIB_NET_INCLUDE_NETWORKING_DHCP_H_ */