summaryrefslogtreecommitdiff
path: root/hle/test/overide/cl/cl.h
blob: baffce201b4a9b9a7f1f175072f82a0e4523b658 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#ifndef test_overide_cl_cl_h
#define test_overide_cl_cl_h
/* Cesar project {{{
 *
 * Copyright (C) 2007 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    test/overide/cl/cl.h
 * \brief   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */

typedef struct cl_t cl_t;
typedef uint cl_mme_recv_t;

// for the tests;
typedef uint mac_store_t;
typedef uint sar_t;

/**
 * Callback to provide a received data to the upper layer comming from the SAR.
 * 
 * \param  user  the user data
 * \param  buffer  the buffer containing the data
 * \param  length  the data length in the buffer.
 */
typedef void (*cl_data_recv_cb_t) (void *user, u8 *buffer, uint length);

/**
 * Callback use to inform the upper layer when a data had been sent over the 
 * PLC.
 * 
 * \param  user  the user data
 * \param  buffer  the buffer use to send the data over the PLC.
 */
typedef void (*cl_data_send_done_cb_t) (void *user, u8 *buffer);

/**
 * Call back to use when the CL needs to send a MME to the upper layer.
 * 
 * \param  ul_data  the upper layer data provided on the registration.
 * \param  buffer  the buffer containig the MME.
 * \param  length  the length of the MME
 */
typedef void (*cl_mme_ul_send_done_cb_t) (void *ul_data, u8 *buffer, uint length);

/**
 * Callback definition used by the CL when the CP had processed the MME
 * in the buffer. This will return the buffer to the upper layer.
 * 
 * \param  user_data  the upper layer user data
 * \param  buffer  the buffer containing the MME.
 */
typedef void (*cl_mme_ul_recv_done_cb_t) (void *user_data, u8 *buffer);

/**
 * Provides a MME buffer to the CP.
 *
 * \param  user_data  the layer data.
 * \param  buffer  the buffer to provide.
 */
typedef void (*cl_mme_buffer_add_cb_t) (void *user_data, u8 *buffer);

/**
 * Initialize the callback to receive the data from the PLC.
 * 
 * \param  cl  the CL context
 * \param  cb  the function callback to call
 * \param  user  the user data to provide on the callback.
 */
void cl_data_recv_init (cl_t *cl, cl_data_recv_cb_t cb, void *user);

/**
 * Initialize the callback to inform the upper layer when a data had been sent
 * over the PLC.
 * 
 * \param  cl  the CL context
 * \param  cb  the callback to call once the data had been sent
 * \param  user  the user data to provide with the callback call  
 */
void cl_data_send_done_init (cl_t *cl, cl_data_send_done_cb_t cb, void *user);

/**
 * Initialize the CL to send MMEs to the Upper layer considered as data.
 * Used each time the CP needs to send an MME to the upper layer.
 * 
 * \param  ctx  the CL context
 * \param  cb  the upper layer callback to use to send an MME.
 * \param  user  the user data to provide with the callback
 */
void cl_mme_init_ul_as_data (cl_t *ctx, cl_mme_ul_send_done_cb_t cb,
        void *user);

/**
 * Initialize the CL to call the Upper layer once the CP ends processing the
 * MME.
 * Used each time the CP needs to send an MME to the upper layer.
 * 
 * \param  ctx  the CL context
 * \param  cb  the upper layer callback to use to send an MME.
 * \param  user  the user data to provide with the callback
 */
void cl_mme_ul_init_send_done (cl_t *ctx, cl_mme_ul_recv_done_cb_t cb,
        void *user);

/**
 * Send a data from the upper layer to the SAR, this data should be sent over
 * the PLC.
 * 
 * \param  cl  the CL context.
 * \param  buffer  the buffer containing the data to send
 * \param  length  the data length
 */
void cl_data_send (cl_t *cl, u8 *buffer, uint length);

/**
 * Provides a buffer to the SAR to reassembly data
 * 
 * \param  cl  the CL context
 * \param  buffer  the buffer to reassembly some datas
 */
void cl_data_buffer_add (cl_t *cl, u8 *buffer);

/**
 * Receives an MME from the Upper layer.
 * It will provide this MME to the Control Plane to be processed.
 * 
 * \param  ctx  the cl context
 * \param  buffer  the MME buffer
 * \param  length  the MME length
 */
void cl_mme_ul_send (cl_t *ctx, u8 *buffer, uint length);

/**
 * Provides a buffer to the CP.
 * 
 * \param  cl  the CL context
 * \param  buffer  the buffer to reassembly some datas
 */
void cl_mme_buffer_add (cl_t *cl, u8 *buffer);

/**
 * Init the Convergence Layer and return a pointer on the CL context.
 * 
 * \param  mac_store  the mac store.
 * \param  sar  the sar context.
 * \return  the convergence layer context.
 */
cl_t *cl_init (mac_store_t *mac_store, sar_t *sar);

/**
 * Uninit the Convergence layer context.
 * 
 * \param  ctx  the convergence layer context
 */
void cl_uninit (cl_t *ctx);

#endif /* test_overide_cl_cl_h */