summaryrefslogtreecommitdiff
path: root/cesar/interface/inc/mme_process.h
blob: 2e208d86830d27cd684a3b0e7d1aa85af03252af (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
#ifndef interface_inc_mme_process_h
#define interface_inc_mme_process_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    interface/inc/mme_process.h
 * \brief   Function to read or get the informations.
 * \ingroup interface 
 *
 */

/**
 * Interface read the MMtype of the MME.
 *
 * \param  buffer  the buffer to get the MMtype.
 * \return  the MME type.
 */
extern inline uint
interface_mmtype_get (u8 *buffer)
{
    dbg_assert (buffer);
    return read_u16_from_word (buffer + 0xF);
}

/**
 * Get the sub module information.
 * \param  buffer the buffer containing the MME.
 * \return  the submodule id in the interface.
 *
 *   - 0 for interface module.
 *   - 1 for sniffer module.
 *   - 2 for fcall module.
 */
extern inline uint
interface_moduleid_get (u8 *buffer)
{
    dbg_assert (buffer);
    return read_u8_from_word (buffer + 0x13);
}

/**
 * Send the configuration part to the Sniffer sub module and create the
 * response of the configuration.
 * \param  ctx  the interface context.
 * \param  buffer  the MME buffer containing the data and use to response.
 * 
 * Provide the configuration byte to the sniffer sub module and reuse the
 * buffer to create the confirm MME by replace the MMType and the payload by
 * the ACK value.
 * For that this will call the interface_sniffer_status which returns the
 * corresponding value of the sniffer configuration as the same format as the
 * one present in the MME. If the two data are equals then the ACK is
 * positive, in the other case it will be equal to 0.
 */
void
interface_sniffer_configure_and_respond (interface_t *ctx, u8 *buffer);

#endif /* interface_inc_mme_process_h */