summaryrefslogtreecommitdiff
path: root/cesar/cp/msg/msg.h
blob: 448ab2f92e0fe18fb678ffd1baee19bfa07b9705 (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
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/msg/msg.h
 * \brief   MME message processing
 * \ingroup cp_msg
 */

#ifndef msg__h__
#define msg__h__

#include "cp/interf/inc/interf_types.h"
#include "cp/msg/inc/msg_const.h"
#include "cp/msg/inc/msg_cc.h"
#include "cp/msg/inc/msg_cm.h"
#include "cp/msg/inc/msg_drv.h"
#include "cp/cp_types.h"
#include "cp/interf/interf.h"

/*
 * Global variables
 */
extern const msg_list_mme_t msg_list[];


void 
msg_test_rcv(const msg_mme_t *msg);

/**
 * \brief       init the msg module
 */
void msg_init(void);

/**
 * \brief       return the fmsn (Fragmentation Message Sequence Number) to be used
 * \param       new : set to true if this is a new sequence 
 * \return      the fmsn
 */
u8
msg_get_fmsn(const bool new);


/**
 * \brief		Give the message number in our local reference.
 * \param		Msg : pointer to the message 
 * \return  	the message number or UNKNOW_MSG
 */
u16 
msg_get_number (msg_mme_t *msg);

/**
 * \brief       this function is called in STA or CCO thread when a message is 
 *              present in the corresponding fifo.		
// * \param       msg : pointer to the message
 * \param       msg_ctx : pointer to the message context
 * \return 		
 */
//void
//msg_dispatch (msg_mme_t *msg);
void
msg_dispatch (msg_ctx_t *msg_ctx);

/**
 * \brief		set the const values of mme (ie mtype) 		
 * \param 		Msg : pointer to the message
 * \return 		
 */
void 
msg_set_mme_const_values (msg_mme_t *msg);

/**
 * \brief		check the const values of mme (ie mtype) 		
 * \param 		Msg : pointer to the message
 * \return 		true if ok
 */
bool 
msg_check_wrong_mme_const_values (const msg_mme_t *msg);


/**
 * \brief       common process to all message when sending a message        
 * \param       oda : destination mac address
 * \param       msg_param : the message parameters (will be set to default values)
 * \return      pointer to the message
 */
msg_mme_t *
msg_sending_common_part(msg_mme_t *msg, const mac_address_t oda, msg_param_t *msg_param);

/**
 * \brief       add field common to all mme messages (OSA)
 *              and send it through the interface        
 * \param       msg : pointer to the message
 * \param       msg_size : size of the message (including header)
 * \return      
 */
void
msg_send(msg_mme_t *msg, u16 msg_size, msg_param_t msg_param);

#endif