Skip to content

Instantly share code, notes, and snippets.

@miri64
Last active August 29, 2015 14:20
Show Gist options
  • Save miri64/a2f815d3bbbc5798de28 to your computer and use it in GitHub Desktop.
Save miri64/a2f815d3bbbc5798de28 to your computer and use it in GitHub Desktop.
Minimal netapi thread
#include <errno.h>
#include "msg.h"
#include "net/ng_netapi.h"
void *_event_loop(void *args)
{
msg_t msg, reply;
reply.type = NG_NETAPI_MSG_TYPE_ACK; /* Prepare reply type */
while (1) {
msg_receive(&msg);
switch (msg->type) {
case NG_NETAPI_MSG_TYPE_GET:
case NG_NETAPI_MSG_TYPE_SET:
reply.content.value = (uint32_t)(-ENOTSUP);
msg_reply(&msg, &reply);
break;
case NG_NETAPI_MSG_TYPE_SND:
case NG_NETAPI_MSG_TYPE_RCV:
default:
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment