summaryrefslogtreecommitdiff
path: root/cp/msg/src/msg_cc.c
blob: d4e265c82c30f29b285405d6e98d8de4766a8b9b (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/msg/msg_cc.c
 * \brief   
 * \ingroup cp_msg
 */

#include "common/std.h"
#include "cp/msg/inc/msg_cc.h"



void msg_cc_assoc_req_send(const mac_address_t oda)
{
/*    msg_mme_t *msg;
    cc_assoc_req_t *cc_assoc_req;
    msg_param_t msg_param;

    msg = msg_sending_common_part(oda, &msg_param);
    msg->mm_type = CC_ASSOC_REQ;
    // set the message values ( 11.2.28 )
    cc_assoc_req = (cc_assoc_req_t *) & msg->mm_entry;
    cc_assoc_req->cco_capability = station_get_cco_capa();
    cc_assoc_req->nid = station_get_nid();
    cc_assoc_req->proxy_networking_capability = 0;
    cc_assoc_req->req_type = 0;
    // set the message parameters
    msg_param.encryption = NOT_ENCRYPTED;
    // and then, send the message
    msg_send(msg, sizeof(cc_assoc_req_t) + MSG_MME_HEADER_SIZE, msg_param);
    */
}

void msg_cc_assoc_cnf_send(const mac_address_t oda, const u8 result, const tei_t sta_tei, const u16 lease_time)
{
/*    msg_mme_t *msg;
    cc_assoc_cnf_t *cc_assoc_cnf;
    msg_param_t msg_param;

    msg = msg_sending_common_part(oda, &msg_param);
    msg->mm_type = CC_ASSOC_CNF;
    // set the message values ( 11.2.29 )
    cc_assoc_cnf = (cc_assoc_cnf_t *) & msg->mm_entry;
    cc_assoc_cnf->result = result;
    cc_assoc_cnf->nid = station_get_nid();
    cc_assoc_cnf->snid = station_get_snid();
    cc_assoc_cnf->sta_tei = sta_tei;
    cc_assoc_cnf->lease_time = lease_time;
    // set the message parameters
    msg_param.encryption = NOT_ENCRYPTED;
    // and then, send the message
    msg_send(msg, sizeof(cc_assoc_cnf_t) + MSG_MME_HEADER_SIZE, msg_param);
*/
}

void 
msg_cc_set_tei_map_ind_send(const mac_address_t oda, const u8 mode, const tei_t tei, const bool recall)
{/*
    // 11.2.35
    msg_mme_t *msg;
    cc_set_tei_map_ind_t *cc_set_tei_map_ind;
    msg_param_t msg_param;
    u8 number_sta;
    int i;
    static tei_t m_tei;
    tei_t next_tei;
    station_t sta;
    
    // TODO remove printf
    //printf("msg_cc_set_tei_map_ind_send oda : %c%c%c%c%c%c, mode : %i\n", oda[0], oda[1], oda[2], oda[3], oda[4], oda[5], mode);
    msg = msg_sending_common_part(oda, &msg_param);
    msg->mm_type = CC_SET_TEI_MAP_IND;
    // set the message values ( 11.2.35 )
    cc_set_tei_map_ind = (cc_set_tei_map_ind_t *) & msg->mm_entry;
    cc_set_tei_map_ind->mode = mode;
    if(mode == 0)
    {
        msg_param.encryption = NOT_ENCRYPTED;
        number_sta = station_get_number_of_assoc();
        if( ! recall)
        {
            // first time that the function is called
            if(number_sta < SET_TEI_MAP_SUB_NB_ELEM)
            {
                cc_set_tei_map_ind->num = number_sta;
            }
            else
            {
                msg->fmi.nf_mi = 1;
                msg->fmi.fn_mi = 0;
                msg->fmi.fmsn  = msg_get_fmsn(true);
                cc_set_tei_map_ind->num = SET_TEI_MAP_SUB_NB_ELEM;
            }
        }
        else
        {
            cc_set_tei_map_ind->num = number_sta - SET_TEI_MAP_SUB_NB_ELEM;
            msg->fmi.nf_mi = 1;
            msg->fmi.fn_mi = 1;
            msg->fmi.fmsn  = msg_get_fmsn(false);
        }
    }
    else // mode != 0
    {
        msg_param.encryption = HARDWARE_ENCRYPTED;
        number_sta = 1;
        cc_set_tei_map_ind->num = 1;        
    }
    if( ! recall) m_tei = tei;
    for(i=0 ; i<number_sta ; i++)
    {
        if( ( ! tei)  && ( ! i ) && ( ! recall) ) 
            next_tei = station_get_associate_info(&sta, true , 0);
        else
            next_tei = station_get_associate_info(&sta, false , m_tei);
        memcpy(cc_set_tei_map_ind->sub[i].mac_address, sta.mac_address, sizeof(mac_address_t));
        if(sta.station_status == STATION_ASSOCIATED)
                cc_set_tei_map_ind->sub[i].status = 0x0;
        else cc_set_tei_map_ind->sub[i].status = 0x1;
        cc_set_tei_map_ind->sub[i].tei = m_tei;
        m_tei = next_tei;
    }
    // set the message parameters
    //msg_param.mnbf = 0;
    // and then, send the message
    msg_send(msg, MSG_MME_HEADER_SIZE + 2 + number_sta * sizeof(cc_set_tei_map_ind_sub_t), msg_param);
*/
}