From b2eb48c23b86cb61504bb0324a94ea11df5653e8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 2 May 2018 09:01:32 +0200 Subject: dhcpcd: Add hooks --- rtemsbsd/include/rtems/dhcpcd.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'rtemsbsd') diff --git a/rtemsbsd/include/rtems/dhcpcd.h b/rtemsbsd/include/rtems/dhcpcd.h index 324c8a90..da4972d4 100644 --- a/rtemsbsd/include/rtems/dhcpcd.h +++ b/rtemsbsd/include/rtems/dhcpcd.h @@ -40,6 +40,9 @@ #ifndef _RTEMS_DHCPCD_H_ #define _RTEMS_DHCPCD_H_ +#include +#include + #include #ifdef __cplusplus @@ -75,6 +78,29 @@ typedef struct rtems_dhcpcd_config { */ rtems_status_code rtems_dhcpcd_start(const rtems_dhcpcd_config *config); +typedef struct rtems_dhcpcd_hook { + SLIST_ENTRY(rtems_dhcpcd_hook) node; + const char *name; + void (*handler)(struct rtems_dhcpcd_hook *hook, char *const *env); +} rtems_dhcpcd_hook; + +/** + * @brief Adds a DHCP client hook. + * + * The hook handler is invoked with an environment list (NULL terminated) of + * strings ('\0' terminated). Each string of the environment list has usually + * the format "key=value", e.g. "interface=eth0", "reason=BOUND". + * + * The hook handler are called by the DHCP client task. It is safe to + * add/remove hooks in the hook handler. + */ +void rtems_dhcpcd_add_hook(rtems_dhcpcd_hook *hook); + +/** + * @brief Removes a DHCP client hook. + */ +void rtems_dhcpcd_remove_hook(rtems_dhcpcd_hook *hook); + /** @} */ #ifdef __cplusplus -- cgit v1.2.3