summaryrefslogtreecommitdiff
path: root/cesar/cp/cco/action/src/cco_action.c
blob: f26b01fb674b59a12f5485b2505320a4f244b447 (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
69
70
71
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/cco/action/src/cco_action.c
 * \brief   CCo Action functions.
 * \ingroup cp_cco
 *
 */
#include <string.h>
#include "common/std.h"
#include "common/defs/homeplugAV.h"

#include "lib/set.h"
#include "lib/utils.h"
#include "lib/rnd.h"
#include "lib/slab.h"

#include "common/defs/ethernet.h"

#include "cl/cl_mactotei.h"

#include "mac/common/timings.h"

#include "cp/defs.h"
#include "cp/cp.h"
#include "cp/fsm/fsm.h"
#include "cp/msg/msg.h"

#include "cp/cco/action/cco_action.h"
#include "cp/sta/mgr/sta_mgr.h"
#include "cp/sta/mgr/net.h"
#include "cp/sta/mgr/sta.h"
#include "cp/beacon/beacon.h"
#include "cp/sta/core/core.h"
#include "cp/beacon/beacon.h"
#include "cp/cco/region/region.h"
#include "cp/cco/bw/bw.h"

#include "cp/inc/context.h"
#include "cp/inc/trace.h"
#include "cp/cco/action/inc/cco_action.h"

void
cp_cco_action_tei_release (cp_t *ctx, u8 tei)
{
    uint row;

    dbg_assert (ctx);
    dbg_assert (tei);

    row = tei / CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS;

    ctx->cco_action.tei_flags[row] &= ~(1 << ((tei
         % CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS)-1));
}

void
cp_cco_action_gen_nek_now (cp_t *ctx)
{
    cp_key_t key;

    dbg_assert (ctx);
    cp_secu_generate_key (ctx, lib_rnd32 (&ctx->rnd),
                          CP_SECU_PBKDF1_ITERATION_NEK, &key);
    cp_beacon_change_nek (ctx, 0, key, true /* now. */);
}