summaryrefslogtreecommitdiff
path: root/cesar/cp2/fsm/src/events.c
blob: 46985a3aed082d2e65c485d353b7c719bf6d509d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp2/fsm/src/events.c
 * \brief   FSM events.
 * \ingroup cp2_fsm
 */
#include "common/std.h"

#include "cp2/inc/context.h"

#include "fsm.h"
#include "inc/tables.h"

typedef void (*cp_fsm_event_bare_transition_t) (cp_t *ctx);

void
cp_fsm_event_bare_handler (cp_t *ctx, cp_fsm_event_t *event,
                           cp_fsm_transition_t transition)
{
    dbg_assert (ctx);
    dbg_assert_ptr (event);
    dbg_assert (transition);
    cp_fsm_event_bare_transition_t t = transition;
    /* Call transition. */
    t (ctx);
}

cp_fsm_event_t *
cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
{
    dbg_assert (ctx);
    dbg_assert (type < CP_FSM_EVENT_TYPE_NB);
    cp_fsm_event_t *e;
    e = slab_alloc (&ctx->fsm.event_bare_cache);
    e->next = NULL;
    e->type = type;
    e->handler = cp_fsm_event_bare_handler;
    return e;
}

cp_fsm_event_t *
cp_fsm_event_mme_new (cp_t *ctx, cp_fsm_event_type_t type, cp_mme_rx_t *mme)
{
    return NULL;
}

cp_fsm_event_t *
cp_fsm_event_beacon_new (cp_t *ctx, cp_fsm_event_type_t type,
                         cp_beacon_desc_t *beacon, cp_net_t *net,
                         cp_sta_t *sta)
{
    return NULL;
}

void
cp_fsm_event_init (cp_t *ctx)
{
    dbg_assert (ctx);
    slab_cache_init (&ctx->fsm.event_bare_cache, "event_bare",
                     sizeof (cp_fsm_event_t), NULL);
}