summaryrefslogtreecommitdiff
path: root/cesar/cp/cco/action/inc/cco_action.h
blob: c4ee733edf3e18171e2fd5afcd8d885349e28173 (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
#ifndef cp_cco_inc_cco_action_h
#define cp_cco_inc_cco_action_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/cco/inc/cco_action.h
 * \brief   CCo private functions.
 * \ingroup cp_cco
 *
 */
#include "lib/set.h"
#include "lib/rnd.h"

#include "cp/msg/msg.h"
#include "cp/sta/core/core.h"
#include "cp/sta/core/defs.h"
#include "cp/cco/action/cco_action.h"

#define CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS 32 /* 32 bits. */

#define CP_CCO_ACTION_TEI_FLAGS_ROW 8

/* Conversion of minutes to eCos ticks. */
#define MIN_TO_RTC(val) (val * 100)

struct cp_cco_action_t
{
    /** TEI in use. */
    uint tei_flags [CP_CCO_ACTION_TEI_FLAGS_ROW];

    /** Event to change the neks. */
    cp_sta_core_timed_event_def_t nek_change;
    /** EKS timeout. */
    cp_sta_core_timed_event_def_t eks_timer;
    /** The new NEK. */
    cp_key_t nek_new;
    /** Station's TEI with the one the transaction as started. */
    cp_mme_peer_t eks_sta_current_peer;
    /** EKS protocol run. */
    cp_secu_protocol_run_t eks_prun;

    /** heap for the CCo selection process. */
    heap_t selection_heap;
};

BEGIN_DECLS

/**
 * Generate the NEK to be used right now.
 * \param  ctx  the CP context.
 *
 * Called on CCo startup.
 */
void
cp_cco_action_gen_nek_now (cp_t *ctx);

END_DECLS

#endif /* cp_cco_inc_cco_action_h */