summaryrefslogtreecommitdiff
path: root/cesar/test_general/station/fcall/src/sta_mgr.c
blob: 1c877d48edc417e8b5a8fa4e6976cd6ae1dbdd93 (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
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    ../fcall/src/sta_mgr.c
 * \brief   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */
#include "common/std.h"

#include "cp/sta/mgr/sta_mgr.h"
#include "cp/sta/mgr/net.h"

#include "station/station.h"
#include "host/fcall/fcall.h"

/* Get the station data
 * \param  nid  the network nid from the one the we need to get the station.
 * \param  snid  the network snid.
 * \param  mac  the station mac address.
 **/
int
fc_sta_mgr_get_unassoc_sta (fcall_ctx_t *fcall, fcall_param_t **param,
                            sci_msg_t **msg, void *data)
{
    cesar_t *cesar = data;

    uint is_backup_cco;
    u32 expired_date_ms;
    uint tei_lease_ms;
    uint cco_cap;
    uint pco_cap;
    uint backup_cco_cap;
    uint numDisSta;
    uint numDisNet;
    uint tei;
    mac_t mac_address;
    uint is_cco;
    uint pco_glid;


    mac_t mac;
    cp_sta_t *sta;

    /** Get the mac address. */
    fcall_param_bind_ll (*param, *msg, "mac_addr", &mac);
    fcall_param_reset (*param);

    sta = cp_sta_mgr_sta_get_from_mac (cesar->cp, mac);
    if (!sta)
        return false;

    is_backup_cco = sta->is_backup_cco;
    expired_date_ms = sta->expired_date_ms;
    tei_lease_ms = sta->tei_lease_date_ms;
    cco_cap = sta->cco_cap;
    pco_cap = sta->pco_cap;
    backup_cco_cap = sta->backup_cco_cap;
    numDisSta = sta->numDisSta;
    numDisNet = sta->numDisNet;
    tei = cp_sta_get_tei (sta);
    mac_address = cp_sta_get_mac_address (sta);
    is_cco = cp_sta_get_cco_status (sta);
    pco_glid = cp_sta_get_pco_glid (sta);


    fcall_param_add_short (*param, *msg, "is_backup_cco", &is_backup_cco);
    fcall_param_add (*param, *msg, "expired_date_ms", sizeof(expired_date_ms),
                      &expired_date_ms);
    fcall_param_add (*param, *msg, "tei_lease_ms", sizeof (tei_lease_ms),
                      &tei_lease_ms);
    fcall_param_add_short (*param, *msg, "cco_cap", &cco_cap);
    fcall_param_add_short (*param, *msg, "pco_cap", &pco_cap);
    fcall_param_add_short (*param, *msg, "backup_cco_cap", &backup_cco_cap);
    fcall_param_add_short (*param, *msg, "numdissta", &numDisSta);
    fcall_param_add_short (*param, *msg, "numdisnet", &numDisNet);
    fcall_param_add_short (*param, *msg, "tei", &tei);
    fcall_param_add_short (*param, *msg, "is_cco", &is_cco);
    fcall_param_add_short (*param, *msg, "pco_glid", &pco_glid);

    return true;
}