dhcpcd: Add hooks

This commit is contained in:
Sebastian Huber
2018-05-02 09:01:32 +02:00
parent 8bd38d645c
commit b2eb48c23b
7 changed files with 118 additions and 6 deletions

View File

@@ -40,6 +40,9 @@
#ifndef _RTEMS_DHCPCD_H_
#define _RTEMS_DHCPCD_H_
#include <sys/cdefs.h>
#include <sys/queue.h>
#include <rtems.h>
#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