[riot-notifications] [RIOT-OS/RIOT] gnrc/nib: add NIB event bus (#14022)

benpicco notifications at github.com
Tue May 5 12:49:10 CEST 2020


### Contribution description

This adds the ability to have multiple message busses per network interface.
A message bus for nib events is implemented.

Currently it only contains a `GNRC_IPV6_NIB_EVENT_REG_SUCCESS` which informs subscribers that a address registration was successful.


### Testing procedure

I modified the `start` function of #13826 to block until a valid prefix is available:

```C
static int _start_cmd(int argc, char **argv)
{
    (void) argc;
    (void) argv;

    static bool init_called;

    if (init_called) {
        /* set all interfaces to IDLE */
        _gnrc_netapi_set_all(NETOPT_STATE_IDLE);
    } else {
        /* we must only call init once */
        gnrc_netif_init_devs();
        init_called = true;
    }

    msg_t m;
    msg_bus_entry_t sub;
    msg_bus_t *bus = gnrc_netif_get_bus(gnrc_netif_iter(NULL), GNRC_NETIF_BUS_NIB);
    msg_bus_attach(bus, &sub);

    msg_bus_subscribe(&sub, GNRC_IPV6_NIB_EVENT_REG_SUCCESS);

    msg_receive(&m);

    puts("Interfaces should new be online.");

    msg_bus_detach(bus, &sub);

    return 0;
}
```

### Issues/PRs references



You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/14022

-- Commit Summary --

  * core/msg_bus: clarify API of msg_bus_post()
  * gnrc_netif: add message bus to interface
  * gnrc/nib: add NIB event bus

-- File Changes --

    M Makefile.dep (4)
    M core/include/msg_bus.h (5)
    M makefiles/pseudomodules.inc.mk (1)
    M sys/include/net/gnrc/ipv6/nib.h (13)
    M sys/include/net/gnrc/netif.h (36)
    M sys/net/gnrc/netif/gnrc_netif.c (5)
    M sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c (1)
    M sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h (18)
    M sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h (5)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/14022.patch
https://github.com/RIOT-OS/RIOT/pull/14022.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14022
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200505/dfe20191/attachment.htm>


More information about the notifications mailing list