Exemplo n.º 1
0
void gnrc_netreg_unregister(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
{
    if (_INVALID_TYPE(type)) {
        return;
    }

    LL_DELETE(netreg[type], entry);
}
Exemplo n.º 2
0
int ng_netreg_register(ng_nettype_t type, ng_netreg_entry_t *entry)
{
    if (_INVALID_TYPE(type)) {
        return -EINVAL;
    }

    LL_PREPEND(netreg[type], entry);

    return 0;
}
Exemplo n.º 3
0
gnrc_netreg_entry_t *gnrc_netreg_lookup(gnrc_nettype_t type, uint32_t demux_ctx)
{
    gnrc_netreg_entry_t *res;

    if (_INVALID_TYPE(type)) {
        return NULL;
    }

    LL_SEARCH_SCALAR(netreg[type], res, demux_ctx, demux_ctx);

    return res;
}
Exemplo n.º 4
0
int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
{
    /* only threads with a message queue are allowed to register at gnrc */
    assert(sched_threads[entry->pid]->msg_array);

    if (_INVALID_TYPE(type)) {
        return -EINVAL;
    }

    LL_PREPEND(netreg[type], entry);

    return 0;
}
Exemplo n.º 5
0
int gnrc_netreg_num(gnrc_nettype_t type, uint32_t demux_ctx)
{
    int num = 0;
    gnrc_netreg_entry_t *entry;

    if (_INVALID_TYPE(type)) {
        return 0;
    }

    entry = netreg[type];

    while (entry != NULL) {
        if (entry->demux_ctx == demux_ctx) {
            num++;
        }

        entry = entry->next;
    }

    return num;
}
Exemplo n.º 6
0
int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
{
#if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS)
#ifdef DEVELHELP
    /* only threads with a message queue are allowed to register at gnrc */
    assert((entry->type != GNRC_NETREG_TYPE_DEFAULT) ||
           sched_threads[entry->target.pid]->msg_array);
#endif
#else
    /* only threads with a message queue are allowed to register at gnrc */
    assert(sched_threads[entry->target.pid]->msg_array);
#endif

    if (_INVALID_TYPE(type)) {
        return -EINVAL;
    }

    LL_PREPEND(netreg[type], entry);

    return 0;
}