• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote
13  *    products derived from this software without specific prior
14  *    written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
17  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * Description: implementation for l3_msg_event
29  * Author: none
30  * Create: 2020
31  */
32 
33 #ifndef LWIP_HDR_L3EVENT_H
34 #define LWIP_HDR_L3EVENT_H
35 
36 #include "lwip/opt.h"
37 
38 /* define the app_callback function point type */
39 typedef void (*app_callback_fn)(u8_t, void *);
40 
41 #if !NO_SYS /* don't build if not configured for use in lwipopts.h */
42 #if LWIP_L3_EVENT_MSG
43 
44 typedef enum l3_event_msg_type {
45 #if LWIP_ROUTE_CHANGE_MSG
46   L3_EVENT_MSG_ROUTE_CHANGE,
47 #endif
48 #if LWIP_RPL_JOIN_SUCC_MSG
49   L3_EVENT_MSG_RPL_JOIN_SUCC,
50 #endif
51 #if LWIP_RPL_PARENT_CLEAR_MSG
52   L3_EVENT_MSG_PARENT_CLEAR,
53 #endif
54 #if LWIP_RPL_BEACON_PRI_RESET
55   L3_EVENT_MSG_BEACON_PRI_RESET,
56 #endif
57 #if LWIP_RPL_GET_IPV4_ADDR_FAIL
58   L3_EVENT_MSG_GET_IPV4_ADDR_FAIL,
59 #endif
60 #if LWIP_RPL_MSTA_GET_IPV4_ADDR_FAIL
61   L3_EVENT_MSG_MSTA_GET_IPV4_ADDR_FAIL,
62 #endif
63 #if LWIP_RPL_MG_FULL
64   L3_EVENT_MSG_MG_FULL,
65 #endif
66 #if LWIP_RPL_RT_FULL
67   L3_EVENT_MSG_RT_FULL,
68 #endif
69   /* other MSG could be added here */
70   L3_EVENT_MSG_MAX
71 } l3_event_msg_type_e;
72 
73 /*
74  * Func Name: l3_invoke_msg_callback
75  */
76 /**
77  * @brief
78  *
79  *  This is a thread safe API, used to invoke the l3_event_msg
80  *
81  * @param[IN]  evt_type: the event type
82  *             msg: the carry msg for using afterwards, can be NULL.
83  *
84  * @returns NA \n
85  *
86  */
87 void l3_invoke_msg_callback(enum l3_event_msg_type evt_type, void *msg);
88 
89 /*
90  * Func Name: l3_event_msg_callback_reg
91  */
92 /**
93  * @brief
94  *
95  *  This is a thread safe API, used to register the l3_event_msg
96  *
97  * @param[IN]  evt_type: the event type
98  *             app_callback: the register callback function, can be NULL if app unregister or don't want to register.
99  *
100  * @returns NA \n
101  *
102  */
103 void l3_event_msg_callback_reg(enum l3_event_msg_type evt_type, app_callback_fn app_callback);
104 
105 #endif /* LWIP_L3_EVENT_MSG */
106 #endif /* !NO_SYS */
107 
108 #endif /* LWIP_HDR_L3EVENT_H */
109