-
Notifications
You must be signed in to change notification settings - Fork 2.1k
gnrc, nimble/ble: notify network layer of BLE connection events #21608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
elenaf9
wants to merge
50
commits into
RIOT-OS:master
Choose a base branch
from
elenaf9:gnrc/netapi/event
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 46 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
7564665
gnrc/netapi: add notification message type
elenaf9 0408e39
nimble/netif: notify on BLE connection events
elenaf9 bf82b94
gnrc/ipv6: modify nib nc on l2 connection event
elenaf9 fbd2219
gnrc/ipv6: notify L3_ROUTING of discovered/ unreachable nodes
elenaf9 9715791
gnrc/rpl: iterate through parents that match addr
elenaf9 9030409
gnrc/rpl: handle L3 routing events from netapi
elenaf9 6cef5d6
nimble/rpble: don't send DIS on connection event
elenaf9 b6e19c2
fixup! gnrc/rpl: handle L3 routing events from netapi
elenaf9 f1b82ec
fixup! gnrc/ipv6: modify nib nc on l2 connection event
elenaf9 4404817
fixup! gnrc/netapi: add notification message type
elenaf9 e9d25cb
fixup! gnrc/netapi: add notification message type
elenaf9 6570d30
fixup! nimble/netif: notify on BLE connection events
elenaf9 82b5059
fixup! gnrc/ipv6: modify nib nc on l2 connection event
elenaf9 7e911b8
fixup! gnrc/ipv6: notify L3_ROUTING of discovered/ unreachable nodes
elenaf9 d8d7c81
fixup! gnrc/ipv6: modify nib nc on l2 connection event
elenaf9 602e894
fixup! gnrc/netapi: add notification message type
elenaf9 418825f
fixup! gnrc/netapi: add notification message type
elenaf9 7755585
fixup! gnrc/ipv6: modify nib nc on l2 connection event
elenaf9 2447cb8
fixup! gnrc/netapi: add notification message type
elenaf9 8c53e7a
fixup! fixup! gnrc/netapi: add notification message type
elenaf9 2c5bf74
gnrc/netapi/netnotify: ACK notify event directly
elenaf9 ad4c316
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 b8ae0f6
Merge branch 'master' of https://github.com/RIOT-OS/RIOT into gnrc/ne…
elenaf9 abb69a1
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 afb04c8
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 8c88416
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 bee053b
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 a7d5ac9
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 2079a8f
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 30b2b7f
Apply suggestions from code review
elenaf9 2bfd90d
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 7713680
fixup! gnrc/ipv6: modify nib nc on l2 connection event
elenaf9 f57c38b
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 2d5e9c5
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 7de5975
fixup! Apply suggestions from code review
elenaf9 754fe9c
Like 7de59757a6da5b3b7367f1a0a2e87081c3e1887f
elenaf9 0c8d01d
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 97a0422
fixup! gnrc/netapi: add notification message type
elenaf9 d57474d
fixup! nimble/netif: notify on BLE connection events
elenaf9 06c3e64
fixup! gnrc/ipv6: modify nib nc on l2 connection event
elenaf9 5328407
fixup! gnrc/ipv6: notify L3_ROUTING of discovered/ unreachable nodes
elenaf9 00a8d28
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 ed5ac34
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 c45fd59
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 6e33db2
fixup! gnrc/netapi: add notification message type
elenaf9 2ab900c
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 d0df717
fixup! gnrc/rpl: handle L3 routing events from netapi
elenaf9 e263d97
fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 d20a7b5
fixup! fixup! gnrc/netapi/netnotify: ACK notify event directly
elenaf9 11567f7
fixup! gnrc/ipv6: modify nib nc on l2 connection event
elenaf9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2025 TU Dresden | ||
| * SPDX-License-Identifier: LGPL-2.1-only | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| /** | ||
| * @defgroup net_gnrc_netapi_notify Notification events for network APIs. | ||
| * @ingroup net_gnrc_netapi | ||
| * @brief Network event notification types. | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Network event notification type definitions. | ||
| * | ||
| * @details The purpose of this API is to allow lower layers in the network | ||
| * stack to inform higher layers of general, protocol-independent | ||
| * network events. | ||
| * It can be used through the @ref net_gnrc_netapi to notify any | ||
| * other network interfaces that have registered themselves through | ||
| * @ref net_gnrc_netreg for the corresponding @ref net_gnrc_nettype. | ||
| * | ||
| * @note Notification events are associated with type-dependent event data. | ||
| * Receivers should not access the data directly, but instead use the | ||
| * the dedicated API functions to copy the data from the sender's. | ||
| * If the data is read manually, the receiver is responsible for | ||
| * calling @ref gnrc_netapi_notify_ack to unblock the sender. | ||
| * | ||
| * @author Elena Frank <[email protected]> | ||
| */ | ||
|
|
||
| #include <stdint.h> | ||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include "net/gnrc/netif/conf.h" | ||
| #include "sema_inv.h" | ||
|
|
||
| /** | ||
| * @brief Definition of notification event types in the network stack. | ||
| * | ||
| * @note Expand at will. | ||
| * If event data is associated with the type, a helper function must also | ||
| * be added for parsing the data and calling @ref gnrc_netapi_notify_ack. | ||
| */ | ||
| typedef enum { | ||
| NETAPI_NOTIFY_L2_NEIGH_CONNECTED, /**< Connection established on layer 2. */ | ||
| NETAPI_NOTIFY_L2_NEIGH_DISCONNECTED, /**< Connection closed on layer 2. */ | ||
| NETAPI_NOTIFY_L3_DISCOVERED, /**< Discovered node on the network layer. */ | ||
| NETAPI_NOTIFY_L3_UNREACHABLE, /**< Node became unreachable on the network layer. */ | ||
| } netapi_notify_t; | ||
|
|
||
| /** | ||
| * @brief Data structure to be sent for netapi notification events. | ||
| */ | ||
| typedef struct { | ||
| netapi_notify_t event; /**< the type of event */ | ||
| void *_data; /**< associated event data. */ | ||
| uint16_t _data_len; /**< size of the event data */ | ||
elenaf9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sema_inv_t ack; /**< inverse semaphore for collecting ack's */ | ||
| } gnrc_netapi_notify_t; | ||
|
|
||
| /** | ||
| * @brief L2 connection event data associated with @ref NETAPI_NOTIFY_L2_NEIGH_CONNECTED or | ||
| * @ref NETAPI_NOTIFY_L2_NEIGH_DISCONNECTED events. | ||
| */ | ||
| typedef struct { | ||
| uint8_t l2addr[GNRC_NETIF_L2ADDR_MAXLEN]; /**< L2 address of the node */ | ||
| uint8_t l2addr_len; /**< length of L2 address in byte */ | ||
| kernel_pid_t if_pid; /**< PID of network interface */ | ||
| } netapi_notify_l2_connection_t; | ||
|
|
||
| /** | ||
| * @brief Acknowledge that a notify event was received and its data read. | ||
| * | ||
| * @param[in] ack Pointer to semaphore that is used to collect ack's. | ||
| */ | ||
| static inline void gnrc_netapi_notify_ack(sema_inv_t *ack) | ||
| { | ||
| sema_inv_post(ack); | ||
| } | ||
|
|
||
| /** | ||
| * @brief Copy the connection event data associated with a @ref gnrc_netapi_notify_t event. | ||
| * | ||
| * @note This will call @ref gnrc_netapi_notify_ack. | ||
| * | ||
| * @param[in] notify Pointer to the received notify event. | ||
| * @param[in] data_len Size of the expected data type. | ||
| * @param[out] data Connection data received in the @p notify event. | ||
| * | ||
| * @retval Size of the data type on success. | ||
| * @retval -EINVAL if the data in @p notify is invalid or doesn't match the expected | ||
| * data length. | ||
| */ | ||
| int gnrc_netapi_notify_copy_event_data(gnrc_netapi_notify_t *notify, uint8_t data_len, void *data); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| /** @} */ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.