[riot-notifications] [RIOT-OS/RIOT] sock: extend API for asynchronous event management (#8149)

Martine Lenders notifications at github.com
Fri Apr 12 11:02:47 CEST 2019


Ok, I just had an idea how to get this along a bit faster... Let's just KISS and have callbacks and *clearly document* that they are not supposed to be used without some kind of event management on top (which we can provide for the various ways to handle events in RIOT [`msg`, `mbox`, `event`, ...] in follow-up PRs).

So we would would just add different event type definitions, a callback type, and a callback setter for each sock-type, e.g.

```C
typedef enum {
    SOCK_EVENT_CONN_RDY = 0x0001,
    SOCK_EVENT_CONN_FIN = 0x0002,
    SOCK_EVENT_CONN_RCV = 0x0004,
    SOCK_EVENT_MSG_RCV = 0x0010,
    SOCK_EVENT_MSG_SNT = 0x0020,
    SOCK_EVENT_PATH_PROP = 0x0040,
} sock_event_type_t;
```

(ref: https://tools.ietf.org/html/draft-ietf-taps-arch-03#section-4.1.5)

```C
void (*sock_udp_cb_t)(sock_udp_t *sock, sock_event_type_t type);
void sock_udp_set_cb(sock_udp_t *sock, sock_udp_cb_t cb);
```

-- 
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/8149#issuecomment-482497589
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190412/61063860/attachment.html>


More information about the notifications mailing list