2016-09-30 00:32:03 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Intel Corporation.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-09-30 00:32:03 +08:00
|
|
|
*/
|
|
|
|
|
2016-11-12 06:13:24 +08:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Network Events code public header
|
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_NET_NET_EVENT_H_
|
|
|
|
#define ZEPHYR_INCLUDE_NET_NET_EVENT_H_
|
2016-11-12 06:13:24 +08:00
|
|
|
|
2017-07-24 21:23:14 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-11-03 20:39:57 +08:00
|
|
|
#include <net/net_ip.h>
|
|
|
|
|
2017-07-20 21:29:45 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup net_mgmt
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2017-01-04 22:54:20 +08:00
|
|
|
/* Network Interface events */
|
|
|
|
#define _NET_IF_LAYER NET_MGMT_LAYER_L1
|
|
|
|
#define _NET_IF_CORE_CODE 0x001
|
|
|
|
#define _NET_EVENT_IF_BASE (NET_MGMT_EVENT_BIT | \
|
|
|
|
NET_MGMT_IFACE_BIT | \
|
|
|
|
NET_MGMT_LAYER(_NET_IF_LAYER) | \
|
|
|
|
NET_MGMT_LAYER_CODE(_NET_IF_CORE_CODE))
|
|
|
|
|
|
|
|
enum net_event_if_cmd {
|
2017-09-08 15:49:26 +08:00
|
|
|
NET_EVENT_IF_CMD_DOWN = 1,
|
2017-01-04 22:54:20 +08:00
|
|
|
NET_EVENT_IF_CMD_UP,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NET_EVENT_IF_DOWN \
|
|
|
|
(_NET_EVENT_IF_BASE | NET_EVENT_IF_CMD_DOWN)
|
|
|
|
|
|
|
|
#define NET_EVENT_IF_UP \
|
|
|
|
(_NET_EVENT_IF_BASE | NET_EVENT_IF_CMD_UP)
|
|
|
|
|
2016-11-12 06:13:24 +08:00
|
|
|
/* IPv6 Events */
|
|
|
|
#define _NET_IPV6_LAYER NET_MGMT_LAYER_L3
|
2017-04-12 19:50:39 +08:00
|
|
|
#define _NET_IPV6_CORE_CODE 0x060
|
2016-11-12 06:13:24 +08:00
|
|
|
#define _NET_EVENT_IPV6_BASE (NET_MGMT_EVENT_BIT | \
|
|
|
|
NET_MGMT_IFACE_BIT | \
|
|
|
|
NET_MGMT_LAYER(_NET_IPV6_LAYER) | \
|
|
|
|
NET_MGMT_LAYER_CODE(_NET_IPV6_CORE_CODE))
|
|
|
|
|
|
|
|
enum net_event_ipv6_cmd {
|
2017-09-08 15:49:26 +08:00
|
|
|
NET_EVENT_IPV6_CMD_ADDR_ADD = 1,
|
2016-11-12 06:13:24 +08:00
|
|
|
NET_EVENT_IPV6_CMD_ADDR_DEL,
|
|
|
|
NET_EVENT_IPV6_CMD_MADDR_ADD,
|
|
|
|
NET_EVENT_IPV6_CMD_MADDR_DEL,
|
|
|
|
NET_EVENT_IPV6_CMD_PREFIX_ADD,
|
|
|
|
NET_EVENT_IPV6_CMD_PREFIX_DEL,
|
2017-02-10 15:04:37 +08:00
|
|
|
NET_EVENT_IPV6_CMD_MCAST_JOIN,
|
|
|
|
NET_EVENT_IPV6_CMD_MCAST_LEAVE,
|
2017-03-21 16:47:15 +08:00
|
|
|
NET_EVENT_IPV6_CMD_ROUTER_ADD,
|
|
|
|
NET_EVENT_IPV6_CMD_ROUTER_DEL,
|
2017-03-31 19:47:35 +08:00
|
|
|
NET_EVENT_IPV6_CMD_ROUTE_ADD,
|
|
|
|
NET_EVENT_IPV6_CMD_ROUTE_DEL,
|
2017-04-12 15:25:54 +08:00
|
|
|
NET_EVENT_IPV6_CMD_DAD_SUCCEED,
|
|
|
|
NET_EVENT_IPV6_CMD_DAD_FAILED,
|
2017-11-03 20:36:32 +08:00
|
|
|
NET_EVENT_IPV6_CMD_NBR_ADD,
|
|
|
|
NET_EVENT_IPV6_CMD_NBR_DEL,
|
2016-11-12 06:13:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_ADDR_ADD \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_ADD)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_ADDR_DEL \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_DEL)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_MADDR_ADD \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_ADD)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_MADDR_DEL \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_DEL)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_PREFIX_ADD \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_ADD)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_PREFIX_DEL \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_DEL)
|
|
|
|
|
2017-02-10 15:04:37 +08:00
|
|
|
#define NET_EVENT_IPV6_MCAST_JOIN \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_JOIN)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_MCAST_LEAVE \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_LEAVE)
|
|
|
|
|
2017-03-21 16:47:15 +08:00
|
|
|
#define NET_EVENT_IPV6_ROUTER_ADD \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ROUTER_ADD)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_ROUTER_DEL \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ROUTER_DEL)
|
|
|
|
|
2017-03-31 19:47:35 +08:00
|
|
|
#define NET_EVENT_IPV6_ROUTE_ADD \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ROUTE_ADD)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_ROUTE_DEL \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ROUTE_DEL)
|
|
|
|
|
2017-04-12 15:25:54 +08:00
|
|
|
#define NET_EVENT_IPV6_DAD_SUCCEED \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DAD_SUCCEED)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_DAD_FAILED \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DAD_FAILED)
|
|
|
|
|
2017-11-03 20:36:32 +08:00
|
|
|
#define NET_EVENT_IPV6_NBR_ADD \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_NBR_ADD)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV6_NBR_DEL \
|
|
|
|
(_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_NBR_DEL)
|
|
|
|
|
2017-01-04 22:45:12 +08:00
|
|
|
/* IPv4 Events*/
|
2016-11-12 06:13:24 +08:00
|
|
|
#define _NET_IPV4_LAYER NET_MGMT_LAYER_L3
|
2017-04-12 19:50:39 +08:00
|
|
|
#define _NET_IPV4_CORE_CODE 0x004
|
2016-11-12 06:13:24 +08:00
|
|
|
#define _NET_EVENT_IPV4_BASE (NET_MGMT_EVENT_BIT | \
|
|
|
|
NET_MGMT_IFACE_BIT | \
|
|
|
|
NET_MGMT_LAYER(_NET_IPV4_LAYER) | \
|
|
|
|
NET_MGMT_LAYER_CODE(_NET_IPV4_CORE_CODE))
|
|
|
|
|
|
|
|
enum net_event_ipv4_cmd {
|
2017-09-08 15:49:26 +08:00
|
|
|
NET_EVENT_IPV4_CMD_ADDR_ADD = 1,
|
2016-11-12 06:13:24 +08:00
|
|
|
NET_EVENT_IPV4_CMD_ADDR_DEL,
|
|
|
|
NET_EVENT_IPV4_CMD_ROUTER_ADD,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV4_ADDR_ADD \
|
|
|
|
(_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_ADD)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV4_ADDR_DEL \
|
|
|
|
(_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_DEL)
|
|
|
|
|
|
|
|
#define NET_EVENT_IPV4_ROUTER_ADD \
|
|
|
|
(_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_ADD)
|
|
|
|
|
2017-11-03 20:39:57 +08:00
|
|
|
#ifdef CONFIG_NET_MGMT_EVENT_INFO
|
|
|
|
/**
|
|
|
|
* @brief Network Management event information structure
|
|
|
|
* Used to pass information on network events like
|
|
|
|
* NET_EVENT_IPV6_ADDR_ADD,
|
|
|
|
* NET_EVENT_IPV6_ADDR_DEL,
|
|
|
|
* NET_EVENT_IPV6_MADDR_ADD and
|
|
|
|
* NET_EVENT_IPV6_MADDR_DEL
|
|
|
|
* when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the
|
|
|
|
* information.
|
|
|
|
*/
|
|
|
|
struct net_event_ipv6_addr {
|
|
|
|
struct in6_addr addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Network Management event information structure
|
|
|
|
* Used to pass information on network events like
|
|
|
|
* NET_EVENT_IPV6_NBR_ADD and
|
|
|
|
* NET_EVENT_IPV6_NBR_DEL
|
|
|
|
* when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the
|
|
|
|
* information.
|
|
|
|
* @Note: idx will be '-1' in case of NET_EVENT_IPV6_NBR_DEL event.
|
|
|
|
*/
|
|
|
|
struct net_event_ipv6_nbr {
|
|
|
|
struct in6_addr addr;
|
|
|
|
int idx; /* NBR index*/
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Network Management event information structure
|
|
|
|
* Used to pass information on network events like
|
|
|
|
* NET_EVENT_IPV6_ROUTE_ADD and
|
|
|
|
* NET_EVENT_IPV6_ROUTE_DEL
|
|
|
|
* when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the
|
|
|
|
* information.
|
|
|
|
*/
|
|
|
|
struct net_event_ipv6_route {
|
|
|
|
struct in6_addr nexthop;
|
|
|
|
struct in6_addr addr; /* addr/prefix */
|
|
|
|
u8_t prefix_len;
|
|
|
|
};
|
|
|
|
|
2018-03-21 20:08:14 +08:00
|
|
|
#endif /* CONFIG_NET_MGMT_EVENT_INFO */
|
2017-11-03 20:39:57 +08:00
|
|
|
|
2017-07-24 21:23:14 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-07-20 21:29:45 +08:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_NET_NET_EVENT_H_ */
|